JuliaPackaging / WinRPM.jl

RPM-md processing library
Other
21 stars 44 forks source link

Regex match (now basename) #137

Open tbeason opened 6 years ago

tbeason commented 6 years ago

I had trouble with escape butchering a folderpath into a filename. I found that using a simple regex match to pick off the filename solved my problems. Don't know if other people might have had this issue as well. I'm on Windows 7 and Julia v0.7.

tkelman commented 6 years ago

I had trouble with escape butchering a folderpath into a filename.

Can you please elaborate?

tbeason commented 6 years ago

Sorry, wasn't sure how to explain that. https://github.com/nalimilan/StringEncodings.jl/issues/22 is the relevant issue. If you look at the line that errors, it says

ERROR: The system cannot find the file specified.
C:\Users\tbeason\.julia\v0.7\WinRPM\cache\2\noarch%2Fmingw64-win_iconv-dll-0.0.8-3.15.noarch.cpio

and when I looked in the folder, I saw this

λ ls -1 C:\Users\tbeason\.julia\v0.7\WinRPM\cache\2
mingw64-win_iconv-dll-0.0.8-3.15.noarch.cpio
noarch%2Fmingw64-win_iconv-dll-0.0.8-3.15.noarch.rpm
repodata%2F58a3da7b6a7a7cf1c71a355252e0d9db1aab60162e9017b2235f5fa7a118660f-primary.xml
repodata%2Frepomd.xml

So you see that the *.cpio file does not have the noarch%2F on its front, and that is why it can't be found. The noarch%2F is a result of escape(path) because the path begins noarch/.... So what this regex does is just essentially drop the noarch/ from the beginning of the filename.

It is unclear to me why some files were written with the noarch%2F beginning and some were not in the first place, which may be where you want to look if my solution isn't the correct one. But this did fix the issue on my system. Not a problem with escape per se, which is definitely how my description could have been interpreted.

tkelman commented 6 years ago

I suspect this would not work on julia 0.6, and is a difference in behavior between the different versions of 7zip bundled in julia 0.6 vs nightly.