summary refs log tree commit diff
path: root/src/output.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/output.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 'src/output.h')
0 files changed, 0 insertions, 0 deletions
irl/commit/ui.c?h=2.2a&id=a6ede6f91f41ca20d02454de3bd33329d35fbbd1&follow=1'>Factor out allocating conversion between wcs and mbsJune McEnroe 2018-08-07Match commands case-insensitivelyJune McEnroe 2018-08-07Convert input to multibyte before handlingJune McEnroe 2018-08-07Populate tab-complete listJune McEnroe 2018-08-07Fix /me formatting side-effectsJune McEnroe 2018-08-07Define ui.c BUF_LEN with enumJune McEnroe 2018-08-07Hack clang into checking uiFmt format stringsJune McEnroe 2018-08-07Handle PART and QUIT without messagesJune McEnroe 2018-08-07Make safe filling the who bufferJune McEnroe 2018-08-07Add reverse and reset IRC formatting codesJune McEnroe 2018-08-06Rewrite line editing again, add formattingJune McEnroe 2018-08-06Fix allocation size in vaswprintfJune McEnroe 2018-08-06Implement word wrappingJune McEnroe 2018-08-06Use wchar_t strings for all of UIJune McEnroe 2018-08-06Rename line editing functionsJune McEnroe 2018-08-05Initialize all possible color pairsJune McEnroe 2018-08-05Refactor color initializationJune McEnroe 2018-08-05Add ^L redrawJune McEnroe 2018-08-05Use 16 colors if availableJune McEnroe 2018-08-05Limit parsed colors to number of mIRC colorsJune McEnroe 2018-08-04Show source link on exitJune McEnroe 2018-08-04Implement line editing, scrollingJune McEnroe 2018-08-04Handle /topicJune McEnroe