From ceb885232aa09444142ad9a70e9f6947ca1d70e0 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 13 Dec 2023 00:01:39 -0500 Subject: 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 Reviewed-by: Ilmari Lauhakangas --- solenv/doc/gbuild/doxygen.cfg | 2 +- solenv/inc/doxygen.cfg | 4 ++-- solenv/inc/doxygen_doc.cfg | 6 +++--- solenv/inc/doxygen_tag.cfg | 4 ++-- writerfilter/documentation/doxygen/Doxyfile | 2 +- 5 files changed, 9 insertions(+), 9 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 diff --git a/solenv/inc/doxygen.cfg b/solenv/inc/doxygen.cfg index ed50d426549e..ea6ec026d1d5 100644 --- a/solenv/inc/doxygen.cfg +++ b/solenv/inc/doxygen.cfg @@ -2085,7 +2085,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'). # The default file (with absolute path) is: /usr/bin/perl. PERL_PATH = @@ -2300,7 +2300,7 @@ DOT_IMAGE_FORMAT = svg # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -INTERACTIVE_SVG = YES +INTERACTIVE_SVG = YES # The DOT_PATH tag can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. diff --git a/solenv/inc/doxygen_doc.cfg b/solenv/inc/doxygen_doc.cfg index 78d2778f7a4b..a53a3791c989 100644 --- a/solenv/inc/doxygen_doc.cfg +++ b/solenv/inc/doxygen_doc.cfg @@ -2085,7 +2085,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'). # The default file (with absolute path) is: /usr/bin/perl. PERL_PATH = @@ -2300,7 +2300,7 @@ DOT_IMAGE_FORMAT = svg # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -INTERACTIVE_SVG = YES +INTERACTIVE_SVG = YES # The DOT_PATH tag can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. @@ -2398,4 +2398,4 @@ GENERATE_LEGEND = YES # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_CLEANUP = YES \ No newline at end of file +DOT_CLEANUP = YES diff --git a/solenv/inc/doxygen_tag.cfg b/solenv/inc/doxygen_tag.cfg index 1ba9c17cdbfc..803ec974982d 100644 --- a/solenv/inc/doxygen_tag.cfg +++ b/solenv/inc/doxygen_tag.cfg @@ -2085,7 +2085,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'). # The default file (with absolute path) is: /usr/bin/perl. PERL_PATH = @@ -2300,7 +2300,7 @@ DOT_IMAGE_FORMAT = svg # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -INTERACTIVE_SVG = YES +INTERACTIVE_SVG = YES # The DOT_PATH tag can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. diff --git a/writerfilter/documentation/doxygen/Doxyfile b/writerfilter/documentation/doxygen/Doxyfile index 15414b8287c6..6ae1ac4c02aa 100644 --- a/writerfilter/documentation/doxygen/Doxyfile +++ b/writerfilter/documentation/doxygen/Doxyfile @@ -1078,7 +1078,7 @@ ALLEXTERNALS = NO EXTERNAL_GROUPS = 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 -- cgit