GNU bug report logs - #73402
Switch scripts from using `type` to `command -v` to support non-XSI POSIX shells, or specify bash?

Previous Next

Package: gzip;

Reported by: Sparr <sparr0 <at> gmail.com>

Date: Sat, 21 Sep 2024 04:08:03 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73402 in the body.
You can then email your comments to 73402 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gzip <at> gnu.org:
bug#73402; Package gzip. (Sat, 21 Sep 2024 04:08:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sparr <sparr0 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gzip <at> gnu.org. (Sat, 21 Sep 2024 04:08:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sparr <sparr0 <at> gmail.com>
To: bug-gzip <at> gnu.org
Subject: Switch scripts from using `type` to `command -v` to support non-XSI
 POSIX shells, or specify bash?
Date: Fri, 20 Sep 2024 19:10:53 -0400
[Message part 1 (text/plain, inline)]
The `zdiff` and `gzexe` scripts use the `type` command to identify whether
the `mktemp` tool is available. That command exists in XSI-compliant shells
and as an external binary or script in some operating systems, but it is
missing in simple POSIX-compliant shells. Because those scripts start with
`#!/bin/sh` I believe they should work in POSIX-compliant shells. Replacing
the use of `type` with `command -v`, or a more complex construct that uses
`type` when it is available and falls back to `command -v` otherwise, would
allow the scripts to work as intended in those scenarios, rather than
silently failing to find the `mktemp` tool when it is available.

Alternately, if the intent is to only target bash, I would propose the
shebang be changed, although that could have downstream consequences of
introducing a new dependency on systems that don't otherwise need or use
bash.

I apologize if this has been discussed previously. I was not able to find
it in the mailing list archives, but I am also unfamiliar with the
organization of the GNU projects' communication and development channels. I
am sending this email without subscribing to the list because that seems to
be the suggested approach in the docs; please let me know if there is a
better way to address this concern.

--
Sparr
sparr0 <at> gmail.com
http://github.com/sparr
[Message part 2 (text/html, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sun, 22 Sep 2024 07:10:02 GMT) Full text and rfc822 format available.

Notification sent to Sparr <sparr0 <at> gmail.com>:
bug acknowledged by developer. (Sun, 22 Sep 2024 07:10:02 GMT) Full text and rfc822 format available.

Message #10 received at 73402-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Sparr <sparr0 <at> gmail.com>
Cc: 73402-done <at> debbugs.gnu.org
Subject: Re: bug#73402: Switch scripts from using `type` to `command -v` to
 support non-XSI POSIX shells, or specify bash?
Date: Sun, 22 Sep 2024 00:09:24 -0700
[Message part 1 (text/plain, inline)]
Thanks for the bug report. I installed the attached patch to fix the bug 
and am boldly closing the bug report. If the patch doesn't work for you, 
please let us know and we can reopen the bug report.
[0001-maint-type-command-v.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 20 Oct 2024 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 294 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.