[darcs-devel] [issue216] Darcs bug: Invalid Pending
Gareth Smith
bugs at darcs.net
Mon Jul 3 13:53:43 PDT 2006
New submission from Gareth Smith <smith at bcs.org>:
Hi - I don't know which of you folk this is more appropriate for, so I
thought I'd let you both know. (thauvin - you're listed as the mandriva
darcs package maintainer at
http://qa.mandriva.com/cgi-bin/srpmmaints.cgi)
$ darcs --exact-version
darcs compiled on Feb 23 2005, at 15:05:58
unknown
$ rpm -qf /usr/bin/darcs
darcs-1.0.2-1mdk
Google tells me that there's a much newer mandrake package (the package
I'm using seems to be the default mandriva 10.2 one), so I'll be
upgrading to that anyway - but it said to report the bug, so here you
go:
I just tried a darcs pull, and got the following output:
Shall I pull this patch? (1/1) [ynWvxqadjk], or ? for help: y
We have conflicts in the following files:
./Plugin/Url.hs
Fail: bug in darcs!
There was an attempt to write an invalid pending!
If possible, please send the contents of _darcs/pending_buggy along
with a bug report.
There seems to be no file named "_darcs/pending_buggy", but there is a
"_darcs/patches/pending_buggy", so I'm attaching that.
I have changed Url.hs, so that conflict was kindof expected.
----------
files: pending_buggy
messages: 756
nosy: droundy, smith, thauvin, tommy
status: unread
title: Darcs bug: Invalid Pending
____________________________________
Darcs issue tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue216>
____________________________________
-------------- next part --------------
{
{
[New features for URL plugin
pete-lambdabot at kazmier.com*-20060613150036
Added a few features:
- When looking for URLs in contextual messages, strip off trailing
characters such as periods, commas, NUL bytes, etc ... as they
are most likely part of the context and not the URL.
- Added a list of ignored substrings that are matched against
contextual messages. If any of these are found, the plugin
does not bother looking for URLs. This is a safe-guard against
2 lambdabots with the URL plugin that happens to fetch a page
title containing a URL. It also can be used to prevent responding
to lisppaste messages.
- Finally, limit the length of page titles to 80 characters to prevent
bad guys spamming the channel.
] {
hunk ./Plugin/Url.hs 156
--- | Utility function to remove potential suffixes from a string.
--- Note, once a suffix is found, it is stripped and returned, no other
--- suffixes are searched for at that point.
-stripSuffixes :: [String] -> String -> String
-stripSuffixes [] str = str
-stripSuffixes (s:ss) str
- | isSuffixOf s str = take (length str - length s) $ str
- | otherwise = stripSuffixes ss str
-
-
--- | Utility function to check of any of the Strings in the specified
--- list are substrings of the String.
-areSubstringsOf :: [String] -> String -> Bool
-areSubstringsOf = flip (any . flip isSubstringOf)
- where
- isSubstringOf s str = any (isPrefixOf s) (tails str)
-
-
hunk ./Plugin/Url.hs 76
- where
- limitLength s
- | length s > maxTitleLength = (take maxTitleLength s) ++ " ..."
- | otherwise = s
hunk ./Plugin/Url.hs 69
- (return .
- ("The title of that page is \"" ++) .
- (++ "\"") .
- limitLength)
+ (return . ("The title of that page is \"" ++) . (++ "\""))
hunk ./Plugin/Url.hs 59
- return $ stripSuffixes ignoredUrlSuffixes $ kind ++ url
+ return $ kind ++ url
hunk ./Plugin/Url.hs 30
--- | List of strings that, if present in a contextual message, will
--- prevent the looking up of titles. This list can be used to stop
--- responses to lisppaste for example. Another important use is to
--- another lambdabot looking up a url title that contains another
--- url in it (infinite loop). Ideally, this list could be added to
--- by an admin via a privileged command (TODO).
-ignoredStrings :: [String]
-ignoredStrings =
- ["pasted", -- Ignore lisppaste
- "HaskellIrcPastePage", -- Ignore paste page
- "title of that page"] -- Ignore others like me
-
--- | Limit the maximum title length to prevent jokers from spamming
--- the channel with specially crafted HTML pages.
-maxTitleLength :: Int
-maxTitleLength = 80
-
--- | Suffixes that should be stripped off when identifying URLs in
--- contextual messages. These strings may be punctuation in the
--- current sentence vs part of a URL. Included here is the NUL
--- character as well.
-ignoredUrlSuffixes :: [String]
-ignoredUrlSuffixes = [".", ",", ";", ")", "\"", "\1"]
-
hunk ./Plugin/Url.hs 20
- contextual _ _ _ text = do
- alive <- readMS
- if alive && (not $ areSubstringsOf ignoredStrings text)
- then case containsUrl text of
- Nothing -> return []
- Just url -> getPageTitle url
- else return []
+ contextual _ _ _ text = do alive <- readMS
+ if alive
+ then case containsUrl text of
+ Nothing -> return []
+ Just url -> getPageTitle url
+ else return []
hunk ./AUTHORS 98
-
-Pete Kazmier <pete-lambdabot at kazmier.com>
- * Url page title chaser
- * Contextual messages
-
}
}
{
hunk ./Config.hs 47
- name = "lambdabot",
- userinfo = "Lambda_Robots:_100%_Loyal",
- host = "chat.freenode.net",
+ name = "lambdabunny",
+ userinfo = "lambdabot ircology experiment",
+ host = "irc.theproject.org.uk",
hunk ./Config.hs 55
- proxy = Just ("www-proxy",3128),
- autojoin = ["#haskell","#haskell-blah","#flippi"
- ,"#haskell-overflow","#gentoo-haskell"
- ,"#haskell_ru", "#darcs" , "#perl6"
- ,"#haskell.it","#haskell.se", "#haskell.es","#ScannedInAvian"],
-
+ proxy = Nothing,
+ autojoin = ["#ircology"
+ , "#scoobies"
+ ],
hunk ./Config.hs 61
- "Pseudonym", "shapr", "Heffalump", "Igloo",
- "Cale", "dons", "TheHunter", "musasabi"
+ "gds", "steve", "susz"
hunk ./Config.hs 64
- fortunePath = "/home/dons/fortune/",
- fptoolsPath = "/home/dons/fptools",
+ fortunePath = "fortune",
+ fptoolsPath = "/data/haskell-libs/lambdabot/Plugin/",
hunk ./Modules.hs 1
-MODULES Base System Dict Dummy Karma Quote Seen State Topic Type Eval Babel Version More Pl Help Dice Search Vixen Fact Todo Spell Haddock Hoogle Where Elite Localtime Poll Djinn Pretty Compose Lambda Unlambda Log Slap DrHylo Instances Fresh Tell Url
+MODULES Base System Dict Dummy Karma Quote Seen State Topic Type Eval Babel Version More Pl Help Dice Search Vixen Fact Todo Spell Haddock Hoogle Where Elite Localtime Poll Djinn Pretty Compose Lambda Unlambda Log Slap DrHylo Instances Fresh Tell Url BunnyCat
hunk ./Plugin/Url.hs 69
+v v v v v v v
hunk ./Plugin/Url.hs 74
+*************
+ (return . ("Context: \"" ++) . (++ "\""))
+^ ^ ^ ^ ^ ^ ^
hunk ./State/karma 62
+("bunnycat",1)
hunk ./State/karma 140
+("susz",1)
}
{
{
[New features for URL plugin
pete-lambdabot at kazmier.com**20060613150036
Added a few features:
- When looking for URLs in contextual messages, strip off trailing
characters such as periods, commas, NUL bytes, etc ... as they
are most likely part of the context and not the URL.
- Added a list of ignored substrings that are matched against
contextual messages. If any of these are found, the plugin
does not bother looking for URLs. This is a safe-guard against
2 lambdabots with the URL plugin that happens to fetch a page
title containing a URL. It also can be used to prevent responding
to lisppaste messages.
- Finally, limit the length of page titles to 80 characters to prevent
bad guys spamming the channel.
] {
hunk ./AUTHORS 98
+
+Pete Kazmier <pete-lambdabot at kazmier.com>
+ * Url page title chaser
+ * Contextual messages
+
hunk ./Plugin/Url.hs 20
- contextual _ _ _ text = do alive <- readMS
- if alive
- then case containsUrl text of
- Nothing -> return []
- Just url -> getPageTitle url
- else return []
+ contextual _ _ _ text = do
+ alive <- readMS
+ if alive && (not $ areSubstringsOf ignoredStrings text)
+ then case containsUrl text of
+ Nothing -> return []
+ Just url -> getPageTitle url
+ else return []
hunk ./Plugin/Url.hs 30
+-- | List of strings that, if present in a contextual message, will
+-- prevent the looking up of titles. This list can be used to stop
+-- responses to lisppaste for example. Another important use is to
+-- another lambdabot looking up a url title that contains another
+-- url in it (infinite loop). Ideally, this list could be added to
+-- by an admin via a privileged command (TODO).
+ignoredStrings :: [String]
+ignoredStrings =
+ ["pasted", -- Ignore lisppaste
+ "HaskellIrcPastePage", -- Ignore paste page
+ "title of that page"] -- Ignore others like me
+
+-- | Limit the maximum title length to prevent jokers from spamming
+-- the channel with specially crafted HTML pages.
+maxTitleLength :: Int
+maxTitleLength = 80
+
+-- | Suffixes that should be stripped off when identifying URLs in
+-- contextual messages. These strings may be punctuation in the
+-- current sentence vs part of a URL. Included here is the NUL
+-- character as well.
+ignoredUrlSuffixes :: [String]
+ignoredUrlSuffixes = [".", ",", ";", ")", "\"", "\1"]
+
hunk ./Plugin/Url.hs 59
- return $ kind ++ url
+ return $ stripSuffixes ignoredUrlSuffixes $ kind ++ url
merger 0.0 (
hunk ./Plugin/Url.hs 69
- (return . ("The title of that page is \"" ++) . (++ "\""))
+ (return . ("Context: \"" ++) . (++ "\""))
hunk ./Plugin/Url.hs 69
- (return . ("The title of that page is \"" ++) . (++ "\""))
+ (return .
+ ("The title of that page is \"" ++) .
+ (++ "\"") .
+ limitLength)
)
hunk ./Plugin/Url.hs 73
+ where
+ limitLength s
+ | length s > maxTitleLength = (take maxTitleLength s) ++ " ..."
+ | otherwise = s
hunk ./Plugin/Url.hs 153
+-- | Utility function to remove potential suffixes from a string.
+-- Note, once a suffix is found, it is stripped and returned, no other
+-- suffixes are searched for at that point.
+stripSuffixes :: [String] -> String -> String
+stripSuffixes [] str = str
+stripSuffixes (s:ss) str
+ | isSuffixOf s str = take (length str - length s) $ str
+ | otherwise = stripSuffixes ss str
+
+
+-- | Utility function to check of any of the Strings in the specified
+-- list are substrings of the String.
+areSubstringsOf :: [String] -> String -> Bool
+areSubstringsOf = flip (any . flip isSubstringOf)
+ where
+ isSubstringOf s str = any (isPrefixOf s) (tails str)
+
+
}
}
{
hunk ./Plugin/Url.hs 69
- (return . ("The title of that page is \"" ++) . (++ "\""))
+v v v v v v v
+ (return .
+ ("The title of that page is \"" ++) .
+ (++ "\"") .
+ limitLength)
+*************
+ (return . ("Context: \"" ++) . (++ "\""))
+^ ^ ^ ^ ^ ^ ^
}
}
}
More information about the darcs-devel
mailing list