From 9a3139d3b458bd0e8e001a76f50d912af9132675 Mon Sep 17 00:00:00 2001 From: Johnothan King Date: Thu, 25 Jun 2020 08:21:40 -0700 Subject: [PATCH] Fix some errors in the documentation and other minor issues Somewhat notable changes in this commit: - The 'set +r' bugfix (re: 74b41621) is now documented in the changelog. - Missing options have been added to the synopsis section of the ksh man page. - The minor formatting fix from ksh-community/ksh#5 has been applied to the ksh man page. - A few fixes from att/ast@5e747cfb have been applied to the ksh man page. - The man page fixes from att/ast#353 have been applied, being: - An addition to document the behavior of 'set -H'. - A fix for the cd section appending rksh93. - A fix for some options being indented too far. - Removal of a duplicate section documenting '-D'. - Reordering the options for 'set' in alphabetical order. - A minor fix for the documentation of 'ksh -i'. --- NEWS | 7 +++- lib/package/INIT.README | 2 +- lib/package/INIT.html | 2 +- src/cmd/INIT/RELEASE | 2 +- src/cmd/builtin/pty.c | 4 +- src/cmd/ksh93/COMPATIBILITY | 2 +- src/cmd/ksh93/RELEASE88 | 2 +- src/cmd/ksh93/bltins/enum.c | 2 +- src/cmd/ksh93/bltins/typeset.c | 2 +- src/cmd/ksh93/data/builtins.c | 2 +- src/cmd/ksh93/sh.1 | 71 +++++++++++++++++--------------- src/cmd/ksh93/tests/functions.sh | 2 +- src/lib/libast/RELEASE | 2 +- 13 files changed, 54 insertions(+), 48 deletions(-) diff --git a/NEWS b/NEWS index 3ecfcc47d551..561637ea4c3f 100644 --- a/NEWS +++ b/NEWS @@ -45,8 +45,8 @@ Any uppercase BUG_* names are modernish shell bug IDs. - A two decade old bug that caused 'whence -a' to base the path of tracked aliases on the user's current working directory has been - fixed. Now the real path to the tracked aliases is shown when '-a' - is passed to the whence command. + fixed. Now the real path to tracked aliases is shown when '-a' is + passed to the whence command. 2020-06-17: @@ -120,6 +120,9 @@ Any uppercase BUG_* names are modernish shell bug IDs. shell's hash table. This fix applies to the hash utility and when the PATH is reset manually. +- 'set +r' is no longer able to unset the restricted option. This change + makes the behavior of 'set +r' identical to 'set +o restricted'. + 2020-06-09: - The 'unalias' builtin will now return a non-zero status if it tries diff --git a/lib/package/INIT.README b/lib/package/INIT.README index 73411ec173c1..9996be7bc733 100644 --- a/lib/package/INIT.README +++ b/lib/package/INIT.README @@ -165,7 +165,7 @@ All recorded changes follow. 10-06-25 package.sh: "force admin ditto" => no ditto --update option 10-06-22 C+probe: handle cc that require .[ci] input for version info 10-06-21 ditto.sh: change default remote access to ssh (about time) -10-06-12 regress.sh: DISGNOSTICS [ 1 | 0 | pattern ] and fix EXIT for all +10-06-12 regress.sh: DIAGNOSTICS [ 1 | 0 | pattern ] and fix EXIT for all 10-06-09 package.sh: add AT&T to usable nmake check 10-06-06 iffe.sh,iffe.tst: add { api ver } ops 10-04-22 package.sh: update "html binary|source" NAME/PASSWORD info diff --git a/lib/package/INIT.html b/lib/package/INIT.html index 315dbce8d9a5..ac621cf83522 100644 --- a/lib/package/INIT.html +++ b/lib/package/INIT.html @@ -127,7 +127,7 @@ 10-06-25 package.sh: "force admin ditto" => no ditto --update option 10-06-22 C+probe: handle cc that require .[ci] input for version info 10-06-21 ditto.sh: change default remote access to ssh (about time) -10-06-12 regress.sh: DISGNOSTICS [ 1 | 0 | pattern ] and fix EXIT for all +10-06-12 regress.sh: DIAGNOSTICS [ 1 | 0 | pattern ] and fix EXIT for all 10-06-09 package.sh: add AT&T to usable nmake check 10-06-06 iffe.sh,iffe.tst: add { api ver } ops 10-04-22 package.sh: update "html binary|source" NAME/PASSWORD info diff --git a/src/cmd/INIT/RELEASE b/src/cmd/INIT/RELEASE index 70cd195964ef..c1042d252f00 100644 --- a/src/cmd/INIT/RELEASE +++ b/src/cmd/INIT/RELEASE @@ -70,7 +70,7 @@ 10-06-25 package.sh: "force admin ditto" => no ditto --update option 10-06-22 C+probe: handle cc that require .[ci] input for version info 10-06-21 ditto.sh: change default remote access to ssh (about time) -10-06-12 regress.sh: DISGNOSTICS [ 1 | 0 | pattern ] and fix EXIT for all +10-06-12 regress.sh: DIAGNOSTICS [ 1 | 0 | pattern ] and fix EXIT for all 10-06-09 package.sh: add AT&T to usable nmake check 10-06-06 iffe.sh,iffe.tst: add { api ver } ops 10-04-22 package.sh: update "html binary|source" NAME/PASSWORD info diff --git a/src/cmd/builtin/pty.c b/src/cmd/builtin/pty.c index b753204804dd..115d49847c31 100644 --- a/src/cmd/builtin/pty.c +++ b/src/cmd/builtin/pty.c @@ -33,7 +33,7 @@ USAGE_LICENSE "[+?Input to \bpty\b will be written to the standard input of this " "command. The standard output and standard error from the command will " "be written to the standard output of \bpty\b.]" -"[+?The \bpty\b commmand terminates when the command completes.]" +"[+?The \bpty\b command terminates when the command completes.]" "[d:dialogue?Execute the dialogue on the standard input. A dialogue is a " "sequence of commands, one command per line. All \are\a patterns are " "extended regular expressions. The \are\a \b?1\b will print the subject " @@ -58,7 +58,7 @@ USAGE_LICENSE "[r [\are\a]]?read a line from the master [and it should match " "re]]]" "[s \amilliseconds\a?sleep for \amilliseconds\a]" - "[t \amilliseconds\a?set the master read timout to " + "[t \amilliseconds\a?set the master read timeout to " "\amilliseconds\a; the default is \b1000\b]" "[u \are\a?read lines from the master until one matches \are\a]" "[v \alevel\a?set the verbose trace \alevel\a, more output for " diff --git a/src/cmd/ksh93/COMPATIBILITY b/src/cmd/ksh93/COMPATIBILITY index cf260763e824..92ea9767bbb7 100644 --- a/src/cmd/ksh93/COMPATIBILITY +++ b/src/cmd/ksh93/COMPATIBILITY @@ -128,7 +128,7 @@ omitted features that are completely upward compatible. The sequence escape control-v will display the shell version. 29. In ksh-88, DEBUG traps were executed. after each command. In ksh-93 - DEBUG traps are exeucted before each command. + DEBUG traps are executed before each command. 30. In ksh-88, a redirection to a file name given by an empty string was ignored. In ksh-93, this is an error. diff --git a/src/cmd/ksh93/RELEASE88 b/src/cmd/ksh93/RELEASE88 index 2466e39781b7..6fae75aa13f1 100644 --- a/src/cmd/ksh93/RELEASE88 +++ b/src/cmd/ksh93/RELEASE88 @@ -157,7 +157,7 @@ of ksh. 8. Variable .sh.version is set to the version string for this shell. 9. Variable .sh.name is set to the name of the variable - that that was referenced or assigned to when executing a get + that was referenced or assigned to when executing a get or set discipline function. 10. Variable .sh.subscript is set to the subscript for the variable that was referenced or assign to when executing a get or diff --git a/src/cmd/ksh93/bltins/enum.c b/src/cmd/ksh93/bltins/enum.c index 5cc749cc158a..b096b1cb3a75 100644 --- a/src/cmd/ksh93/bltins/enum.c +++ b/src/cmd/ksh93/bltins/enum.c @@ -160,7 +160,7 @@ static void put_enum(Namval_t* np,const char *val,int flags,Namfun_t *fp) i++; } if(nv_isattr(np,NV_NOFREE)) - error(ERROR_exit(1), "%s: invalid value %s",nv_name(np),val); + error(ERROR_exit(1), "%s: invalid value %s",nv_name(np),val); } static char* get_enum(register Namval_t* np, Namfun_t *fp) diff --git a/src/cmd/ksh93/bltins/typeset.c b/src/cmd/ksh93/bltins/typeset.c index 54d0529992d3..7493c8f946fa 100644 --- a/src/cmd/ksh93/bltins/typeset.c +++ b/src/cmd/ksh93/bltins/typeset.c @@ -561,7 +561,7 @@ static int setall(char **argv,register int flag,Dt_t *troot,struct tdata *tp if(troot == shp->fun_tree) { /* - *functions can be exported or + * functions can be exported or * traced but not set */ flag &= ~NV_ASSIGN; diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index d38f2ed3312b..5b3c8fb575b9 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -940,7 +940,7 @@ const char sh_opthash[] = "\n" "[+EXIT STATUS?]{" "[+0?Successful completion.]" - "[+>0?An error occured.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bsh\b(1), \balias\b(1)]" ; diff --git a/src/cmd/ksh93/sh.1 b/src/cmd/ksh93/sh.1 index 7f08028c87af..9b335e568c62 100644 --- a/src/cmd/ksh93/sh.1 +++ b/src/cmd/ksh93/sh.1 @@ -39,7 +39,7 @@ ksh93, rksh93, pfksh93 \- KornShell, a standard/restricted command and programmi .B ksh93 .\} [ -.B \(+-abcefhikmnoprstuvxBCDP +.B \(+-abcefhiklmnoprstuvxBCDEGHP ] [ .B \-R file ] [ @@ -63,7 +63,7 @@ option ] .\|.\|. [ .B \-R file ] [ .B \(+-o -option ] .\|.\|. [ +option ] .\|.\|. [ .B \- ] [ arg .\|.\|. ] .SH DESCRIPTION @@ -2201,7 +2201,7 @@ included. .IP All other characters are output without change and a trailing newline is added. -If unset, the default value, \fB$'\enreal\et%2lR\enuser\et%2lU\ensys\t%2lS'\fP, +If unset, the default value, \fB$'\enreal\et%2lR\enuser\et%2lU\ensys\et%2lS'\fP, is used. If the value is null, no timing information is displayed. .TP .B @@ -4005,7 +4005,7 @@ by defining the first sub-variable name as and defining its type as the base type. Any remaining definitions will be additions and modifications that apply to the new type. -If the new type name is the same is that of the base type, +If the new type name is the same as that of the base type, the type will be replaced and the original type will no longer be accessible. .PP @@ -4014,7 +4014,7 @@ The command with the .B \-T and no option argument or operands will write all the type definitions to -standard output in a form that that can be read in to create all they types. +standard output in a form that can be read in to create all they types. .SS Jobs. .PP If the @@ -4252,7 +4252,7 @@ where .I path\^ names an existing directory -then that directory is searched after immediately after the current directory +then that directory is searched immediately after the current directory as if it were found in the .B .SM FPATH @@ -5769,7 +5769,7 @@ The command may not be executed by .if \nZ=0 .B rsh\^. .if \nZ=1 .B rksh\^. -.if \nZ=1 .B rksh93\^. +.if \nZ=2 .B rksh93\^. .TP \f3command\fP \*(OK \f3\-pvxV\fP \*(CK \f2name\^\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK Without the @@ -6302,7 +6302,7 @@ The exit status is 0 if the value of the last expression is non-zero, and 1 otherwise. .TP -\f3print\fP \*(OK \f3\-CRenprsv\^\fP \*(CK \*(OK \f3\-u\fP \f2unit\^\fP\*(CK \*(OK \f3\-f\fP \f2format\^\fP \*(CK \*(OK \f2arg\^\fP .\|.\|. \*(CK +\f3print\fP \*(OK \f3\-CRenprsv\^\fP \*(CK \*(OK \f3\-u\fP \f2unit \^\fP\*(CK \*(OK \f3\-f\fP \f2format\^\fP \*(CK \*(OK \f2arg\^\fP .\|.\|. \*(CK With no options or with option .B \- or @@ -6607,7 +6607,7 @@ or on the command line determines which method is used. .TP -\f3read\fP \*(OK \f3\-ACSprsv\^\fP \*(CK \*(OK \f3\-d\fP \f2delim\^\fP\*(CK \*(OK \f3\-n\fP \f2n\^\fP\*(CK \*(OK \*(OK \f3\-N\fP \f2n\^\fP\*(CK \*(OK \*(OK \f3\-t\fP \f2timeout\^\fP\*(CK \*(OK \f3\-u\fP \f2unit\^\fP\*(CK \*(OK \f2vname\f3?\f2prompt\^\f1 \*(CK \*(OK \f2vname\^\fP .\|.\|. \*(CK +\f3read\fP \*(OK \f3\-ACSprsv\^\fP \*(CK \*(OK \f3\-d\fP \f2delim \^\fP\*(CK \*(OK \f3\-n\fP \f2n \^\fP\*(CK \*(OK \*(OK \f3\-N\fP \f2n \^\fP\*(CK \*(OK \f3\-t\fP \f2timeout \^\fP\*(CK \*(OK \f3\-u\fP \f2unit \^\fP\*(CK \*(OK \f2vname\f3?\f2prompt\^\f1 \*(CK \*(OK \f2vname\^\fP .\|.\|. \*(CK The shell input mechanism. One line is read and is broken up into fields using the characters in @@ -6838,6 +6838,11 @@ If followed by a .B / only directories and sub-directories are matched. .TP 8 +.B \-H +Enable \f3!\fP-style history expansion similar to +.IR csh (1). +. +.TP 8 .B \-a All subsequent variables that are defined are automatically exported. .TP 8 @@ -6896,10 +6901,6 @@ The following argument can be one of the following option names: Same as .BR \-a . .TP 8 -.B errexit -Same as -.BR \-e . -.TP 8 .B bgnice All background jobs are run at a lower priority. This is the default mode. @@ -6913,6 +6914,10 @@ Puts you in an .I emacs style in-line editor for command entry. .TP 8 +.B errexit +Same as +.BR \-e . +.TP 8 .B globstar Same as .BR \-G . @@ -6922,6 +6927,10 @@ Puts you in a .I gmacs style in-line editor for command entry. .TP 8 +.B histexpand +Same as +.BR \-H . +.TP 8 .B ignoreeof The shell will not exit on end-of-file. The command @@ -6981,6 +6990,10 @@ of the pipeline have completed, and the return value will be the value of the last non-zero command to fail or zero if no command has failed. .TP 8 +.B privileged +Same as +.BR \-p . +.TP 8 .B showme When enabled, simple commands or pipelines preceded by a semicolon .RB ( ; ) @@ -6991,18 +7004,14 @@ Otherwise, the leading .B ; will be ignored. .TP 8 -.B privileged +.B trackall Same as -.BR \-p . +.BR \-h . .TP 8 .B verbose Same as .BR \-v . .TP 8 -.B trackall -Same as -.BR \-h . -.TP 8 .B vi Puts you in insert mode of a .I vi\^ @@ -7937,10 +7946,13 @@ when it is invoked: .PD 0 .TP 8 .B \-D -Do not execute the script, but output the set of double quoted strings -preceded by a -.BR $ . -These strings are needed for localization of the script to different locales. +A list of all double quoted strings that are preceded by a +.B $ +will be printed on standard output and the shell will exit. +This set of strings will be subject to language translation +when the locale is not C or POSIX. +No commands will be executed. +.PD .TP 8 .B \-E Reads the file named by the @@ -7948,7 +7960,7 @@ Reads the file named by the variable or by \s-1$HOME\s+1/\f3.\fPkshrc if not defined after the profiles. -.TP 10 +.TP 8 .BI \-c If the .B \-c @@ -7984,7 +7996,7 @@ In this case \s-1TERM\s+1 is ignored (so that \f3kill 0\fP does not kill an interactive shell) and \s-1INTR\s+1 is caught and ignored (so that .B wait -is ). +is interruptible). In all cases, \s-1QUIT\s+1 is ignored by the shell. .TP .B \-r @@ -7992,15 +8004,6 @@ If the .B \-r option is present, the shell is a restricted shell. .TP -.B \-D -A list of all double quoted strings that are preceded by a -.B $ -will be printed on standard output and the shell will exit. -This set of strings will be subject to language translation -when the locale is not C or POSIX. -No commands will be executed. -.PD -.TP .B \-P If .B \-P diff --git a/src/cmd/ksh93/tests/functions.sh b/src/cmd/ksh93/tests/functions.sh index 9ec50bd07676..e5dbd7173667 100755 --- a/src/cmd/ksh93/tests/functions.sh +++ b/src/cmd/ksh93/tests/functions.sh @@ -1262,7 +1262,7 @@ $SHELL -c 'PATH=/dev/null; function fn { unset -f fn; true; }; fn; fn' 2> /dev/n # Check if environment variables passed while invoking a function are exported # https://github.com/att/ast/issues/32 unset foo -function f2 { env | grep -q "^foo" || err_exit "Environment variable is not propogated from caller function"; } +function f2 { env | grep -q "^foo" || err_exit "Environment variable is not propagated from caller function"; } function f1 { f2; env | grep -q "^foo" || err_exit "Environment variable is not passed to a function"; } foo=bar f1 diff --git a/src/lib/libast/RELEASE b/src/lib/libast/RELEASE index 6a2acc6213e3..793f3dd4f56b 100644 --- a/src/lib/libast/RELEASE +++ b/src/lib/libast/RELEASE @@ -223,7 +223,7 @@ 09-12-04 features/options: add "opt map-libc" check 09-12-03 tm/tmxdate.c: fix 'next month final day' for dec -> jan 09-11-21 misc/magic.tab: add gimp XCF -09-11-20 vmalloc/vmtrace.c: add pid to assertion disgnostics +09-11-20 vmalloc/vmtrace.c: add pid to assertion diagnostics 09-11-11 regex.h,regcomp.c: add REG_CLASS_ESCAPE, \ inside [...] literal by default 09-11-03 regex/regcache.c: change to variable length pattern strings 09-10-28 include/error.h: fix ERROR_translate() arg parens