GNU bug report logs -
#73402
Switch scripts from using `type` to `command -v` to support non-XSI POSIX shells, or specify bash?
Previous Next
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.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#73402: Switch scripts from using `type` to `command -v` to support non-XSI POSIX shells, or specify bash?
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 73402 <at> debbugs.gnu.org.
--
73402: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73402
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (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)]
[Message part 5 (message/rfc822, inline)]
[Message part 6 (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 7 (text/html, inline)]
This bug report was last modified 295 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.