mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
POSIX compliance: rm harmful default aliases 'command '/'nohup '
Continuing alias substitution after 'command' (due to the final space in the alias) is inherently broken and doing so by default is incompatible with the POSIX standard, as aliases may contain arbitrary shell grammar. For instance, until the previous commit, the POSIX standard 'times' command was an alias: times='{ { time;} 2>&1;}' -- and so, of course, 'command times' gave a syntax error, although this is a perfectly valid POSIX idiom that must be supported. 'command' is specified by POSIX as a regular builtin, not an alias. Therefore it should always bypass aliases just as it bypasses functions to expose standard builtin and external commands. I can only imagine that the reason for this command='command ' alias was that some standard commands themselves were implemented as aliases, and POSIX requires that standard commands are accessible with the 'command' prefix. But implementing standard commands as aliases is itself inherently broken. It never worked for 'command times', as shown; and in any case, removing all aliases with 'unalias -a' should not get rid of standard commands. Similarly, the default alias nohup='nohup ' is also harmful. Anyone who really wants to keep this behaviour can just define these aliases themselves in their script or ~/.kshrc file. src/cmd/ksh93/data/aliases.c: - Remove default alias command='command '. - Remove default alias nohup='nohup '. src/cmd/ksh93/sh.1 - Remove the above default aliases from the list. - Mention that the 'command' builtin does not search for aliases. (cherry picked from commit 5cfe7c4e2015b7445da24983af5008035c4b6e1e)
This commit is contained in:
parent
65d363fd34
commit
61d9bca581
4 changed files with 7 additions and 27 deletions
|
@ -790,8 +790,6 @@ but can be unset or redefined:
|
|||
.TP
|
||||
.B "autoload=\(fmtypeset \-fu\(fm"
|
||||
.TP
|
||||
.B "command=\(fmcommand \(fm"
|
||||
.TP
|
||||
.B "compound=\(fmtypeset \-C\(fm"
|
||||
.TP
|
||||
.B "fc=hist"
|
||||
|
@ -808,8 +806,6 @@ but can be unset or redefined:
|
|||
.TP
|
||||
.B "nameref=\(fmtypeset \-n\(fm"
|
||||
.TP
|
||||
.B "nohup=\(fmnohup \(fm"
|
||||
.TP
|
||||
.B "r=\(fmhist \-s\(fm"
|
||||
.TP
|
||||
.B "redirect=\(fmcommand exec\(fm"
|
||||
|
@ -5811,7 +5807,7 @@ the operating system's standard utilities path
|
|||
rather than the one defined by the value of
|
||||
.SM
|
||||
.BR PATH .
|
||||
Functions will not be searched for when finding
|
||||
Functions and aliases will not be searched for when finding
|
||||
.IR name .
|
||||
In addition, if
|
||||
.I name\^
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue