Hi! On Mon, Dec 19, 2022 at 11:29:36PM +0100, Vincent Lefevre wrote: > On 2022-12-19 22:58:44 +0100, наб wrote: > > This makes dash, as you note, incompatible with ksh93 and bash, > > but compatible with zsh in this regard. Seeing as this is an extension > > to POSIX (which requires that the name matches [a-zA-Z0-9_!%,@]+), > > both approaches are valid. > > No, it is still incompatible with zsh, where one can use the alias: > > zira% alias '\mv=echo ab' > zira% alias > '\mv'='echo ab' > run-help=man > which-command=whence > zira% \mv > ab > zira%
I meant the compatibility insofar as the alias name domain (and, roughly, the output when the name needs quoting). I didn't even try the expansion behaviours, because none of them should expand, and zsh is wrong to do this (quoting my patch from forwarded-to): + * POSIX Issue 7, XCU, 2.3.1 Alias Substitution: + * the command name word of a simple command shall be examined + * to determine whether it is an unquoted, valid alias name + * POSIX Issue 7, XCU, 2.2 Quoting: + * The various quoting mechanisms are the escape character, + * single-quotes, and double-quotes. As in one /can/ accept anything in the name (XBD, 3.10 Alias Name), but /must not/ expand aliases when the word is in any way quoted. > But perhaps if an alias with a backslash is accepted like in zsh, > then the fact that it is not used by dash is a bug. This doesn't > match the dash man page: > > But backslash handling is normally done *after* checking for aliases. > This typically allows one to disable an alias by using a backslash: Yeah, you're right here; dash conforms to the standard and doesn't alias-expand quoted command names, sorry for the confusion. (Also, the command name in your last prompt is "mv", so it's doubly weird that zsh allows it to match "\mv". In sh and ksh compatibility mode, which zsh apparently has, zsh does behave like dash/POSIX (allows anything in the name, doesn't expand aliases when quoted)). Best, наб
signature.asc
Description: PGP signature