diff options
author | Eli Schwartz <eschwartz93@gmail.com> | 2023-12-13 00:01:39 -0500 |
---|---|---|
committer | Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> | 2024-01-22 14:13:37 +0100 |
commit | ceb885232aa09444142ad9a70e9f6947ca1d70e0 (patch) | |
tree | 90980504cfb278b2cecffb07d8ca834f9baf40bb /solenv/doc | |
parent | 2a5ff80264825e21adb5ff107a3d01237b86f559 (diff) |
use portable "command -v" to detect installed programs, part 5
The "which" utility is not guaranteed to be installed either, and if it
is, its behavior is not portable either. This means that when various
programs are installed, the `which` check will report a fatal error
because the which tool did not exist and the shell returned a nonzero
status when attempting to fork+exec. If it did exist, it might not be an
implementation of `which` that returns nonzero when commands do not
exist.
The general scripting suggestion is to use the "command -v" shell
builtin; this is required to exist in all POSIX 2008 compliant shells,
and is thus guaranteed to work everywhere.
For some in-depth discussions on the topic, see:
- https://mywiki.wooledge.org/BashFAQ/081
- https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then/85250#85250
Examples of open-source shells likely to be installed as /bin/sh on
Linux, which implement the 15-year-old standard: ash, bash, busybox,
dash, ksh, mksh and zsh.
This commit updates documentation to no longer suggest a bad practice
that will confuse the reader when it doesn't work.
Change-Id: I0ed5ced353124919c7e09912c6d4d5aea146fa33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160666
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Diffstat (limited to 'solenv/doc')
-rw-r--r-- | solenv/doc/gbuild/doxygen.cfg | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/solenv/doc/gbuild/doxygen.cfg b/solenv/doc/gbuild/doxygen.cfg index d66fe0cd1670..605432ab1167 100644 --- a/solenv/doc/gbuild/doxygen.cfg +++ b/solenv/doc/gbuild/doxygen.cfg @@ -1661,7 +1661,7 @@ EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES # The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). +# interpreter (i.e. the result of `command -v perl'). PERL_PATH = /usr/bin/perl |