Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] process substitution breaks when nested or traverses a function



Peter Stephenson wrote on Tue, 24 Apr 2018 10:43 +0100:
> On Sat, 21 Apr 2018 06:35:23 -0300
> Francisco de Zuviría Allende <franciscodezuviria@xxxxxxxxx> wrote:
> > #!/bin/zsh
> > foo() { cat <(cat "$@"); }; foo <(echo bar);
> > cat: /proc/self/fd/11: No such file or directory
> 
> Files and file descriptors for process substitution are handled
> specially, so shouldn't be tidied up by closem(), which is called on the
> inner process substitution (that's why both were required for this to
> show up).
> 
> Is there a better way of doing this; or is this patch overkill, or not
> careful enough...?  If we don't have /proc/self, tidying up is done only
> with the job filelist, so there wouldn't be a problem.  But the get out
> "all" argument looks like a reasonable safety compromise.

I don't know about "better", but I'd looked into this and wondered why
getproc() had two compile-time alternative implementations, one with
mkfifo() and one with /proc/self.  Is this just about portability, or...?

> @@ -4352,12 +4352,17 @@ fixfds(int *save)
>  /**/
>  mod_export void
> -closem(int how)
> +closem(int how, int all)

Maybe add the new parameter 'all' to the docstring?

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author