Permalink
Browse files

When parsing CONTENTS files, be a bit more tolerant.

  • Loading branch information...
1 parent bc6214c commit f972bd961ec10fafba8d77f5302ccc8a62e649c7 @kolmodin kolmodin committed May 24, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 Distribution/Gentoo/Packages.hs
View
4 Distribution/Gentoo/Packages.hs
@@ -161,10 +161,12 @@ parseContents cp = do ex <- doesFileExist cFile
-- how spaces are represented in file names.
-- This might cause a problem if there is more than a single
-- space (or a tab) in the filename...
+ -- Also require at least 3 words in case of an object, as the CONTENTS
+ -- file can be corrept (fixes an actual problem).
parseCLine :: [ByteString] -> Maybe Content
parseCLine (tp:ln)
| tp == dir = Just . Dir . BS.unwords $ ln
- | tp == obj = Just . Obj . BS.unwords $ dropLastTwo ln
+ | tp == obj && length ln >= 3 = Just . Obj . BS.unwords $ dropLastTwo ln
| otherwise = Nothing
parseCLine [] = Nothing

0 comments on commit f972bd9

Please sign in to comment.