From: Denys Vlasenko <dvlasenk@redhat.com>
To: dash@vger.kernel.org
Subject: Are there users of ash's "pathopts"? Do other shells have such a thing?
Date: Sat, 1 Apr 2023 20:46:18 +0200 [thread overview]
Message-ID: <aad32205-1e0a-fea6-0825-8eb45c6ae915@redhat.com> (raw)
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/*).
I tried a few searches on the internet and this feature
seems to be almost entirely not documented. I found exactly one
manpage documenting it:
https://www.unix.com/man-page/minix/1/ash/
Path Search
When locating a command, the shell first looks to see if it has a shell function by that name. Then, if PATH does not contain an entry for
"%builtin", it looks for a builtin command by that name. Finally, it searches each entry in PATH in turn for the command.
The value of the PATH variable should be a series of entries separated by colons. Each entry consists of a directory name, or a directory
name followed by a flag beginning with a percent sign. The current directory should be indicated by an empty directory name.
If no percent sign is present, then the entry causes the shell to search for the command in the specified directory. If the flag is
``%builtin'' then the list of shell builtin commands is searched. If the flag is ``%func'' then the directory is searched for a file which
is read as input to the shell. This file should define a function whose name is the name of the command being searched for.
Here is an example of a user having a problem because he has a PATH with
directory containing "GNU%2fLinux" string in its name:
https://unix.stackexchange.com/questions/126955/percent-in-path-environment-variable
So... maybe we can drop it?
I assume it's rarely (never?) used in the wild.
It interferes with valid directories with percents in names.
It's non-standard, and not a typical feature of other Bourne-like shells
(maybe we (ash family) are the only ones?)
Code complication to support it is a chore.
next reply other threads:[~2023-04-01 18:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-01 18:46 Denys Vlasenko [this message]
2023-04-01 19:13 ` Are there users of ash's "pathopts"? Do other shells have such a thing? Harald van Dijk
2023-04-01 20:49 ` Denys Vlasenko
2023-04-01 21:35 ` Lawrence Velázquez
2023-04-02 17:25 ` Sven Mascheck
2023-04-03 9:35 ` Denys Vlasenko
2023-04-03 11:35 ` Harald van Dijk
2023-04-03 11:54 ` Denys Vlasenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aad32205-1e0a-fea6-0825-8eb45c6ae915@redhat.com \
--to=dvlasenk@redhat.com \
--cc=dash@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).