help-bash
[Top][All Lists]
Advanced

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

Re: why does </proc/self/environ not work in bash?


From: Chet Ramey
Subject: Re: why does </proc/self/environ not work in bash?
Date: Mon, 12 Feb 2024 14:55:57 -0500
User-agent: Mozilla Thunderbird

On 2/12/24 12:44 PM, Zachary Santer wrote:
On Mon, Feb 12, 2024 at 10:14 AM Chet Ramey <chet.ramey@case.edu <mailto:chet.ramey@case.edu>> wrote:

    A system call tracer helps here. You'll find that the shell forks,
    sets up the redirection by opening /proc/self/environ, then execs tr,
    which reads the open file descriptor it inherits through execve.

It seems you'd be losing nothing in terms of optimization by evaluating the word representing the file that's being redirected to or from before the fork takes place, which would avoid this little bit of weirdness:

POSIX makes that explicitly unspecified. Is it worth breaking backwards
compatibility for?


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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