source: npl/system/klibc/patches/gzip-fix-silent-fallback-to-decompression.patch @ a39aa4c

perl-5.22
Last change on this file since a39aa4c was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 2.4 KB
  • usr/gzip/gzip.c

    From: Ben Hutchings <ben@decadent.org.uk>
    Date: Fri, 18 Sep 2015 21:59:17 +0200
    Subject: gzip: Fix silent fallback to decompression
    Bug-Debian: https://bugs.debian.org/355809
    Forwarded: http://www.zytor.com/pipermail/klibc/2016-January/003892.html
    
    If the gzip utilities are built without support for compression,
    they will always attempt to carry out decompression even if the
    command name and options don't imply that.  Instead they should
    fail with an explicit error in this case.
    
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    a b int level = 6; /* compression lev 
    9090#endif
    9191
    9292int to_stdout;        /* output to stdout (-c) */
    93 #ifndef decompress
     93#ifdef decompress
     94int decompress_wanted;
     95#else
    9496int decompress;       /* decompress (-d) */
     97#define decompress_wanted decompress
    9598#endif
    9699int force;            /* don't ask questions, compress links (-f) */
    97100int no_name = -1;     /* don't save or restore the original file name */
    int main (argc, argv) 
    259262     * Systems which do not support links can still use -d or -dc.
    260263     * Ignore an .exe extension for MSDOS, OS/2 and VMS.
    261264     */
    262 #ifndef decompress
    263265    if (  strncmp(progname, "un",  2) == 0     /* ungzip, uncompress */
    264266       || strncmp(progname, "gun", 3) == 0) {  /* gunzip */
    265         decompress = 1;
     267        decompress_wanted = 1;
    266268    }
    267 #endif
    268269    if (strequ(progname+1, "cat")       /* zcat, pcat, gcat */
    269270        || strequ(progname, "gzcat")) {    /* gzcat */
    270 #ifndef decompress
    271         decompress = 1;
    272 #endif
     271        decompress_wanted = 1;
    273272        to_stdout = 1;
    274273    }
    275274#endif
    int main (argc, argv) 
    282281        case 'c':
    283282            to_stdout = 1; break;
    284283        case 'd':
    285 #ifndef decompress
    286             decompress = 1;
    287 #endif
     284            decompress_wanted = 1;
    288285            break;
    289286        case 'f':
    290287            force++; break;
    int main (argc, argv) 
    308305            break;
    309306        case 't':
    310307            test = to_stdout = 1;
    311 #ifndef decompress
    312             decompress = 1;
    313 #endif
     308            decompress_wanted = 1;
    314309            break;
    315310        case 'v':
    316311            verbose++; quiet = 0; break;
    int main (argc, argv) 
    329324        }
    330325    } /* loop on all arguments */
    331326
     327#ifndef SUPPORT_ZIP
     328    if (!decompress_wanted) {
     329        fprintf(stderr, "%s: this version does not support compression\n",
     330                progname);
     331        do_exit(ERROR);
     332    }
     333#endif
     334
    332335    /* By default, save name and timestamp on compression but do not
    333336     * restore them on decompression.
    334337     */
Note: See TracBrowser for help on using the repository browser.