summary refs log tree commit diff
path: root/src/var.h
diff options
context:
space:
mode:
authorHarald van Dijk <harald@gigawatt.nl>2014-09-26 16:35:15 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2014-09-26 16:35:15 +0800
commit65ae84b3d67425e16b85273e566d06ae942dcce9 (patch)
tree02eb3956ee0437bac65b361adaa4380febe62e4b /src/var.h
parent[BUILTIN] Fixed argument parsing crash in test (diff)
downloaddash-65ae84b3d67425e16b85273e566d06ae942dcce9.tar.gz
dash-65ae84b3d67425e16b85273e566d06ae942dcce9.zip
[BUILTIN] command: allow combining -p with -v
On 10/07/13 20:18, Craig Loomis wrote:
>   Dash (0.5.7 and git master) does not implement 'command -p'
> according to the standard, and opens an intriguing security hole to
> anyone trying this scheme.
> 
>   When using 'command -v' to simply print the path to an executable,
> '-p' has no effect:

You're right. dash has never supported combining -p with -v, but back in
2005 this was seemingly accidentally changed from reporting a syntax
error to silently ignoring the -p option, only about a month after dash
moved to git.

Making sure that -p is respected even when -v is used is easy enough,
see attached patch. Tested even with explicit PATH overrides:
  PATH=/path/to/some/other/dash command -pv dash
correctly outputs /bin/dash on my system.

> the path that 'command -p cmd' uses is a compiled-in constant
> from dash's src/var.c:defpathvar, which starts with
> "/usr/local/sbin:/usr/local/bin". To me, that is both completely
> unexpected and pretty scary -- /usr/local/bin is (very) often less
> well secured or checked than, say, /bin:

Agreed. However, IMO, it does make sense for defpathvar to start with
/usr/local/*: it has two separate functions, it also serves as the
default path (hence the name) when dash is started with no PATH set at
all. I think fixing this should be done in a way so that command -p does
not use defpathvar, not by changing defpathvar. bash uses the same
confstr function for this that getconf uses, and it shouldn't be too
much work to make dash use that too. If no one else comes up with a
working patch or a better approach, I'll try to get that working.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions
ne McEnroe Will be used for SASL authentication. 2018-12-03Call uiShow at init so that TermFocus gets setJune McEnroe 2018-12-03Check nick to determine if is selfJune McEnroe I forgot that usernames aren't unique for a minute there. 2018-12-03Ignore ~ username prefixesJune McEnroe This simplifies a lot. 2018-12-02Move host, port, pass, webp to selfJune McEnroe 2018-12-02Add -r option for realnameJune McEnroe 2018-12-02Send automated messages to TagStatus with UIColdJune McEnroe 2018-12-02Various man page tweaks and editsJune McEnroe 2018-12-02Fix UI resume on /urlJune McEnroe 2018-12-02Add sandman.m to READMEJune McEnroe 2018-12-01Crudely handle reconnecting after suspendJune McEnroe 2018-12-01Fix sandman hangJune McEnroe It was hanging after sending SIGTSTP to its child, then receiving a SIGCHLD to indicate the child had stopped. 2018-12-01Use sigaction in sandmanJune McEnroe 2018-11-30Handle signals consistently in the event loopJune McEnroe 2018-11-30Separate ircConnect and ircDisconnectJune McEnroe 2018-11-30Measure length of log timestamp more consistentlyJune McEnroe 2018-11-30Reformat sandman Objective-C codeJune McEnroe 2018-11-30Ignore sandmanJune McEnroe Oops. 2018-11-30Add sandmanJune McEnroe 2018-11-29Strip timestamps from log replayJune McEnroe Also fix string length. %.*s does not behave as one might expect when writing wchar_t. 2018-11-29Add basic log replayJune McEnroe 2018-11-29Show unread count in term titleJune McEnroe Also render status line with just spaces. Looks much cleaner this way. 2018-11-29Handle no such nick errorJune McEnroe 2018-11-29Add /whoisJune McEnroe 2018-11-29Set LIBRESSL_PREFIX in Darwin.mkJune McEnroe I think this is still the right path for Homebrew, which is the most popular... 2018-11-28Add NetBSD.mkJune McEnroe 2018-11-28Make use of config.mk and add Darwin.mkJune McEnroe