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
6
NEWS
6
NEWS
|
@ -12,6 +12,12 @@ Any uppercase BUG_* names are modernish shell bug IDs.
|
|||
another with those used by all of the shell's child processes.
|
||||
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_27
|
||||
|
||||
- The default aliases command='command ' and nohup='nohup ' have been
|
||||
removed because they caused breakage in an attempt to circumvent other
|
||||
breakage which is being fixed. In the unlikely even that anyone still
|
||||
needs alias substitution to continue on the command argument following
|
||||
'command' or 'nohup', it's easy to set these aliases yourself.
|
||||
|
||||
2020-06-05:
|
||||
|
||||
- Fix a bug that caused special variables such as PATH, LANG, LC_ALL,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue