1

I have an unarchiver that takes in an archive name, and a directory name, and dumps all files from that archive into that directory. No other command-line options. However, someone zipped a file in the archive I am looking to decompress, with 500-ish characters in the filename, and now that program fails when it hits that file (practically all file systems have a limit of 256). What alternative do I have, short of changing the source code and recompiling the unarchiver?

I must mount something as a directory, which would take the files that the unarchiver is writing, and dump them elsewhere-- possibly even as one big file. This something should not send fail messages, even if some write really did fail. Is this possible?

Alex
  • 947
  • 1
  • 8
  • 25
  • Weird. How did they create the archive? Is it something you can extract to `stdout`? `unzip -p zipfile reallyLongFileName > somethingSane` Please forgive my `unzip` syntax. I've never used it. If that works, maybe you could write a script to cope with it. – Erik Bennett Jun 29 '17 at 21:43
  • I actually was able to fix this by manually editing the archive, and zeroing out the end of the filename. It turns out the archive contains a short filename, followed by the long one-- I guess the short is what it was stored as when it was added, and the long is what it would be extracted as. But your suggestion would not have worked, because the unarchiver does not write to stdout. – Alex Jun 29 '17 at 21:57
  • You're running into filesystem limits and your current path is a part of a problem. If you run something like `sudo mkdir /z; sudo chmod 777 /z; cd /z; unzip …` then you might get lucky since the full paths of each component are that much shorter. Otherwise, you need a filesystem that is more flexible about its max path lengths. – Adam Katz Jun 29 '17 at 23:05
  • @AdamKatz Nope-- it's only the filename. I was already unzipping to '/2'. – Alex Jun 29 '17 at 23:49
  • Ouch. Your best bet may be to open up the archive in a hex editor and then rename the file. I assume most archives are fine with such a manipulation, but you definitely want to make a copy of it before you mess with its raw data. – Adam Katz Jun 29 '17 at 23:53
  • 1
    The only FS listed on [Wikipedia's FS comparison](https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits) with a filename limit beyond 256 characters is [Reiser4](https://en.wikipedia.org/wiki/Reiser4), which is *not* production-grade. You can create a small loopback instance of it for this purpose and then rename the file. There's a pretty good chance something is corrupted though, so be careful with the contents! – Adam Katz Jun 29 '17 at 23:57
  • @AdamKatz Thanks for the suggestion. I considered trying to do that before asking this question, but then decided it was easier to write a script which scanned the archive for filename lengths, and reported any time it found something over X number of bytes, so I could hex-edit those out. – Alex Jun 30 '17 at 00:01

0 Answers0