1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

posix: re-allow preset aliases on interactive (re: ddaa145b)

The POSIX standard in fact contains a sentence that specifically
allows preset aliases: "Implementations also may provide predefined
valid aliases that are in effect when the shell is invoked."
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_03_01

I had missed that back then. It's still a terrible idea for scripts
(particularly the way 93u+ implemented them), but for interactive
POSIX shells it makes a lot more sense and does not violate POSIX.

src/cmd/ksh93/sh/main.c: sh_main():
- Preset aliases for interactive shell regardless of SH_POSIX.
This commit is contained in:
Martijn Dekker 2022-06-09 21:50:26 +01:00
parent b14e79e9d0
commit 4f9456d69f
3 changed files with 9 additions and 14 deletions

View file

@ -166,12 +166,9 @@ int sh_main(int ac, char *av[], Shinit_f userinit)
{
sh_onoption(SH_BGNICE);
sh_onoption(SH_RC);
if(!sh_isoption(SH_POSIX))
{
/* preset aliases for interactive non-POSIX ksh */
dtclose(sh.alias_tree);
sh.alias_tree = sh_inittree(shtab_aliases);
}
/* preset aliases for interactive ksh/sh */
dtclose(sh.alias_tree);
sh.alias_tree = sh_inittree(shtab_aliases);
}
#if SHOPT_REMOTE
/*