From unknown Tue Aug 12 08:33:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#76197: [PROPOSED] gzip: drop support for the GZIP env var Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gzip@gnu.org Resent-Date: Tue, 11 Feb 2025 07:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 76197 X-GNU-PR-Package: gzip X-GNU-PR-Keywords: To: 76197@debbugs.gnu.org Cc: Paul Eggert X-Debbugs-Original-To: bug-gzip@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17392585889523 (code B ref -1); Tue, 11 Feb 2025 07:24:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Feb 2025 07:23:08 +0000 Received: from localhost ([127.0.0.1]:53976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1thkbr-0002TW-Ik for submit@debbugs.gnu.org; Tue, 11 Feb 2025 02:23:08 -0500 Received: from lists.gnu.org ([2001:470:142::17]:37314) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1thkbo-0002SH-J1 for submit@debbugs.gnu.org; Tue, 11 Feb 2025 02:23:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1thkbh-0007RJ-3W for bug-gzip@gnu.org; Tue, 11 Feb 2025 02:22:57 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1thkbd-0002pS-FZ for bug-gzip@gnu.org; Tue, 11 Feb 2025 02:22:56 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 647413C00517E for ; Mon, 10 Feb 2025 23:22:49 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id hbgfteMJfqCZ; Mon, 10 Feb 2025 23:22:48 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id B27333C00517D; Mon, 10 Feb 2025 23:22:48 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu B27333C00517D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1739258568; bh=Xb7fKK3mdBHsJvOYAlfhyAgOZsgeOmR5SgmF/EP+xaA=; h=From:To:Date:Message-ID:MIME-Version; b=gqGYVQx9ZFeI4MYWr2u9GUkJOfrRsNCO9buMsGw9xWp2ms6b7T/+Wfjb/Lvnsa752 A5/LTPkv28Vw3zLfFseyAYCXyCJlGUqf6a9CnWlCPB15i1qYg/+NCw/1nYha3BaTl+ hY8tg/x3p9PVY/hmdjZJuUrWK2aHfvYtlDK4bhqi7DyABFfj2zHjTqJIl8scFktpWv IPJy5VG78MSsGKG0kK6+K/F1HC7u6JDC8XL9AnbLfSEoNCYiHQ5HOrcddtkOGFIa5C 5YesfG/KgeKfw2Gq8x1GwcyWPG9xrCLiK3y5104GuYUl4wLOZ4vz3JczXz6cooQqvE Llw6oCg6MZFAQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id iaY1_XdCWumc; Mon, 10 Feb 2025 23:22:48 -0800 (PST) Received: from wing.home (unknown [47.154.28.214]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 9A7C83C011BE0; Mon, 10 Feb 2025 23:22:48 -0800 (PST) From: Paul Eggert Date: Mon, 10 Feb 2025 23:22:34 -0800 Message-ID: <20250211072241.854108-1-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=131.179.128.66; envelope-from=eggert@cs.ucla.edu; helo=mail.cs.ucla.edu X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) The GZIP environment variable is too hazardous. * gzip.c (env, ENV_OPTION): * tailor.h (OPTIONS_VAR): * util.c (SEPARATOR, add_envopt): Remove. All uses removed. * gzip.c (main): Ignore GZIP. * tests/gzip-env: Test that GZIP is ignored. --- NEWS | 6 ++++ doc/gzip.texi | 11 ++----- gzip.1 | 18 ++++-------- gzip.c | 79 +------------------------------------------------- gzip.h | 1 - tailor.h | 4 --- tests/gzip-env | 19 +++++------- util.c | 60 -------------------------------------- znew.in | 2 +- 9 files changed, 24 insertions(+), 176 deletions(-) diff --git a/NEWS b/NEWS index e348355..0c4a2fc 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,12 @@ GNU gzip NEWS -*- out= line -*- =20 * Noteworthy changes in release ?.? (????-??-??) [?] =20 +** Changes in behavior + + The GZIP environment variable, which was marked as obsolescent in + gzip 1.7 (2016) due to its hazards, has been removed. You can use + an alias or script instead. + ** Bug fixes =20 'gzip -d' no longer omits the last partial output buffer when the diff --git a/doc/gzip.texi b/doc/gzip.texi index cc05b60..1bfca98 100644 --- a/doc/gzip.texi +++ b/doc/gzip.texi @@ -487,14 +487,9 @@ complement to @command{tar}, not as a replacement. @chapter Environment @cindex Environment =20 -The obsolescent environment variable @env{GZIP} can hold a set of -default options for @command{gzip}. These options are interpreted -first and can be overwritten by explicit command line parameters. As -this can cause problems when using scripts, this feature is supported -only for options that are reasonably likely to not cause too much -harm, and @command{gzip} warns if it is used. This feature will be -removed in a future release of @command{gzip}. - +Although previous verions of @command{gzip} examined the environment +variable @env{GZIP} for a set of default options, +this feature has been removed because it caused problems when using scri= pts. You can use an alias or script instead. For example, if @command{gzip} is in the directory @samp{/usr/bin} you can prepend @file{$HOME/bin} to your @env{PATH} and create an executable script diff --git a/gzip.1 b/gzip.1 index 0efe399..4afa243 100644 --- a/gzip.1 +++ b/gzip.1 @@ -416,20 +416,12 @@ such as tar or zip. GNU tar supports the \-z option to invoke gzip transparently. gzip is designed as a complement to tar, not as a replacement. .SH "ENVIRONMENT" -The obsolescent environment variable -.B GZIP -can hold a set of default options for -.BR gzip . -These options are interpreted first and can be overwritten by explicit -command line parameters. -As this can cause problems when using scripts, -this feature is supported only for options that are -reasonably likely to not cause too much harm, and +Although previous versions of .B gzip -warns if it is used. -This feature will be removed in a future release of -.BR gzip . -.PP +examined the environment variable +.B GZIP +for a set of default options, this feature has been removed +because it caused problems when using scripts. You can use an alias or script instead. For example, if .B gzip diff --git a/gzip.c b/gzip.c index a33841a..1fe589b 100644 --- a/gzip.c +++ b/gzip.c @@ -182,7 +182,6 @@ static int foreground =3D 0; /* set if program run = in foreground */ static int last_member; /* set for .zip and .Z files */ static int part_nb; /* number of parts in .gz file */ off_t ifile_size; /* input file size, -1 for devices (debug = only) */ -static char *env; /* contents of GZIP env variable */ static char const *z_suffix; /* default suffix (can be set with --suffix= ) */ static size_t z_len; /* strlen(z_suffix) */ =20 @@ -249,10 +248,6 @@ enum PRESUME_INPUT_TTY_OPTION =3D CHAR_MAX + 1, RSYNCABLE_OPTION, SYNCHRONOUS_OPTION, - - /* A value greater than all valid long options, used as a flag to - distinguish options derived from the GZIP environment variable. */ - ENV_OPTION }; =20 static char const shortopts[] =3D "ab:cdfhH?klLmMnNqrS:tvVZ123456789"; @@ -413,9 +408,6 @@ int main (int argc, char **argv) { int file_count; /* number of files to process */ size_t proglen; /* length of program_name */ - char **argv_copy; - int env_argc; - char **env_argv; =20 EXPAND(argc, argv); /* wild card expansion if necessary */ =20 @@ -426,11 +418,6 @@ int main (int argc, char **argv) if (4 < proglen && strequ (program_name + proglen - 4, ".exe")) program_name[proglen - 4] =3D '\0'; =20 - /* Add options in GZIP environment variable if there is one */ - argv_copy =3D argv; - env =3D add_envopt (&env_argc, &argv_copy, OPTIONS_VAR); - env_argv =3D env ? argv_copy : NULL; - #ifndef GNU_STANDARD # define GNU_STANDARD 1 #endif @@ -454,49 +441,8 @@ int main (int argc, char **argv) z_len =3D strlen(z_suffix); =20 while (true) { - int optc; int longind =3D -1; - - if (env_argv) - { - if (env_argv[optind] && strequ (env_argv[optind], "--")) - optc =3D ENV_OPTION + '-'; - else - { - optc =3D getopt_long (env_argc, env_argv, shortopts, lon= gopts, - &longind); - if (0 <=3D optc) - optc +=3D ENV_OPTION; - else - { - if (optind !=3D env_argc) - { - fprintf (stderr, - ("%s: %s: non-option in "OPTIONS_VAR - " environment variable\n"), - program_name, env_argv[optind]); - try_help (); - } - - /* Wait until here before warning, so that GZIP=3D'-= q' - doesn't warn. */ - if (env_argc !=3D 1 && !quiet) - fprintf (stderr, - ("%s: warning: "OPTIONS_VAR" environment = variable" - " is deprecated; use an alias or script\= n"), - program_name); - - /* Start processing ARGC and ARGV instead. */ - free (env_argv); - env_argv =3D NULL; - optind =3D 1; - longind =3D -1; - } - } - } - - if (!env_argv) - optc =3D getopt_long (argc, argv, shortopts, longopts, &longin= d); + int optc =3D getopt_long (argc, argv, shortopts, longopts, &long= ind); if (optc < 0) break; =20 @@ -532,15 +478,12 @@ int main (int argc, char **argv) case 'M': /* undocumented, may change later */ no_time =3D 0; break; case 'n': - case 'n' + ENV_OPTION: no_name =3D no_time =3D 1; break; case 'N': - case 'N' + ENV_OPTION: no_name =3D no_time =3D 0; break; case PRESUME_INPUT_TTY_OPTION: presume_input_tty =3D true; break; case 'q': - case 'q' + ENV_OPTION: quiet =3D 1; verbose =3D 0; break; case 'r': #if NO_DIR @@ -553,7 +496,6 @@ int main (int argc, char **argv) break; =20 case RSYNCABLE_OPTION: - case RSYNCABLE_OPTION + ENV_OPTION: rsync =3D 1; break; case 'S': @@ -575,7 +517,6 @@ int main (int argc, char **argv) test =3D decompress =3D to_stdout =3D 1; break; case 'v': - case 'v' + ENV_OPTION: verbose++; quiet =3D 0; break; case 'V': version (); finish_out (); break; @@ -584,28 +525,12 @@ int main (int argc, char **argv) program_name); try_help (); break; - case '1' + ENV_OPTION: case '2' + ENV_OPTION: case '3' + ENV_O= PTION: - case '4' + ENV_OPTION: case '5' + ENV_OPTION: case '6' + ENV_O= PTION: - case '7' + ENV_OPTION: case '8' + ENV_OPTION: case '9' + ENV_O= PTION: - optc -=3D ENV_OPTION; - FALLTHROUGH; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': level =3D optc - '0'; break; =20 default: - if (ENV_OPTION <=3D optc && optc !=3D ENV_OPTION + '?') - { - /* Output a diagnostic, since getopt_long didn't. */ - fprintf (stderr, "%s: ", program_name); - if (longind < 0) - fprintf (stderr, "-%c: ", optc - ENV_OPTION); - else - fprintf (stderr, "--%s: ", longopts[longind].name); - fprintf (stderr, ("option not valid in "OPTIONS_VAR - " environment variable\n")); - } try_help (); } } /* loop on all arguments */ @@ -2042,8 +1967,6 @@ do_exit (int exitcode) =20 if (in_exit) exit(exitcode); in_exit =3D 1; - free(env); - env =3D NULL; FREE(inbuf); FREE(outbuf); FREE(d_buf); diff --git a/gzip.h b/gzip.h index 855a88b..66b504b 100644 --- a/gzip.h +++ b/gzip.h @@ -314,7 +314,6 @@ extern char *strlwr (char *s); extern char *gzip_base_name (char *fname) _GL_ATTRIBUTE_PURE; extern int xunlink (char *fname); extern void make_simple_name (char *name); -extern char *add_envopt (int *argcp, char ***argvp, char const *env); _Noreturn extern void gzip_error (char const *m); _Noreturn extern void xalloc_die (void); extern void warning (char const *m); diff --git a/tailor.h b/tailor.h index c9147b1..095d7ce 100644 --- a/tailor.h +++ b/tailor.h @@ -163,10 +163,6 @@ # define casemap(c) (c) #endif =20 -#ifndef OPTIONS_VAR -# define OPTIONS_VAR "GZIP" -#endif - #ifndef Z_SUFFIX # define Z_SUFFIX ".gz" #endif diff --git a/tests/gzip-env b/tests/gzip-env index b7382d9..2da5915 100755 --- a/tests/gzip-env +++ b/tests/gzip-env @@ -1,5 +1,5 @@ #!/bin/sh -# Test the obsolescent GZIP environment variable. +# Test that gzip is unaffected by the GZIP environment variable. =20 # Copyright 2015-2025 Free Software Foundation, Inc. =20 @@ -23,20 +23,17 @@ echo a >exp || framework_failure_ gzip in || framework_failure_ =20 fail=3D0 -GZIP=3D-qv gzip -d out 2>err || fail=3D1 -compare exp out || fail=3D1 =20 -for badopt in -- -c --stdout -d --decompress -f --force -h --help -k --k= eep \ +for opt in -qv \ + -- -c --stdout -d --decompress -f --force -h --help -k --keep \ -l --list -L --license -r --recursive -Sxxx --suffix=3Dxxx '--suffix x= xx' \ - -t --test -V --version -do - GZIP=3D$badopt gzip -d out 2>err && fail=3D1 -done - -for goodopt in -n --no-name -N --name -q --quiet -v --verbose \ + -t --test -V --version \ + -n --no-name -N --name -q --quiet -v --verbose \ -1 --fast -2 -3 -4 -5 -6 -7 -8 -9 --best do - GZIP=3D$goodopt gzip -d out 2>err || fail=3D1 + GZIP=3D$opt gzip inopt 2>err || fail=3D1 + compare in inopt || fail=3D1 + GZIP=3D$opt gzip -d out 2>err || fail=3D1 compare exp out || fail=3D1 done =20 diff --git a/util.c b/util.c index e3eb739..c799ac1 100644 --- a/util.c +++ b/util.c @@ -291,66 +291,6 @@ make_simple_name (char *name) } #endif =20 -/* Convert the value of the environment variable ENVVAR_NAME - to a newly allocated argument vector, and set *ARGCP and *ARGVP - to the number of arguments and to the vector, respectively. - Make the new vector's zeroth element equal to the old **ARGVP. - Return a pointer to the newly allocated string storage. - - If the vector would be empty, do not allocate storage, - do not set *ARGCP and *ARGVP, and return NULL. */ - -#define SEPARATOR " \t" /* separators in env variable */ - -char *add_envopt( - int *argcp, /* pointer to argc */ - char ***argvp, /* pointer to argv */ - char const *envvar_name) /* name of environment variable */ -{ - char *p; /* running pointer through env variable */ - char **oargv; /* runs through old argv array */ - char **nargv; /* runs through new argv array */ - int nargc =3D 0; /* number of arguments in env variable */ - char *env_val; - - env_val =3D getenv(envvar_name); - if (env_val =3D=3D NULL) return NULL; - - env_val =3D xstrdup (env_val); - - for (p =3D env_val; *p; nargc++ ) { /* move through env_val *= / - p +=3D strspn(p, SEPARATOR); /* skip leading separators */ - if (*p =3D=3D '\0') break; - - p +=3D strcspn(p, SEPARATOR); /* find end of word */ - if (*p) *p++ =3D '\0'; /* mark it */ - } - if (nargc =3D=3D 0) { - free(env_val); - return NULL; - } - *argcp =3D nargc + 1; - /* Allocate the new argv array, with an extra element just in case - * the original arg list did not end with a NULL. - */ - nargv =3D xcalloc (*argcp + 1, sizeof (char *)); - oargv =3D *argvp; - *argvp =3D nargv; - - /* Copy the program name first */ - *nargv++ =3D *oargv; - - /* Then copy the environment args */ - for (p =3D env_val; nargc > 0; nargc--) { - p +=3D strspn(p, SEPARATOR); /* skip separators */ - *(nargv++) =3D p; /* store start */ - while (*p++) ; /* skip over word */ - } - - *nargv =3D NULL; - return env_val; -} - /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D * Error handlers. */ diff --git a/znew.in b/znew.in index b09d967..e9d87f3 100644 --- a/znew.in +++ b/znew.in @@ -55,7 +55,7 @@ new=3D0 block=3D1024 # block is the disk block size (best guess, need not be exact) =20 -# Beware -s or --suffix in $GZIP. +# Beware -s or --suffix in $GZIP, used by gzip 1.13 and earlier. unset GZIP ext=3D.gz =20 --=20 2.45.2 From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 11 02:26:55 2025 Received: (at control) by debbugs.gnu.org; 11 Feb 2025 07:26:55 +0000 Received: from localhost ([127.0.0.1]:54008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1thkfX-0002hc-Ja for submit@debbugs.gnu.org; Tue, 11 Feb 2025 02:26:55 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]:53024) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1thkfV-0002hE-9E for control@debbugs.gnu.org; Tue, 11 Feb 2025 02:26:53 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 9C81E3C011BE0 for ; Mon, 10 Feb 2025 23:26:47 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id 6H_La9mwAfn4 for ; Mon, 10 Feb 2025 23:26:47 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 5E2653C00517D for ; Mon, 10 Feb 2025 23:26:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 5E2653C00517D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1739258807; bh=NKmR5jdIlfajDcmemmFn4FlNDxqsVUYQ4WSMLgYl11M=; h=Message-ID:Date:MIME-Version:To:From; b=muE73dbjP6xxilndkZ0ZN3IwwX5FaFia6LwzqQc9m8DLLQm0Ey3ISWiAUfdU/dszS Xi0nscVPzr+M2sBPGbOPcdQAMfBem8hRWiR8aElrDrYt/ilH4/l4vgbFx0rIyt4qXq TQoj6HhhNgzdAxdKhDcRqP8MFKfXuzkgWE9unFOVi4WucfS9pndaQJvnJjUxsmPiin ugxBGiKPf6MAO+T71zwbzw8gpmcuYY+GQKmpeo38jLIuTXP5D/teJLBlQ8O9vcS9u8 Kw/HXVJlYSGpEtnjmgFpnPnxBPxd0aq1K/s0wkBNm46kfgCdIUI0JDTvlc3/1P/RBl JGP2wh7/7KssA== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id FAmhYeTw_P5x for ; Mon, 10 Feb 2025 23:26:47 -0800 (PST) Received: from [192.168.254.12] (unknown [47.154.28.214]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 47C573C011BE0 for ; Mon, 10 Feb 2025 23:26:47 -0800 (PST) Message-ID: <7ec77f29-38eb-4b7f-9f6e-08f4fff6ba5f@cs.ucla.edu> Date: Mon, 10 Feb 2025 23:26:46 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: control@debbugs.gnu.org From: Paul Eggert Subject: 76197 has a patch Organization: UCLA Computer Science Department Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 76197 patch From unknown Tue Aug 12 08:33:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#76197: [PROPOSED] gzip: drop support for the GZIP env var Resent-From: Lasse Collin Original-Sender: "Debbugs-submit" Resent-CC: bug-gzip@gnu.org Resent-Date: Wed, 12 Feb 2025 13:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76197 X-GNU-PR-Package: gzip X-GNU-PR-Keywords: patch To: Paul Eggert Cc: 76197@debbugs.gnu.org Received: via spool by 76197-submit@debbugs.gnu.org id=B76197.173936869630334 (code B ref 76197); Wed, 12 Feb 2025 13:59:01 +0000 Received: (at 76197) by debbugs.gnu.org; 12 Feb 2025 13:58:16 +0000 Received: from localhost ([127.0.0.1]:33369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tiDFn-0007tC-T8 for submit@debbugs.gnu.org; Wed, 12 Feb 2025 08:58:16 -0500 Received: from mailscanner10.zoner.fi ([5.44.246.19]:36466) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tiDFl-0007so-6A for 76197@debbugs.gnu.org; Wed, 12 Feb 2025 08:58:14 -0500 Received: from www25.zoner.fi (www25.zoner.fi [84.34.147.45]) by mailscanner10.zoner.fi (Postfix) with ESMTPS id 34B2521452; Wed, 12 Feb 2025 15:58:06 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tukaani.org ; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CrqmaKotDnjQStEHSQVMqIu7+diL0ZmIEV8lp+iT9SM=; b=JCGtpovD4zLnpcw68es4difphw brKjhmc08/vo8TJHe+3YpTxdv2pE9uzJLS7RAP+vo0fEegl1PgTX1z8NZIyBZEECciQ3iVArxamrz Ee7h3Jwy5dQt+V5EwFhp8Aj8FDQ4YSNbzvCtI5JONVHL7W7BdOx6VJdi5YJNfJgvGDOAV2stJx29f m3ze9qkfP711HP5YwKd0Jqg/k9KCzO6hthWdaf+VyXygYsu+HJij1K5sn8OHipNaUFzH3R/iWRDOi 8X2xdLarNVdkC46ujNyPNkVaMrC7kgTIpDLhGo7v+bux/42C/AbAU0khE+M3ShneYgLMpM0TWACXp qCYJiWIQ==; Received: from mail.zoner.fi ([84.34.147.244]) by www25.zoner.fi with esmtp (Exim 4.97.1) (envelope-from ) id 1tiDFf-0000000C6ng-1Qmp; Wed, 12 Feb 2025 15:58:06 +0200 Date: Wed, 12 Feb 2025 15:58:05 +0200 From: Lasse Collin Message-ID: <20250212155805.4ca20b9d.lasse.collin@tukaani.org> In-Reply-To: <20250211072241.854108-1-eggert@cs.ucla.edu> References: <20250211072241.854108-1-eggert@cs.ucla.edu> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.48; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2025-02-10 Paul Eggert wrote: > The GZIP environment variable is too hazardous. I looked at old mailing list threads to understand why the GZIP environment variable was deprecated in the first place. The discussion about deprecating the GZIP environment variable was a decade ago, so I understand if commenting it now won't make a difference anymore. Take this post as a final "are you sure" before you proceed, not as a start of a new long discussion. It seems that the story starts in grep where GREP_OPTIONS was creating real-world problems.[1] GREP_OPTIONS was deprecated and then removed completely. Trouble-free uses of GREP_OPTIONS were fairly limited (perhaps --color=auto might have been such), so removing it seemed reasonable. Specifically, it was unacceptable that many scripts would need to unset GREP_OPTIONS. In gzip, bug#20104 [2] refers to troubles caused by GREP_OPTIONS. The thread doesn't mention or reference any real-world problems with GZIP though. There are scripts that need to unset GZIP, but most scripts have no reason to do that. I'm not saying that GZIP can never cause trouble, I'm only saying it's less common than it was with GREP_OPTIONS. gzip hasn't allowed arbitrary options in GZIP for years, which prevents people from doing the silliest things. While it was a good change, I suspect it didn't matter much in practice that --decompress or --suffix were allowed in GZIP. If people do things that are *obviously* silly, they can expect silly results. Among reasonable use cases, one person had used GZIP to set the default compression level.[3] GZIP=--synchronous could be a sensible use case too but that option isn't allowed in GZIP. For me, the use case for GZIP (and also TAR_OPTIONS) is injecting extra options in specific situations without a need to modify any files. That is, I don't keep those set all the time. Injecting options this way is a bit hacky but it's convenient too. If something breaks in these situations, it's obviously my own fault because I'm *effectively* modifying the scripts that run gzip and tar. The gzip manual suggests writing a wrapper script and putting it in PATH. I'm not sure how it's an improvement: - Options are being injected to the gzip command line just like they are with the GZIP environment variable. - A few special scripts might know about the GZIP environment variable and be able to unset it. They are less likely to know that they should alter PATH to avoid extra gzip options. I don't see security benefits in removing GZIP, but I wonder if I'm missing something. As far as I understand, if an attacker can modify arbitrary env vars, the situation is already bad. Some apps store untrusted content in env vars but in those cases the names of the env vars aren't under attacker's control. (In contrast, attacker controlled filenames can become an attack vector if one extracts an untrusted archive for examination, thus fixing CVE-2022-1271 in zgrep and xzgrep mattered.) zgrep, zdiff, and zcmp read the env vars GREP, DIFF, and CMP. These allow injecting arbitrary commands (not just command line options). zgrep's man page documents GREP. It's not marked as deprecated. It's not very common to run zgrep or zdiff from other scripts, so *if* these environment variables can cause problems, they won't occur as often as they could with GZIP. To be clear, I think it's fine that these scripts read those environment variables. Several compression tools read command line options from environment variables. At least in xz the feature was inspired by gzip. - pigz: GZIP, PIGZ - bzip2: BZIP2, BZIP - lzop: LZOP - xz: XZ_DEFAULTS, XZ_OPT - zip: ZIPOPT zstd and lz4 read environment variables but don't parse them as command line options. While I have found GZIP convenient now and then, removing the feature won't matter much to me personally. However, the removal makes gzip one of the few compression tools that don't support setting even the compression level via an environment variable. [1] https://lists.gnu.org/archive/html/bug-grep/2014-05/msg00107.html [2] https://lists.gnu.org/archive/html/bug-gzip/2015-03/msg00001.html [3] https://lists.gnu.org/archive/html/bug-gzip/2017-02/msg00019.html -- Lasse Collin From unknown Tue Aug 12 08:33:25 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Paul Eggert Subject: bug#76197: closed (Re: bug#76197: [PROPOSED] gzip: drop support for the GZIP env var) Message-ID: References: <7f86b281-aa59-4574-8bab-3f871ce2453a@cs.ucla.edu> <20250211072241.854108-1-eggert@cs.ucla.edu> X-Gnu-PR-Message: they-closed 76197 X-Gnu-PR-Package: gzip X-Gnu-PR-Keywords: patch Reply-To: 76197@debbugs.gnu.org Date: Thu, 20 Feb 2025 06:51:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1740034262-1855-1" This is a multi-part message in MIME format... ------------=_1740034262-1855-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #76197: [PROPOSED] gzip: drop support for the GZIP env var which was filed against the gzip package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 76197@debbugs.gnu.org. --=20 76197: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D76197 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1740034262-1855-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 76197-done) by debbugs.gnu.org; 20 Feb 2025 06:50:27 +0000 Received: from localhost ([127.0.0.1]:58636 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tl0O9-0000Qe-Ly for submit@debbugs.gnu.org; Thu, 20 Feb 2025 01:50:27 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]:55762) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tl0O6-0000PX-HX for 76197-done@debbugs.gnu.org; Thu, 20 Feb 2025 01:50:23 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id E3CD03C0140A0; Wed, 19 Feb 2025 22:50:15 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id 9Kn6GEWDizsv; Wed, 19 Feb 2025 22:50:15 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 222DB3C01EBA3; Wed, 19 Feb 2025 22:50:15 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 222DB3C01EBA3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1740034215; bh=X4kT8Wq8D0KtSWIBQcZpbLWXu/VpgX4JmqXRCponm+o=; h=Message-ID:Date:MIME-Version:To:From; b=a9TXC1ekyHxK+1XwBaLa84BwY28vDVAOs4LpQndZEDAxvTArmE+sc1LExupJO76Bc g6rU8CFDUkCeJO/Fs5uiV7pt5IyV1Br0hbhuMXhMbX4aPGUkWLePWbGcZd2Wi0BDib o86oRMDdS31BthwNC76ykFT7HcChfMNg77eoLOEN/rP+cYT2oZm2Xu26MAaseWflHa XYUbvmSXmeHC/AKMdqLHi24n8bnXiuuDmqBQZmSTVraM/qAT7p0EWkixgH1t5qpEJo nO8uGWNFWbwpAUP48X99ZJ6jcxwBih7JR6mpWx06pBVD5z/TZeKEbaL5gnvxpWD3az 0hbqFlMDxLFYA== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id DAvzkJTYTJQa; Wed, 19 Feb 2025 22:50:15 -0800 (PST) Received: from [192.168.254.12] (unknown [47.147.225.25]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id F41E83C01EBA2; Wed, 19 Feb 2025 22:50:14 -0800 (PST) Content-Type: multipart/mixed; boundary="------------DkmJXzqjgsm0302L0GZ0Ucd7" Message-ID: <7f86b281-aa59-4574-8bab-3f871ce2453a@cs.ucla.edu> Date: Wed, 19 Feb 2025 22:50:14 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#76197: [PROPOSED] gzip: drop support for the GZIP env var To: Lasse Collin References: <20250211072241.854108-1-eggert@cs.ucla.edu> <20250212155805.4ca20b9d.lasse.collin@tukaani.org> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <20250212155805.4ca20b9d.lasse.collin@tukaani.org> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76197-done Cc: 76197-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------DkmJXzqjgsm0302L0GZ0Ucd7 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2025-02-12 05:58, Lasse Collin wrote: > the removal makes gzip one > of the few compression tools that don't support setting even the > compression level via an environment variable. Thanks for the review. On further thought I agree that, for backward compatibility reasons at least, the gzip command should continue to examine the GZIP environment variable for options like -9 that affect only performance (including compression performance). These options shouldn't cause the bigger glitches (and perhaps even security hazards) that behavior-oriented options can cause. This would be more in line with zstd, which takes this relatively-cautious approach to environment variables. You mentioned --synchronous as being innocuous even though gzip currently doesn't allow it in GZIP, and that also is a good suggestion. So I installed the attached patch instead into Savannah master gzip. It means gzip will pay attention to -1..-9, --rsyncable, and --synchronous but will silently ignore everything else in GZIP. The idea is that a garbage GZIP value shouldn't disrupt normal operations. --------------DkmJXzqjgsm0302L0GZ0Ucd7 Content-Type: text/x-patch; charset=UTF-8; name="0001-Ignore-GZIP-envvar-except-for-innocuous-flags.patch" Content-Disposition: attachment; filename="0001-Ignore-GZIP-envvar-except-for-innocuous-flags.patch" Content-Transfer-Encoding: base64 RnJvbSAwMmNkZTQzMjg2ZGEzYjQ3MTgyZGFhYzYxMzUyZmEyNmVkMzVlMmVhIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBXZWQsIDE5IEZlYiAyMDI1IDIyOjMzOjM0IC0wODAwClN1YmplY3Q6IFtQQVRD SF0gSWdub3JlIEdaSVAgZW52dmFyIGV4Y2VwdCBmb3IgaW5ub2N1b3VzIGZsYWdzCgpUaGlz IGlzIHNsaW1tZWQgZG93biBmcm9tIHRoZSBvcmlnaW5hbGx5IHByb3Bvc2VkIHBhdGNoLCB3 aGljaAppZ25vcmVkIEdaSVAgZW50aXJlbHkuICBUaGFua3MgdG8gTGFzc2UgQ29sbGluIGZv ciB0aG91Z2h0ZnVsIGNvbW1lbnRzLgoqIGd6aXAuYyAoRU5WX09QVElPTik6IFJlbW92ZS4g IEFsbCB1c2VzIHJlbW92ZWQuCihtYWluKTogUGFyc2UgR1pJUCBjb250ZW50cyB3aXRoIGVy cm9yIGRpYWdub3N0aWNzIGRpc2FibGVkLAphbmQgc2ltcGx5IGlnbm9yZSBpbnZhbGlkIGNv bnRlbnRzLiAgSWdub3JlIGFsbCBvcHRpb25zCmV4Y2VwdCAtMSB0aHJ1IC05LCAtLXJzeW5j YWJsZSwgLS1zeW5jaHJvbm91cy4gIFJlbW92ZQp1b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oJmVu dl9hcmdjLCAmYXJndl9jb3B5LCBPUFRJT05TX1ZBUik7CiAgICAgZW52X2FyZ3YgPSBlbnYg PyBhcmd2X2NvcHkgOiBOVUxMOworICAgIG9wdGVyciA9ICFlbnY7CiAKICNpZm5kZWYgR05V X1NUQU5EQVJECiAjIGRlZmluZSBHTlVfU1RBTkRBUkQgMQpAQCAtNDU1LDQ4ICs0NTIsMzUg QEAgaW50IG1haW4gKGludCBhcmdjLCBjaGFyICoqYXJndikKIAogICAgIHdoaWxlICh0cnVl KSB7CiAgICAgICAgIGludCBvcHRjOwotICAgICAgICBpbnQgbG9uZ2luZCA9IC0xOwogCiAg ICAgICAgIGlmIChlbnZfYXJndikKICAgICAgICAgICB7Ci0gICAgICAgICAgICBpZiAoZW52 X2FyZ3Zbb3B0aW5kXSAmJiBzdHJlcXUgKGVudl9hcmd2W29wdGluZF0sICItLSIpKQotICAg ICAgICAgICAgICBvcHRjID0gRU5WX09QVElPTiArICctJzsKLSAgICAgICAgICAgIGVsc2UK KyAgICAgICAgICAgIC8qIEdldCB0aGUgbmV4dCBvcHRpb24gdGFrZW4gZnJvbSB0aGUgR1pJ UCBlbnZpcm9ubWVudCB2YXJpYWJsZQorICAgICAgICAgICAgICAgdGhhdCBhZmZlY3RzIG9u bHkgcGVyZm9ybWFuY2UgKGluY2x1ZGluZyBjb21wcmVzc2lvbiBsZXZlbCkuCisgICAgICAg ICAgICAgICBTaWxlbnRseSBpZ25vcmUgb3RoZXIgb3B0aW9ucywgbm9uLW9wdGlvbnMsIGlu dmFsaWQgb3B0aW9ucywKKyAgICAgICAgICAgICAgIGFuZCBvcHRpb24gc3ludGF4IGVycm9y cywgc28gdGhhdCBiYWQgR1pJUCB2YWx1ZXMgZG8KKyAgICAgICAgICAgICAgIG5vdCB1bmR1 bHkgaW50ZXJmZXJlIHdpdGggbm9ybWFsIGd6aXAgb3BlcmF0aW9uLiAgKi8KKyAgICAgICAg ICAgIGRvCiAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICBvcHRjID0gZ2V0b3B0 X2xvbmcgKGVudl9hcmdjLCBlbnZfYXJndiwgc2hvcnRvcHRzLCBsb25nb3B0cywKLSAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICZsb25naW5kKTsKLSAgICAgICAgICAg ICAgICBpZiAoMCA8PSBvcHRjKQotICAgICAgICAgICAgICAgICAgb3B0YyArPSBFTlZfT1BU SU9OOwotICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIE5VTEwpOworICAgICAgICAgICAgICAgIGlmIChvcHRjIDwgMCkKICAgICAg ICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG9wdGluZCAhPSBlbnZf YXJnYykKLSAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAg ICBmcHJpbnRmIChzdGRlcnIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAo IiVzOiAlczogbm9uLW9wdGlvbiBpbiAiT1BUSU9OU19WQVIKLSAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAiIGVudmlyb25tZW50IHZhcmlhYmxlXG4iKSwKLSAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIHByb2dyYW1fbmFtZSwgZW52X2FyZ3Zbb3B0aW5k XSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0cnlfaGVscCAoKTsKLSAgICAgICAgICAg ICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgLyogV2FpdCB1bnRpbCBoZXJl IGJlZm9yZSB3YXJuaW5nLCBzbyB0aGF0IEdaSVA9Jy1xJwotICAgICAgICAgICAgICAgICAg ICAgICBkb2Vzbid0IHdhcm4uICAqLwotICAgICAgICAgICAgICAgICAgICBpZiAoZW52X2Fy Z2MgIT0gMSAmJiAhcXVpZXQpCi0gICAgICAgICAgICAgICAgICAgICAgZnByaW50ZiAoc3Rk ZXJyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgiJXM6IHdhcm5pbmc6ICJP UFRJT05TX1ZBUiIgZW52aXJvbm1lbnQgdmFyaWFibGUiCi0gICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICIgaXMgZGVwcmVjYXRlZDsgdXNlIGFuIGFsaWFzIG9yIHNjcmlwdFxu IiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvZ3JhbV9uYW1lKTsKLQog ICAgICAgICAgICAgICAgICAgICAvKiBTdGFydCBwcm9jZXNzaW5nIEFSR0MgYW5kIEFSR1Yg aW5zdGVhZC4gICovCiAgICAgICAgICAgICAgICAgICAgIGZyZWUgKGVudl9hcmd2KTsKICAg ICAgICAgICAgICAgICAgICAgZW52X2FyZ3YgPSBOVUxMOworICAgICAgICAgICAgICAgICAg ICBvcHRlcnIgPSAxOwogICAgICAgICAgICAgICAgICAgICBvcHRpbmQgPSAxOwotICAgICAg ICAgICAgICAgICAgICBsb25naW5kID0gLTE7CisgICAgICAgICAgICAgICAgICAgIGJyZWFr OwogICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICB9CisgICAgICAgICAgICB3 aGlsZSAoISAoKCcxJyA8PSBvcHRjICYmIG9wdGMgPD0gJzknKQorICAgICAgICAgICAgICAg ICAgICAgIHx8IG9wdGMgPT0gUlNZTkNBQkxFX09QVElPTgorICAgICAgICAgICAgICAgICAg ICAgIHx8IG9wdGMgPT0gU1lOQ0hST05PVVNfT1BUSU9OKSk7CiAgICAgICAgICAgfQogCiAg ICAgICAgIGlmICghZW52X2FyZ3YpCi0gICAgICAgICAgb3B0YyA9IGdldG9wdF9sb25nIChh cmdjLCBhcmd2LCBzaG9ydG9wdHMsIGxvbmdvcHRzLCAmbG9uZ2luZCk7CisgICAgICAgICAg b3B0YyA9IGdldG9wdF9sb25nIChhcmdjLCBhcmd2LCBzaG9ydG9wdHMsIGxvbmdvcHRzLCBO VUxMKTsKICAgICAgICAgaWYgKG9wdGMgPCAwKQogICAgICAgICAgIGJyZWFrOwogCkBAIC01 MzIsMTUgKzUxNiwxMiBAQCBpbnQgbWFpbiAoaW50IGFyZ2MsIGNoYXIgKiphcmd2KQogICAg ICAgICBjYXNlICdNJzogLyogdW5kb2N1bWVudGVkLCBtYXkgY2hhbmdlIGxhdGVyICovCiAg ICAgICAgICAgICBub190aW1lID0gMDsgYnJlYWs7CiAgICAgICAgIGNhc2UgJ24nOgotICAg ICAgICBjYXNlICduJyArIEVOVl9PUFRJT046CiAgICAgICAgICAgICBub19uYW1lID0gbm9f dGltZSA9IDE7IGJyZWFrOwogICAgICAgICBjYXNlICdOJzoKLSAgICAgICAgY2FzZSAnTicg KyBFTlZfT1BUSU9OOgogICAgICAgICAgICAgbm9fbmFtZSA9IG5vX3RpbWUgPSAwOyBicmVh azsKICAgICAgICAgY2FzZSBQUkVTVU1FX0lOUFVUX1RUWV9PUFRJT046CiAgICAgICAgICAg ICBwcmVzdW1lX2lucHV0X3R0eSA9IHRydWU7IGJyZWFrOwogICAgICAgICBjYXNlICdxJzoK LSAgICAgICAgY2FzZSAncScgKyBFTlZfT1BUSU9OOgogICAgICAgICAgICAgcXVpZXQgPSAx OyB2ZXJib3NlID0gMDsgYnJlYWs7CiAgICAgICAgIGNhc2UgJ3InOgogI2lmIE5PX0RJUgpA QCAtNTUzLDcgKzUzNCw2IEBAIGludCBtYWluIChpbnQgYXJnYywgY2hhciAqKmFyZ3YpCiAg ICAgICAgICAgICBicmVhazsKIAogICAgICAgICBjYXNlIFJTWU5DQUJMRV9PUFRJT046Ci0g ICAgICAgIGNhc2UgUlNZTkNBQkxFX09QVElPTiArIEVOVl9PUFRJT046CiAgICAgICAgICAg ICByc3luYyA9IDE7CiAgICAgICAgICAgICBicmVhazsKICAgICAgICAgY2FzZSAnUyc6CkBA IC01NzUsNyArNTU1LDYgQEAgaW50IG1haW4gKGludCBhcmdjLCBjaGFyICoqYXJndikKICAg ICAgICAgICAgIHRlc3QgPSBkZWNvbXByZXNzID0gdG9fc3Rkb3V0ID0gMTsKICAgICAgICAg ICAgIGJyZWFrOwogICAgICAgICBjYXNlICd2JzoKLSAgICAgICAgY2FzZSAndicgKyBFTlZf T1BUSU9OOgogICAgICAgICAgICAgdmVyYm9zZSsrOyBxdWlldCA9IDA7IGJyZWFrOwogICAg ICAgICBjYXNlICdWJzoKICAgICAgICAgICAgIHZlcnNpb24gKCk7IGZpbmlzaF9vdXQgKCk7 IGJyZWFrOwpAQCAtNTg0LDI4ICs1NjMsMTIgQEAgaW50IG1haW4gKGludCBhcmdjLCBjaGFy ICoqYXJndikKICAgICAgICAgICAgICAgICAgICAgcHJvZ3JhbV9uYW1lKTsKICAgICAgICAg ICAgIHRyeV9oZWxwICgpOwogICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgJzEn ICsgRU5WX09QVElPTjogIGNhc2UgJzInICsgRU5WX09QVElPTjogIGNhc2UgJzMnICsgRU5W X09QVElPTjoKLSAgICAgICAgY2FzZSAnNCcgKyBFTlZfT1BUSU9OOiAgY2FzZSAnNScgKyBF TlZfT1BUSU9OOiAgY2FzZSAnNicgKyBFTlZfT1BUSU9OOgotICAgICAgICBjYXNlICc3JyAr IEVOVl9PUFRJT046ICBjYXNlICc4JyArIEVOVl9PUFRJT046ICBjYXNlICc5JyArIEVOVl9P UFRJT046Ci0gICAgICAgICAgICBvcHRjIC09IEVOVl9PUFRJT047Ci0gICAgICAgICAgICBG QUxMVEhST1VHSDsKICAgICAgICAgY2FzZSAnMSc6ICBjYXNlICcyJzogIGNhc2UgJzMnOiAg Y2FzZSAnNCc6CiAgICAgICAgIGNhc2UgJzUnOiAgY2FzZSAnNic6ICBjYXNlICc3JzogIGNh c2UgJzgnOiAgY2FzZSAnOSc6CiAgICAgICAgICAgICBsZXZlbCA9IG9wdGMgLSAnMCc7CiAg ICAgICAgICAgICBicmVhazsKIAogICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgaWYg KEVOVl9PUFRJT04gPD0gb3B0YyAmJiBvcHRjICE9IEVOVl9PUFRJT04gKyAnPycpCi0gICAg ICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAvKiBPdXRwdXQgYSBkaWFnbm9zdGljLCBz aW5jZSBnZXRvcHRfbG9uZyBkaWRuJ3QuICAqLwotICAgICAgICAgICAgICAgIGZwcmludGYg KHN0ZGVyciwgIiVzOiAiLCBwcm9ncmFtX25hbWUpOwotICAgICAgICAgICAgICAgIGlmIChs b25naW5kIDwgMCkKLSAgICAgICAgICAgICAgICAgIGZwcmludGYgKHN0ZGVyciwgIi0lYzog Iiwgb3B0YyAtIEVOVl9PUFRJT04pOwotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAg ICAgICAgICAgIGZwcmludGYgKHN0ZGVyciwgIi0tJXM6ICIsIGxvbmdvcHRzW2xvbmdpbmRd Lm5hbWUpOwotICAgICAgICAgICAgICAgIGZwcmludGYgKHN0ZGVyciwgKCJvcHRpb24gbm90 IHZhbGlkIGluICJPUFRJT05TX1ZBUgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICIgZW52aXJvbm1lbnQgdmFyaWFibGVcbiIpKTsKLSAgICAgICAgICAgICAgfQogICAg ICAgICAgICAgdHJ5X2hlbHAgKCk7CiAgICAgICAgIH0KICAgICB9IC8qIGxvb3Agb24gYWxs IGFyZ3VtZW50cyAqLwpkaWZmIC0tZ2l0IGEvdGVzdHMvZ3ppcC1lbnYgYi90ZXN0cy9nemlw LWVudgppbmRleCBiNzM4MmQ5Li40NDEyM2M5IDEwMDc1NQotLS0gYS90ZXN0cy9nemlwLWVu dgorKysgYi90ZXN0cy9nemlwLWVudgpAQCAtMSw1ICsxLDUgQEAKICMhL2Jpbi9zaAotIyBU ZXN0IHRoZSBvYnNvbGVzY2VudCBHWklQIGVudmlyb25tZW50IHZhcmlhYmxlLgorIyBUZXN0 IHRoZSBHWklQIGVudmlyb25tZW50IHZhcmlhYmxlLgogCiAjIENvcHlyaW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dvb2RvcHQgaW4gXAorICAtMSAt LWZhc3QgLTIgLTMgLTQgLTUgLTYgLTcgLTggLTkgLS1iZXN0IC0tcnN5bmNhYmxlIC0tc3lu Y2hyb25vdXMKIGRvCiAgIEdaSVA9JGdvb2RvcHQgZ3ppcCAtZCA8aW4gPm91dCAyPmVyciB8 fCBmYWlsPTEKICAgY29tcGFyZSBleHAgb3V0IHx8IGZhaWw9MQpkaWZmIC0tZ2l0IGEvem5l dy5pbiBiL3puZXcuaW4KaW5kZXggYjA5ZDk2Ny4uYWQxMzYzMSAxMDA2NDQKLS0tIGEvem5l dy5pbgorKysgYi96bmV3LmluCkBAIC01NSw3ICs1NSw4IEBAIG5ldz0wCiBibG9jaz0xMDI0 CiAjIGJsb2NrIGlzIHRoZSBkaXNrIGJsb2NrIHNpemUgKGJlc3QgZ3Vlc3MsIG5lZWQgbm90 IGJlIGV4YWN0KQogCi0jIEJld2FyZSAtcyBvciAtLXN1ZmZpeCBpbiAkR1pJUC4KKyMgQmV3 YXJlIC1zIG9yIC0tc3VmZml4IGluICRHWklQLCB3aGljaCBjb3VsZCBjYXVzZSBtaXNiZWhh dmlvcgorIyBpbiBnemlwIDEuMTMgYW5kIGVhcmxpZXIuCiB1bnNldCBHWklQCiBleHQ9Lmd6 CiAKLS0gCjIuNDUuMgoK --------------DkmJXzqjgsm0302L0GZ0Ucd7-- ------------=_1740034262-1855-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 Feb 2025 07:23:08 +0000 Received: from localhost ([127.0.0.1]:53976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1thkbr-0002TW-Ik for submit@debbugs.gnu.org; Tue, 11 Feb 2025 02:23:08 -0500 Received: from lists.gnu.org ([2001:470:142::17]:37314) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1thkbo-0002SH-J1 for submit@debbugs.gnu.org; Tue, 11 Feb 2025 02:23:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1thkbh-0007RJ-3W for bug-gzip@gnu.org; Tue, 11 Feb 2025 02:22:57 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1thkbd-0002pS-FZ for bug-gzip@gnu.org; Tue, 11 Feb 2025 02:22:56 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 647413C00517E for ; Mon, 10 Feb 2025 23:22:49 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id hbgfteMJfqCZ; Mon, 10 Feb 2025 23:22:48 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id B27333C00517D; Mon, 10 Feb 2025 23:22:48 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu B27333C00517D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1739258568; bh=Xb7fKK3mdBHsJvOYAlfhyAgOZsgeOmR5SgmF/EP+xaA=; h=From:To:Date:Message-ID:MIME-Version; b=gqGYVQx9ZFeI4MYWr2u9GUkJOfrRsNCO9buMsGw9xWp2ms6b7T/+Wfjb/Lvnsa752 A5/LTPkv28Vw3zLfFseyAYCXyCJlGUqf6a9CnWlCPB15i1qYg/+NCw/1nYha3BaTl+ hY8tg/x3p9PVY/hmdjZJuUrWK2aHfvYtlDK4bhqi7DyABFfj2zHjTqJIl8scFktpWv IPJy5VG78MSsGKG0kK6+K/F1HC7u6JDC8XL9AnbLfSEoNCYiHQ5HOrcddtkOGFIa5C 5YesfG/KgeKfw2Gq8x1GwcyWPG9xrCLiK3y5104GuYUl4wLOZ4vz3JczXz6cooQqvE Llw6oCg6MZFAQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id iaY1_XdCWumc; Mon, 10 Feb 2025 23:22:48 -0800 (PST) Received: from wing.home (unknown [47.154.28.214]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 9A7C83C011BE0; Mon, 10 Feb 2025 23:22:48 -0800 (PST) From: Paul Eggert To: bug-gzip@gnu.org Subject: [PROPOSED] gzip: drop support for the GZIP env var Date: Mon, 10 Feb 2025 23:22:34 -0800 Message-ID: <20250211072241.854108-1-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=131.179.128.66; envelope-from=eggert@cs.ucla.edu; helo=mail.cs.ucla.edu X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit Cc: Paul Eggert X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) The GZIP environment variable is too hazardous. * gzip.c (env, ENV_OPTION): * tailor.h (OPTIONS_VAR): * util.c (SEPARATOR, add_envopt): Remove. All uses removed. * gzip.c (main): Ignore GZIP. * tests/gzip-env: Test that GZIP is ignored. --- NEWS | 6 ++++ doc/gzip.texi | 11 ++----- gzip.1 | 18 ++++-------- gzip.c | 79 +------------------------------------------------- gzip.h | 1 - tailor.h | 4 --- tests/gzip-env | 19 +++++------- util.c | 60 -------------------------------------- znew.in | 2 +- 9 files changed, 24 insertions(+), 176 deletions(-) diff --git a/NEWS b/NEWS index e348355..0c4a2fc 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,12 @@ GNU gzip NEWS -*- out= line -*- =20 * Noteworthy changes in release ?.? (????-??-??) [?] =20 +** Changes in behavior + + The GZIP environment variable, which was marked as obsolescent in + gzip 1.7 (2016) due to its hazards, has been removed. You can use + an alias or script instead. + ** Bug fixes =20 'gzip -d' no longer omits the last partial output buffer when the diff --git a/doc/gzip.texi b/doc/gzip.texi index cc05b60..1bfca98 100644 --- a/doc/gzip.texi +++ b/doc/gzip.texi @@ -487,14 +487,9 @@ complement to @command{tar}, not as a replacement. @chapter Environment @cindex Environment =20 -The obsolescent environment variable @env{GZIP} can hold a set of -default options for @command{gzip}. These options are interpreted -first and can be overwritten by explicit command line parameters. As -this can cause problems when using scripts, this feature is supported -only for options that are reasonably likely to not cause too much -harm, and @command{gzip} warns if it is used. This feature will be -removed in a future release of @command{gzip}. - +Although previous verions of @command{gzip} examined the environment +variable @env{GZIP} for a set of default options, +this feature has been removed because it caused problems when using scri= pts. You can use an alias or script instead. For example, if @command{gzip} is in the directory @samp{/usr/bin} you can prepend @file{$HOME/bin} to your @env{PATH} and create an executable script diff --git a/gzip.1 b/gzip.1 index 0efe399..4afa243 100644 --- a/gzip.1 +++ b/gzip.1 @@ -416,20 +416,12 @@ such as tar or zip. GNU tar supports the \-z option to invoke gzip transparently. gzip is designed as a complement to tar, not as a replacement. .SH "ENVIRONMENT" -The obsolescent environment variable -.B GZIP -can hold a set of default options for -.BR gzip . -These options are interpreted first and can be overwritten by explicit -command line parameters. -As this can cause problems when using scripts, -this feature is supported only for options that are -reasonably likely to not cause too much harm, and +Although previous versions of .B gzip -warns if it is used. -This feature will be removed in a future release of -.BR gzip . -.PP +examined the environment variable +.B GZIP +for a set of default options, this feature has been removed +because it caused problems when using scripts. You can use an alias or script instead. For example, if .B gzip diff --git a/gzip.c b/gzip.c index a33841a..1fe589b 100644 --- a/gzip.c +++ b/gzip.c @@ -182,7 +182,6 @@ static int foreground =3D 0; /* set if program run = in foreground */ static int last_member; /* set for .zip and .Z files */ static int part_nb; /* number of parts in .gz file */ off_t ifile_size; /* input file size, -1 for devices (debug = only) */ -static char *env; /* contents of GZIP env variable */ static char const *z_suffix; /* default suffix (can be set with --suffix= ) */ static size_t z_len; /* strlen(z_suffix) */ =20 @@ -249,10 +248,6 @@ enum PRESUME_INPUT_TTY_OPTION =3D CHAR_MAX + 1, RSYNCABLE_OPTION, SYNCHRONOUS_OPTION, - - /* A value greater than all valid long options, used as a flag to - distinguish options derived from the GZIP environment variable. */ - ENV_OPTION }; =20 static char const shortopts[] =3D "ab:cdfhH?klLmMnNqrS:tvVZ123456789"; @@ -413,9 +408,6 @@ int main (int argc, char **argv) { int file_count; /* number of files to process */ size_t proglen; /* length of program_name */ - char **argv_copy; - int env_argc; - char **env_argv; =20 EXPAND(argc, argv); /* wild card expansion if necessary */ =20 @@ -426,11 +418,6 @@ int main (int argc, char **argv) if (4 < proglen && strequ (program_name + proglen - 4, ".exe")) program_name[proglen - 4] =3D '\0'; =20 - /* Add options in GZIP environment variable if there is one */ - argv_copy =3D argv; - env =3D add_envopt (&env_argc, &argv_copy, OPTIONS_VAR); - env_argv =3D env ? argv_copy : NULL; - #ifndef GNU_STANDARD # define GNU_STANDARD 1 #endif @@ -454,49 +441,8 @@ int main (int argc, char **argv) z_len =3D strlen(z_suffix); =20 while (true) { - int optc; int longind =3D -1; - - if (env_argv) - { - if (env_argv[optind] && strequ (env_argv[optind], "--")) - optc =3D ENV_OPTION + '-'; - else - { - optc =3D getopt_long (env_argc, env_argv, shortopts, lon= gopts, - &longind); - if (0 <=3D optc) - optc +=3D ENV_OPTION; - else - { - if (optind !=3D env_argc) - { - fprintf (stderr, - ("%s: %s: non-option in "OPTIONS_VAR - " environment variable\n"), - program_name, env_argv[optind]); - try_help (); - } - - /* Wait until here before warning, so that GZIP=3D'-= q' - doesn't warn. */ - if (env_argc !=3D 1 && !quiet) - fprintf (stderr, - ("%s: warning: "OPTIONS_VAR" environment = variable" - " is deprecated; use an alias or script\= n"), - program_name); - - /* Start processing ARGC and ARGV instead. */ - free (env_argv); - env_argv =3D NULL; - optind =3D 1; - longind =3D -1; - } - } - } - - if (!env_argv) - optc =3D getopt_long (argc, argv, shortopts, longopts, &longin= d); + int optc =3D getopt_long (argc, argv, shortopts, longopts, &long= ind); if (optc < 0) break; =20 @@ -532,15 +478,12 @@ int main (int argc, char **argv) case 'M': /* undocumented, may change later */ no_time =3D 0; break; case 'n': - case 'n' + ENV_OPTION: no_name =3D no_time =3D 1; break; case 'N': - case 'N' + ENV_OPTION: no_name =3D no_time =3D 0; break; case PRESUME_INPUT_TTY_OPTION: presume_input_tty =3D true; break; case 'q': - case 'q' + ENV_OPTION: quiet =3D 1; verbose =3D 0; break; case 'r': #if NO_DIR @@ -553,7 +496,6 @@ int main (int argc, char **argv) break; =20 case RSYNCABLE_OPTION: - case RSYNCABLE_OPTION + ENV_OPTION: rsync =3D 1; break; case 'S': @@ -575,7 +517,6 @@ int main (int argc, char **argv) test =3D decompress =3D to_stdout =3D 1; break; case 'v': - case 'v' + ENV_OPTION: verbose++; quiet =3D 0; break; case 'V': version (); finish_out (); break; @@ -584,28 +525,12 @@ int main (int argc, char **argv) program_name); try_help (); break; - case '1' + ENV_OPTION: case '2' + ENV_OPTION: case '3' + ENV_O= PTION: - case '4' + ENV_OPTION: case '5' + ENV_OPTION: case '6' + ENV_O= PTION: - case '7' + ENV_OPTION: case '8' + ENV_OPTION: case '9' + ENV_O= PTION: - optc -=3D ENV_OPTION; - FALLTHROUGH; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': level =3D optc - '0'; break; =20 default: - if (ENV_OPTION <=3D optc && optc !=3D ENV_OPTION + '?') - { - /* Output a diagnostic, since getopt_long didn't. */ - fprintf (stderr, "%s: ", program_name); - if (longind < 0) - fprintf (stderr, "-%c: ", optc - ENV_OPTION); - else - fprintf (stderr, "--%s: ", longopts[longind].name); - fprintf (stderr, ("option not valid in "OPTIONS_VAR - " environment variable\n")); - } try_help (); } } /* loop on all arguments */ @@ -2042,8 +1967,6 @@ do_exit (int exitcode) =20 if (in_exit) exit(exitcode); in_exit =3D 1; - free(env); - env =3D NULL; FREE(inbuf); FREE(outbuf); FREE(d_buf); diff --git a/gzip.h b/gzip.h index 855a88b..66b504b 100644 --- a/gzip.h +++ b/gzip.h @@ -314,7 +314,6 @@ extern char *strlwr (char *s); extern char *gzip_base_name (char *fname) _GL_ATTRIBUTE_PURE; extern int xunlink (char *fname); extern void make_simple_name (char *name); -extern char *add_envopt (int *argcp, char ***argvp, char const *env); _Noreturn extern void gzip_error (char const *m); _Noreturn extern void xalloc_die (void); extern void warning (char const *m); diff --git a/tailor.h b/tailor.h index c9147b1..095d7ce 100644 --- a/tailor.h +++ b/tailor.h @@ -163,10 +163,6 @@ # define casemap(c) (c) #endif =20 -#ifndef OPTIONS_VAR -# define OPTIONS_VAR "GZIP" -#endif - #ifndef Z_SUFFIX # define Z_SUFFIX ".gz" #endif diff --git a/tests/gzip-env b/tests/gzip-env index b7382d9..2da5915 100755 --- a/tests/gzip-env +++ b/tests/gzip-env @@ -1,5 +1,5 @@ #!/bin/sh -# Test the obsolescent GZIP environment variable. +# Test that gzip is unaffected by the GZIP environment variable. =20 # Copyright 2015-2025 Free Software Foundation, Inc. =20 @@ -23,20 +23,17 @@ echo a >exp || framework_failure_ gzip in || framework_failure_ =20 fail=3D0 -GZIP=3D-qv gzip -d out 2>err || fail=3D1 -compare exp out || fail=3D1 =20 -for badopt in -- -c --stdout -d --decompress -f --force -h --help -k --k= eep \ +for opt in -qv \ + -- -c --stdout -d --decompress -f --force -h --help -k --keep \ -l --list -L --license -r --recursive -Sxxx --suffix=3Dxxx '--suffix x= xx' \ - -t --test -V --version -do - GZIP=3D$badopt gzip -d out 2>err && fail=3D1 -done - -for goodopt in -n --no-name -N --name -q --quiet -v --verbose \ + -t --test -V --version \ + -n --no-name -N --name -q --quiet -v --verbose \ -1 --fast -2 -3 -4 -5 -6 -7 -8 -9 --best do - GZIP=3D$goodopt gzip -d out 2>err || fail=3D1 + GZIP=3D$opt gzip inopt 2>err || fail=3D1 + compare in inopt || fail=3D1 + GZIP=3D$opt gzip -d out 2>err || fail=3D1 compare exp out || fail=3D1 done =20 diff --git a/util.c b/util.c index e3eb739..c799ac1 100644 --- a/util.c +++ b/util.c @@ -291,66 +291,6 @@ make_simple_name (char *name) } #endif =20 -/* Convert the value of the environment variable ENVVAR_NAME - to a newly allocated argument vector, and set *ARGCP and *ARGVP - to the number of arguments and to the vector, respectively. - Make the new vector's zeroth element equal to the old **ARGVP. - Return a pointer to the newly allocated string storage. - - If the vector would be empty, do not allocate storage, - do not set *ARGCP and *ARGVP, and return NULL. */ - -#define SEPARATOR " \t" /* separators in env variable */ - -char *add_envopt( - int *argcp, /* pointer to argc */ - char ***argvp, /* pointer to argv */ - char const *envvar_name) /* name of environment variable */ -{ - char *p; /* running pointer through env variable */ - char **oargv; /* runs through old argv array */ - char **nargv; /* runs through new argv array */ - int nargc =3D 0; /* number of arguments in env variable */ - char *env_val; - - env_val =3D getenv(envvar_name); - if (env_val =3D=3D NULL) return NULL; - - env_val =3D xstrdup (env_val); - - for (p =3D env_val; *p; nargc++ ) { /* move through env_val *= / - p +=3D strspn(p, SEPARATOR); /* skip leading separators */ - if (*p =3D=3D '\0') break; - - p +=3D strcspn(p, SEPARATOR); /* find end of word */ - if (*p) *p++ =3D '\0'; /* mark it */ - } - if (nargc =3D=3D 0) { - free(env_val); - return NULL; - } - *argcp =3D nargc + 1; - /* Allocate the new argv array, with an extra element just in case - * the original arg list did not end with a NULL. - */ - nargv =3D xcalloc (*argcp + 1, sizeof (char *)); - oargv =3D *argvp; - *argvp =3D nargv; - - /* Copy the program name first */ - *nargv++ =3D *oargv; - - /* Then copy the environment args */ - for (p =3D env_val; nargc > 0; nargc--) { - p +=3D strspn(p, SEPARATOR); /* skip separators */ - *(nargv++) =3D p; /* store start */ - while (*p++) ; /* skip over word */ - } - - *nargv =3D NULL; - return env_val; -} - /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D * Error handlers. */ diff --git a/znew.in b/znew.in index b09d967..e9d87f3 100644 --- a/znew.in +++ b/znew.in @@ -55,7 +55,7 @@ new=3D0 block=3D1024 # block is the disk block size (best guess, need not be exact) =20 -# Beware -s or --suffix in $GZIP. +# Beware -s or --suffix in $GZIP, used by gzip 1.13 and earlier. unset GZIP ext=3D.gz =20 --=20 2.45.2 ------------=_1740034262-1855-1-- From unknown Tue Aug 12 08:33:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#76197: [PROPOSED] gzip: drop support for the GZIP env var Resent-From: Lasse Collin Original-Sender: "Debbugs-submit" Resent-CC: bug-gzip@gnu.org Resent-Date: Sun, 23 Feb 2025 11:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76197 X-GNU-PR-Package: gzip X-GNU-PR-Keywords: patch To: Paul Eggert Cc: 76197-done@debbugs.gnu.org Received: via spool by 76197-done@debbugs.gnu.org id=D76197.17403116536735 (code D ref 76197); Sun, 23 Feb 2025 11:55:02 +0000 Received: (at 76197-done) by debbugs.gnu.org; 23 Feb 2025 11:54:13 +0000 Received: from localhost ([127.0.0.1]:59642 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tmAYm-0001kZ-L7 for submit@debbugs.gnu.org; Sun, 23 Feb 2025 06:54:13 -0500 Received: from mailscanner01.zoner.fi ([84.34.166.10]:55692) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tmAYj-0001kG-3Y for 76197-done@debbugs.gnu.org; Sun, 23 Feb 2025 06:54:10 -0500 Received: from www25.zoner.fi (www25.zoner.fi [84.34.147.45]) by mailscanner01.zoner.fi (Postfix) with ESMTPS id 4B45743BD0; Sun, 23 Feb 2025 13:54:02 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tukaani.org ; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Sblv3KyshYmjYpkpTbToA11tJvYykCH4nK/UUEC4Qro=; b=SdJ3WMPBc7ItvGPlXBWXEojEtr hgfRwWbrU8gLLiZ2k/SNWAcD6ciwmuF5mzkbwP1VHTlenBDQ05jNAC37HNuDZYQdpvdxJdEday9l6 vu3nt1OPho+eJtxwJJZXCQtONydu12EtiD4zVqGWEf5VqV/d7eBA8fv6/mAH3u8X72qe48hHmAgQC ngrSKkeoMqu4fa3hX8pi9gpE3Mc8VwWZHT5DKbmyAryDSyg6DasXBpvI2DCVtMDbhLkYGNOLd+XNk PqN9bc6O0rZRvsmVPCKuB8jnMLbTW30LoikaHUY7I4d4aDYCo/cHwjpwZPLwJmsdm+KMXTd6jcPzg Hbucp1wg==; Received: from mail.zoner.fi ([84.34.147.244]) by www25.zoner.fi with esmtp (Exim 4.98.1) (envelope-from ) id 1tmAYc-00000009HxZ-0N0i; Sun, 23 Feb 2025 13:54:02 +0200 Date: Sun, 23 Feb 2025 13:54:01 +0200 From: Lasse Collin Message-ID: <20250223135401.03b2d1ea.lasse.collin@tukaani.org> In-Reply-To: <7f86b281-aa59-4574-8bab-3f871ce2453a@cs.ucla.edu> References: <20250211072241.854108-1-eggert@cs.ucla.edu> <20250212155805.4ca20b9d.lasse.collin@tukaani.org> <7f86b281-aa59-4574-8bab-3f871ce2453a@cs.ucla.edu> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.48; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 2025-02-19 Paul Eggert wrote: > So I installed the attached patch instead into Savannah master gzip. > It means gzip will pay attention to -1..-9, --rsyncable, and > --synchronous This sounds reasonable. It unambiguously prevents glitches in scripts. For example, GZIP=-v may seem innocent but it affects --list output too which some scripts parse. Also, -v undoes -q, and -q affects exit status. There are safe use cases for GZIP=-v, but losing that feature shouldn't be a major loss (it would hurt more if -v provided a real-time progress indicator). I wonder if -n (--no-name) should be allowed. GZIP=-9n was perhaps the most common use case I had. It was with pipes, and nowadays -n is the default for pipes anyway, so it doesn't matter for me. Hypothetically, someone somewhere might rely on GZIP=-n when compressing regular files. If -n is silently ignored, a script might silently start producing .gz files with timestamps and filename metadata. If someone is worried about that, they possibly have seen the deprecation warning already and might have modified their script as well, so the risk should be low. I don't have any examples of such use cases, I'm just pondering what kind of tiny risks there could be. Some script might expect the metadata to be stored, and GZIP=-n could break it. I suspect such use cases are rare nowadays. Preserving the filename was more important when OSes with short file names were still in common use. Thus, I think the probability of negative surprises is low if GZIP=-n is allowed. But I also understand that -n is an option that affects more than just compression ratio, and that is the reason why the commit dropped -n from GZIP. I don't have a clear opinion here. > but will silently ignore everything else in GZIP. The idea is that a > garbage GZIP value shouldn't disrupt normal operations. I have mixed feelings about this. I understand that this way garbage in GZIP cannot break scripts by making gzip fail. Also, if someone has GZIP=-9n for pipe use, a silently-ignored -n will keep it working like before, being compatible with both very old and current gzip versions. On the other hand, it can be confusing that some options, that used to work, no longer work for no apparent reason. One has to look at the manual to figure it out. Typos won't be caught either. How about printing a message to stderr if something is ignored in GZIP? zstd and lz4 do that with their env vars. Even a vague message like "one or more arguments in the GZIP environment variable were ignored" would do if a more specific message is cumbersome to implement. Such a message can break some special uses that check if something was written to stderr, but those should be rare enough (they should unset GZIP). After all, the current deprecation message about GZIP usage was considered acceptable to add. > These options shouldn't cause the bigger glitches (and perhaps even > security hazards) that behavior-oriented options can cause. I understand well that if everything was allowed in GZIP and someone actually used that freedom in a wrong way, bad things could happen. What I don't understand well is how big the risks are in practice. gzip and a few other tools did or do suppport unrestricted options from env vars for a long time. I haven't seen any security alerts about them, but that doesn't mean that they don't or won't exist. I wouldn't add an unrestricted env var to a new tool, but modifying existing tools always has backward compatibility concerns. I'm happy that the important functionality of GZIP is preserved. Thanks! -- Lasse Collin From unknown Tue Aug 12 08:33:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#76197: [PROPOSED] gzip: drop support for the GZIP env var Resent-From: Antonio Diaz Diaz Original-Sender: "Debbugs-submit" Resent-CC: bug-gzip@gnu.org Resent-Date: Sun, 23 Feb 2025 17:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76197 X-GNU-PR-Package: gzip X-GNU-PR-Keywords: patch To: 76197-done@debbugs.gnu.org Received: via spool by 76197-done@debbugs.gnu.org id=D76197.174033006513660 (code D ref 76197); Sun, 23 Feb 2025 17:02:01 +0000 Received: (at 76197-done) by debbugs.gnu.org; 23 Feb 2025 17:01:05 +0000 Received: from localhost ([127.0.0.1]:35773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tmFLk-0003YG-US for submit@debbugs.gnu.org; Sun, 23 Feb 2025 12:01:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48592) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tmFLi-0003XZ-7O for 76197-done@debbugs.gnu.org; Sun, 23 Feb 2025 12:01:02 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tmFLc-0003PD-4T; Sun, 23 Feb 2025 12:00:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=In-Reply-To:References:Subject:To:MIME-Version:From: Date; bh=HYbKQQlQa+gCC0JSi6yNIwkuY9edQbsRI7XaEj7FbH8=; b=qLSpN5ZRI/Mdjojdt0PL jtN/Qm6yO0i4KZHaPiNta63FVylz9HUmcBISkSo/6Qla1f9dNiPyfmH9kTP/xvGkF1ufmY+2v7XTt kRx29gNic/A5C2r784O1nrt2wvhnHIjjHCNMEGl2pLRuaGZuCkHYDgR3B8Hi3FtETyf0LzcRCIqAK YpKoo/fVvxqo1Mp1qc49TbcAV4t1ekuNa/A6z/UCwpTYis9HD26bZgoNrqaZP8aGLyzn/jsKJw2j0 h9IVvhr9ipUGlLF3UJrxgKByzpimtF/S7q0BlzSXWqssknnuXdreb0X4YiD4zj+77q0CrEuLpkSRO e4geTwNu8eXuCg==; Message-ID: <67BB5473.4070907@gnu.org> Date: Sun, 23 Feb 2025 18:01:39 +0100 From: Antonio Diaz Diaz User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 MIME-Version: 1.0 References: <20250211072241.854108-1-eggert@cs.ucla.edu> <20250212155805.4ca20b9d.lasse.collin@tukaani.org> <7f86b281-aa59-4574-8bab-3f871ce2453a@cs.ucla.edu> <20250223135401.03b2d1ea.lasse.collin@tukaani.org> In-Reply-To: <20250223135401.03b2d1ea.lasse.collin@tukaani.org> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -3.2 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.2 (----) Lasse Collin wrote: > Hypothetically, someone somewhere might rely on GZIP=-n when > compressing regular files. Have you considered that removing GZIP, as Paul did originally, would maximize reliability, minimize maintenance work, prevent long discussions about what options GZIP should or should not allow, and not interfere with the user's freedom to define an environment variable for his/her own scripts: gzip ${MY_GZIP_OPT} [options] [files] Best regards, Antonio. From unknown Tue Aug 12 08:33:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#76197: [PROPOSED] gzip: drop support for the GZIP env var Resent-From: Lasse Collin Original-Sender: "Debbugs-submit" Resent-CC: bug-gzip@gnu.org Resent-Date: Mon, 03 Mar 2025 16:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76197 X-GNU-PR-Package: gzip X-GNU-PR-Keywords: patch To: Antonio Diaz Diaz Cc: 76197-done@debbugs.gnu.org Received: via spool by 76197-done@debbugs.gnu.org id=D76197.17410194524213 (code D ref 76197); Mon, 03 Mar 2025 16:31:01 +0000 Received: (at 76197-done) by debbugs.gnu.org; 3 Mar 2025 16:30:52 +0000 Received: from localhost ([127.0.0.1]:50650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tp8gt-00015q-Gr for submit@debbugs.gnu.org; Mon, 03 Mar 2025 11:30:51 -0500 Received: from mailscanner06.zoner.fi ([5.44.246.15]:58792) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tp8gp-00014y-3B for 76197-done@debbugs.gnu.org; Mon, 03 Mar 2025 11:30:49 -0500 Received: from www25.zoner.fi (www25.zoner.fi [84.34.147.45]) by mailscanner06.zoner.fi (Postfix) with ESMTPS id DE7F821526; Mon, 3 Mar 2025 18:30:40 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tukaani.org ; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=/iZpstBbVc9A/3Vr7wzbqzbwmrUZoLZXhfH8Fsk7V8M=; b=Yj0TrCue4QzyYnEflFV5xsgHfd 0EO+uWjj5RHOPoU1Byes3y+tDuohc781UYOsA5LVOtbw4mlo4z9sUJ/+yrnZf9GF67cXBGHjSnFqO 9kKUe/AcVqlzDbB3HcmMbGDQuOjgUo02GafkhS+XNtpQc7/x2PFuqUmNX5Ahwvw/CBs4YQGPOsgWN TWqoBepBEwwA4d79yE8ocm+5kX5Iu15tTfx9mLZj3fCJTN4IS8Ti5ttPUf9JUNJ2LLMZ56//itvlR EG+F/Fygbe1XbFvPkSlVQqCYqcQXQrB7ou2CjNsHkcG3sCnRTXF/ppB/uBI7P/XHb1xUGVH6XYqeQ 7iOgPs7g==; Received: from mail.zoner.fi ([84.34.147.244]) by www25.zoner.fi with esmtp (Exim 4.98.1) (envelope-from ) id 1tp8gi-0000000HKv5-2qEC; Mon, 03 Mar 2025 18:30:40 +0200 Date: Mon, 3 Mar 2025 18:30:40 +0200 From: Lasse Collin Message-ID: <20250303183040.4d77396b.lasse.collin@tukaani.org> In-Reply-To: <67BB5473.4070907@gnu.org> References: <20250211072241.854108-1-eggert@cs.ucla.edu> <20250212155805.4ca20b9d.lasse.collin@tukaani.org> <7f86b281-aa59-4574-8bab-3f871ce2453a@cs.ucla.edu> <20250223135401.03b2d1ea.lasse.collin@tukaani.org> <67BB5473.4070907@gnu.org> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.48; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2025-02-23 Antonio Diaz Diaz wrote: > Have you considered that removing GZIP, as Paul did originally, would > maximize reliability, minimize maintenance work, I considered both pros and cons, including those pros you mentioned. The cons are backward compatibility concerns and removal of a useful feature (when used responsibly). I guess those cons don't matter to you, but maintainers tend to consider such things especially when it's a widely-used package. For example, here is a Debian bug from 2020 about the GZIP deprecation warning appearing in dgit: https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=975624 Previous the code used gzip in a pipe via tar. The fix for the deprecation warning was to use a temporary file: https://salsa.debian.org/dgit-team/dgit/-/commit/710c9b49fff4001521dbb61c5df12156ae62f837 As you can see, the committer knew it made things worse, but it was a quick way to fix the warning. Sometimes compromises are made; I'm not criticizing the committer in any way. It's just an example where changing an old and somewhat widely-used feature can have mildly negative consequences *in practice* (this is an observation, not critique). To be clear, I think restricting the options allowed in GZIP was a positive change. bug-gzip is a fairly quiet list, and small packages don't get much feedback, so I thought it could be useful to express my thoughts. I hope it was the right thing to do. Thanks! -- Lasse Collin