On 4/1/23 20:46, Denys Vlasenko wrote:
ash allows PATH to contain "%builtin" and "DIR%func" pseudo-directories. %builtin shows in what order builtins to be found relative to searching directories for external commands. DIR%func allows to have a directory of "auto-loadable" functions. (dash git tree seems to have an example of it as src/funcs/*).
On a related note, chkmail() used to iterate over MAILPATH using padvance(), the function which detects "pathopts". In commit a068bf7aa310e8d36ae11c2aec47af1446a18827 "exec: Stricter pathopt parsing" padvance() was modified, and old behavior is retained in the form padvance_magic(..., 2), which treats any %text as pathopt (not only %builtin and %func). chkmail() now uses padvance_magic(..., 2) call, presumably as exact 1:1 equivalent of old code. But it's not necessary, right? chkmail() does not actually uses pathopts. It can just call padvance_magic(..., 0) so as to ignore them. If so, then code for padvance_magic(..., 2) is unused and can be removed. Only "magic" values of 0 and 1 will be in use.