bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: implicit redirection of background within pipeline


From: Piotr Grzybowski
Subject: Re: implicit redirection of background within pipeline
Date: Sun, 10 Jan 2016 18:54:51 +0100

hey,

 I am quite sure it happens here (devel branch, at
6f82653c5ef09aeeeba4376a1c65ce86c3605c00):

execute_cmd.c +5115:
   if ((cmdflags & CMD_STDIN_REDIR) &&
  pipe_in == NO_PIPE &&
  (stdin_redirects (redirects) == 0))
     async_redirect_stdin ();

 but after reading the comments some 3.5k lines earlier I am not sure
how to fix it; of course commenting out the if in
execute_cmd.c:5112-5115 solves it, but who can tell what it breaks?

cheers,
pg



On Sun, Jan 10, 2016 at 8:23 AM, Martin D Kealey
<martin@kurahaupo.gen.nz> wrote:
>
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
> -DHAVE_CONFIG_H   -I.  -I../. -I.././include -I.././lib  -D_FORTIFY_SOURCE=2
> -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
> -Werror=format-security -Wall
> uname output: Linux treehug.home.kurahaupo.gen.nz 3.13.0-55-generic
> #94-Ubuntu SMP Thu Jun 18 00:27:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
>
> Bash Version: 4.3
> Patch Level: 11
> Release Status: release
>
> Description:
>         The first backgrounded element within a pipeline component has its
>         stdin redirected to /dev/null; this does not apply to the second and
>         subsequent background elements.
>
>         On a Linux system this can be observed with:
>         echo x | ( ls -ld /proc/self/fd/0 &
>                    ls -ld /proc/self/fd/0 &
>                    wait )
>
>         On other systems it is apparent simply with:
>         echo x | ( cat & wait )
>         # no output is produced
>
> Repeat-By:
>         # this command produces no output:
>         echo x | ( cat & wait )
>
> Fix:
>         # this is only a work-around:
>         echo x ( :& cat & wait )
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]