Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16506

Re: ‘command … &’ creates subshell

From Eli Schwartz <eschwartz@archlinux.org>
Newsgroups gnu.bash.bug
Subject Re: ‘command … &’ creates subshell
Date 2020-07-01 07:54 -0400
Message-ID <mailman.749.1593604464.2574.bug-bash@gnu.org> (permalink)
References (2 earlier) <ac4a98bd-32f4-5c55-3b8f-1306e9758f54@case.edu> <7dvoi92p.dag@gnui.org> <09ea84b2-4fb1-6b05-7c0b-fe6b2ab00c6f@archlinux.org> <2643.1593599092@jinx.noi.kre.to> <511886e8-2262-39ee-2a01-7d284e981cb1@archlinux.org>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On 7/1/20 6:24 AM, Robert Elz wrote:
>     Date:        Wed, 01 Jul 2020 00:43:14 +0300
>     From:        Dmitry Alexandrov <dag@gnui.org>
>     Message-ID:  <tuysgrgt.dag@gnui.org>
> 
>   | > If you need to ensure a disk executable is used,
>   | Of course.  Why "command" otherwise?
> 
> That doesn't actually work, "command" can run built-ins, there is
> actually no method (not even via use of "env") which guarantees
> execution of an executable from an external file, other than by
> using the complete path name (containing at least one '/') of the
> desired file.

Indeed -- that's why I specifically used the bashism $(type -P ...) as
type -P forces the printing of an external file executable.

Regarding use of env, I presume you're referring to the busybox behavior
here, where busybox's builtin env applet will still execute other
builtin applets.  That's the only case I'm aware of that will not
guarantee execution of an executable from an external file -- so
shouldn't env be safe to use as such, if you know:

a) your interpreter is bash rather than /bin/sh,
b) the external disk executable "env" is not a symlink to busybox

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: ‘command … &’ creates subshell Eli Schwartz <eschwartz@archlinux.org> - 2020-07-01 07:54 -0400

csiph-web