1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00
cde/TODO
Martijn Dekker 61d9bca581 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)
2020-06-12 01:45:16 +02:00

75 lines
3.3 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

TODO for AT&T ksh93, 93u+m bugfix branch
______
Fix regression test failures:
- On OpenBSD, there are 15 locale-related test failures in variables.sh.
______
Fix build failures:
- ksh does not currently build on AIX, HP-UX, Solaris, or QNX.
______
Fix or remove broken default aliases:
- Remove pointless default aliases 'fc' and 'type'; these are already
implemented as normal shell builtins. Add man page entries for these.
______
Fix currently known bugs affecting shell scripting. These are identified by
their modernish IDs. For exact details, see code/comments in:
https://github.com/modernish/modernish/tree/0.16/lib/modernish/cap/
- BUG_BRACQUOT: shell quoting within bracket patterns has no effect. This
bug means the '-' retains it special meaning of 'character range', and an
initial ! (and, on some shells, ^) retains the meaning of negation, even
in quoted strings within bracket patterns, including quoted variables.
- BUG_CMDEXPAN: if the 'command' command results from an expansion, it acts
like 'command -v', showing the path of the command instead of executing it.
For example:
v=command; "$v" ls
or
set -- command ls; "$@"
don't work.
See also: https://github.com/att/ast/issues/963
- BUG_CMDSPASGN: preceding a "special builtin"[*] with 'command' does not
stop preceding invocation-local variable assignments from becoming global.
[*] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_14
- BUG_CMDSPEXIT: preceding a "special builtin"[*] (other than 'eval', 'exec',
'return' or 'exit') with 'command' does not always stop it from exiting
the shell if the builtin encounters error.
[*] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_14
- BUG_CSUBSTDO: If standard output (file descriptor 1) is closed before
entering a $(command substitution), and any other file descriptors are
redirected within the command substitution, commands such as 'echo' will
not work within the command substitution, acting as if standard output is
still closed.
- BUG_IFSGLOBS: In glob pattern matching (as in case or parameter
substitution with # and %), if IFS starts with ? or * and the "$*"
parameter expansion inserts any IFS separator characters, those characters
are erroneously interpreted as wildcards when quoted "$*" is used as the
glob pattern.
- BUG_KUNSETIFS: ksh93: Can't unset IFS under very specific circumstances.
unset -v IFS is a known POSIX shell idiom to activate default field
splitting. With this bug, the unset builtin silently fails to unset IFS
(i.e. fails to activate field splitting) if we're executing an eval or a
trap and a number of specific conditions are met.
- BUG_LOOPRET2: If a 'return' command is given without a status argument
within the set of conditional commands in a 'while' or 'until' loop (i.e.,
between 'while'/'until' and 'do'), the exit status passed down from the
previous command is ignored and the function returns with status 0
instead.
- BUG_MULTIBIFS: We're on a UTF-8 locale and the shell supports UTF-8
characters in general (i.e. we don't have WRN_MULTIBYTE) however, using
multi-byte characters as IFS field delimiters still doesn't work. For
example, "$*" joins positional parameters on the first byte of IFS instead
of the first character.