help-bash
[Top][All Lists]
Advanced

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

Re: Process substitution documentation request


From: Martin D Kealey
Subject: Re: Process substitution documentation request
Date: Wed, 24 Jun 2026 21:22:33 +1200

There is one way that Bash could fix this so that sudo doesn't get in the
way, at least on Linux: it could use /proc/$BASHPID/fd/$n instead of
/dev/fd/$n (which is generally symlinked to /proc/self/fd/$n, where
/proc/self refers to the current process rather than the bash process.

One gotcha is the need to use fork()+wait() even if it looks like tail
optimisation to execve() should be possible, to ensure /proc/$BASHPID
remains valid while the child process is still running.

It's still not perfect: if the child process forks and
exits, bash won't wait for the grandchild to open the name. But it seems
like a reasonable compromise to get around sudo closing its own
filedescriptors.

Chet: would you like me to work up a patch to do this?

-Martin

On Wed, 24 June 2026, 20:27 Borden via, <help-bash@gnu.org> wrote:

> > Anyway, none of this has much to do with OP's issues, which I think we
> still haven't really identified.
>
> Oh dear. Is my writing really that bad? You don't have to answer that. The
> good and bad news is that this is 100% a sudo problem. I know this because
> yesterday I ran:
>
> $ diff <(xxd binaryFile1) <(xxd binaryFile2)
>
> It worked perfectly the first time. So the bash manual is fine.
>
> > The whole point of the root account is that it can do literally
> anything, as far as the operating system goes.
>
> At least I'm not the only one mistaken. These sudo side effects are
> disappointing. Whilst I don't expect software to do what I want it to do, I
> expect it to do what it's advertised to do. People have repeatedly told me
> that I'm being completely unreasonable.
>
> The sudo man page makes one reference to /dev/fd and none about process
> substitution, so I have to take my fight to them. I'm satisfied if nobody
> else spends days troubleshooting like I had to.
>
>
>


reply via email to

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