mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix multiple problems with the getconf builtin (#280)
This commit fixes three problems with getconf pathbound builtin: 1. The -l/--lowercase option did not change all variable names to lower case. 2. The -q/--quote option now quotes all string values. Previously, it only quoted string values that had a space or other non-shellsafe character. 3. The -c/--call, -n/--name and -s/--standard options matched all variable names provided by 'getconf -a', even if none were actual matches. Additionally, references to the confstr and sysconf functions have been updated to reference section 3 of the man pages instead of section 2. src/lib/libast/port/astconf.c: - Previously, only values that had spaces in them were quoted. Change that behavior to quote all string values by using the FMT_ALWAYS flag. Bug report: https://github.com/att/ast/issues/1173 - Not all variable names were printed in lowercase by 'getconf -l'. Fix it by adding a few missing instances of fmtlower. Bug report: https://github.com/att/ast/issues/1171 - Add the missing code to the '#if _pth_getconf_a' block to handle -c/-n/-s while parsing the OS's native 'getconf -a' output. This approach reuses code for name matching from other parts of astconflist(). Resolves: https://github.com/ksh93/ksh/issues/279 src/lib/libcmd/getconf.c: - Update the documentation to note the -q flag only quotes strings. src/cmd/ksh93/tests/bulitins.sh: - Add regression tests for the getconf bugs fixed in this commit. Co-authored-by: Martijn Dekker <martijn@inlv.org>
This commit is contained in:
parent
61e0f90460
commit
f28bce61a7
8 changed files with 76 additions and 22 deletions
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
static const char usage[] =
|
||||
"[-?\n@(#)$Id: getconf (ksh 93u+m) 2021-04-09 $\n]"
|
||||
"[-?\n@(#)$Id: getconf (ksh 93u+m) 2021-04-20 $\n]"
|
||||
"[--catalog?" ERROR_CATALOG "]"
|
||||
"[+NAME?getconf - get configuration values]"
|
||||
"[+DESCRIPTION?\bgetconf\b displays the system configuration value for"
|
||||
|
|
@ -52,7 +52,7 @@ static const char usage[] =
|
|||
" \aname\a=\avalue\a form to the standard output, one per line."
|
||||
" Only one of \b--call\b, \b--name\b or \b--standard\b may be specified.]"
|
||||
"[+?This implementation uses the \bastgetconf\b(3) string interface to the native"
|
||||
" \bsysconf\b(2), \bconfstr\b(2), \bpathconf\b(2), and \bsysinfo\b(2)"
|
||||
" \bsysconf\b(3), \bconfstr\b(3), \bpathconf\b(2), and \bsysinfo\b(2)"
|
||||
" system calls."
|
||||
" Invalid options and/or names not supported by \bastgetconf\b(3) cause"
|
||||
" the default native \bgetconf\b, named by \b$(getconf GETCONF)\b, to"
|
||||
|
|
@ -63,9 +63,9 @@ static const char usage[] =
|
|||
"[b:base?List base variable name sans call and standard prefixes.]"
|
||||
"[c:call?Display variables with call prefix that matches \aRE\a. The call"
|
||||
" prefixes are:]:[RE]{"
|
||||
" [+CS?\bconfstr\b(2)]"
|
||||
" [+CS?\bconfstr\b(3)]"
|
||||
" [+PC?\bpathconf\b(2)]"
|
||||
" [+SC?\bsysconf\b(2)]"
|
||||
" [+SC?\bsysconf\b(3)]"
|
||||
" [+SI?\bsysinfo\b(2)]"
|
||||
" [+XX?Constant value.]"
|
||||
"}"
|
||||
|
|
@ -75,7 +75,7 @@ static const char usage[] =
|
|||
"[p:portable?Display the named \bwritable\b variables and values in a form that"
|
||||
" can be directly executed by \bsh\b(1) to set the values. If \aname\a"
|
||||
" is omitted then all \bwritable\b variables are listed.]"
|
||||
"[q:quote?\"...\" quote values.]"
|
||||
"[q:quote?\"...\" quote string values.]"
|
||||
"[r:readonly?Display the named \breadonly\b variables in \aname\a=\avalue\a form."
|
||||
" If \aname\a is omitted then all \breadonly\b variables are listed.]"
|
||||
"[s:standard?Display variables with standard prefix that matches \aRE\a."
|
||||
|
|
@ -116,8 +116,8 @@ static const char usage[] =
|
|||
"is an implementation detail of process inheritance; it may "
|
||||
"change or vanish in the future; don't rely on it.]"
|
||||
"}"
|
||||
"[+SEE ALSO?\bpathchk\b(1), \bconfstr\b(2), \bpathconf\b(2),"
|
||||
" \bsysconf\b(2), \bastgetconf\b(3)]"
|
||||
"[+SEE ALSO?\bpathchk\b(1), \bconfstr\b(3), \bpathconf\b(2),"
|
||||
" \bsysconf\b(3), \bastgetconf\b(3)]"
|
||||
;
|
||||
|
||||
#include <cmd.h>
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ static const char usage[] =
|
|||
"\n[ name ... ]\n"
|
||||
"\n"
|
||||
"[+SEE ALSO?\bhostname\b(1), \bgetconf\b(1), \buname\b(2),"
|
||||
" \bsysconf\b(2), \bsysinfo\b(2)]"
|
||||
" \bsysconf\b(3), \bsysinfo\b(2)]"
|
||||
;
|
||||
|
||||
#if defined(__STDPP__directive) && defined(__STDPP__hide)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue