ckolivas / lrzip

Long Range Zip
http://lrzip.kolivas.org
GNU General Public License v2.0
618 stars 76 forks source link

BUG: Impled lrz extension causes lrzip -d|t to fail #155

Closed pete4abw closed 4 years ago

pete4abw commented 4 years ago

One of the features baked into lrzip was to allow the user to save a few keystrokes when decompressing or testing a file. If the .lrz was left out on the command line, e.g.: lrzip -d test.tar, or lrzip -df test.tar, or lrzip -t test.tar lrzip would silently add the implied .lrz extension.

With the addition of the recursive functionality, this now fails in two cases.

  1. If the destination file exists (i.e. test.tar), and
  2. If the destination file does not exist.

Case 1 -rw-r--r-- 1 peter users 512 May 21 15:52 test.tar -rw-r--r-- 1 peter users 176 May 21 15:52 test.tar.lrz lrzip -d exhibits normal behavior /tmp$ lrzip -d test.tar Output filename is: test.tar Failed to create test.tar File exists Fatal error - exiting lrzip -df fails improperly lrzip -df test.tar Failed to stat test.tar Fatal error - exiting lrzip -t fails /tmp$ lrzip/lrzip -t test.tar Not an lrzip file Fatal error - exiting

Case 2 -rw-r--r-- 1 peter users 176 May 21 15:52 test.tar.lrz /tmp$ lrzip -d test.tar Failed to stat test.tar Fatal error - exiting /tmp$ lrzip -t test.tar Failed to stat test.tar Fatal error - exiting

The bugs occur in the recursive loop in main.c (Case 2) and in the function decompress_file in lrzip.c (Case 1).

The workaround is to decompress or test always using the .lrz extension with -lrzip -d|-df or lrzip -t. The fix is simple, but requires a bit of testing before release. Anyone with time is free to work on this too. I have some other priorities with version 0.7 right now.

pete4abw commented 4 years ago

Fixed in PR #157