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)]
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)]
This bug report was last modified 298 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.