ckolivas / lrzip

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

Error in lrzip.conf parsing #127

Closed pete4abw closed 5 years ago

pete4abw commented 5 years ago

I goofed in the method I interpret compression settings in lrzip.conf.

if (options_file)
        if (control->flags & FLAG_NOT_LZMA)             /* if compression set in conf file */
            control->flags &= ~FLAG_NOT_LZMA;           /* clear compression flags (LZMA now default) */

If you use COMPRESSIONMETHOD = rzip|gzip|bzip2|lzo|zpaq, it will be ignored and lzma compression will be used. I suggest commenting that parameter out until I produce a fix. If you use lrzip.conf and care to see why, read on.

DISCUSSION These lines in main.c will actually undo any compression selected, if it was one of bz2, gzip, lzo, no compression,.zpaq, since any of them will cause FLAG_NOT_LZMA to be set. In my code, I actually, stupidly, unset that flag which made lzma default again. While this permits alternate compressions to be set by the command line, it makes the COMPRESSIONSETTING parameter irrelevant here. Part of the problem is there is not a dedicated FLAG for LZMA compression (it's a negative comparison against FLAG_NOT_LZMA) so there is no way to directly test if a compression has been set if it is LZMA. lrzip by default uses LZMA. The conf file added a complication The only workaround will be to add a flag or global variable to test for ANY compression being set, not just FLAG_NOT_LZMA..

#define FLAG_NOT_LZMA (FLAG_NO_COMPRESS | FLAG_LZO_COMPRESS | FLAG_BZIP2_COMPRESS | FLAG_ZLIB_COMPRESS | FLAG_ZPAQ_COMPRESS) #define LZMA_COMPRESS (!(control->flags & FLAG_NOT_LZMA))

Sorry about this. Just be aware that if you set a non-LZMA compression in your conf file, it will be overridden by LZMA unless you use the command line switch..

pete4abw commented 5 years ago

See pull request #128