Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6805: More compatible rpmvercmp behavior #6808

Merged
merged 1 commit into from
May 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cabal/Distribution/Types/PkgconfigVersion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ rpmvercmp :: BS.ByteString -> BS.ByteString -> Ordering
rpmvercmp a b = go0 (BS.unpack a) (BS.unpack b)
where
go0 :: [Word8] -> [Word8] -> Ordering
-- if there is _any_ trailing "garbage", it seems to affect result
-- https://github.com/haskell/cabal/issues/6805
go0 [] [] = EQ
go0 [] _ = LT
go0 _ [] = GT
go0 xs ys = go1 (dropNonAlnum8 xs) (dropNonAlnum8 ys)

go1 :: [Word8] -> [Word8] -> Ordering
Expand Down