snoyberg / tar-conduit

Conduit based tar extraction mechanism
MIT License
8 stars 9 forks source link

File path contains backslash on Windows #21

Closed snoyberg closed 5 years ago

snoyberg commented 6 years ago

This is arguably a bug, and easy to fix, just wanted to check in with @lehins first. I discovered this due to a test suite failure in pantry on Windows:

https://ci.appveyor.com/project/snoyberg/stack/build/1.0.5408

What's happening is that pantry assumes (I'd argue correctly) that paths inside a tarball use forward slashes exclusively for denoting path separators. And for the most part, this works without a hitch. However, tar-conduit use pathSeparator in a few places, likely most importantly in headerFilePathBS. As a result, we end up with a filepath of src/Hackage/Security/Client/Repository/HttpLib\HttpClient.hs instead of src/Hackage/Security/Client/Repository/HttpLib/HttpClient.hs.

@lehins Any objection to me modifying that function to always use forward slashes, so that file paths generated by this library will be consistent cross OS?

lehins commented 6 years ago

@snoyberg TLDR. No objection. :) Now, some time after I worked on tar-conduit, I'll happily argue in favor of files to be tared with paths containing forward slash only. Reason for me switching my mind is that tar isn't really a windows file in the first place, so backward slashes (as path separators) don't really belong there, but in reverse is OK, Windows supports forward slashes just fine.