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: Tue, 13 Feb 2024 14:27:07 -0500
User-agent: Mozilla Thunderbird

On 2/13/24 2:20 PM, Zachary Santer wrote:
On Tue, Feb 13, 2024 at 10:29 AM Chet Ramey <chet.ramey@case.edu <mailto:chet.ramey@case.edu>> wrote:

    On 2/13/24 10:15 AM, Zachary Santer wrote:
     > But we've not reached the point where this would be considered a bug,
     > because you know it was intentionally implemented this way?

    What does this mean? Yes, I know it was intentionally implemented this way.
    Since 1989.


  Just seems like a strange design decision to make. Sorry.

This is a comment from the code as it existed in July 1989:

      /* Hopefully this command is defined in a disk file somewhere.

         1) fork ()
         2) connect pipes
         3) close file descriptors 3-NOFILE
         4) look up the command
         5) do redirections
         6) execve ()
         7) If the execve failed, see if the file has executable mode set.
         If so, and it isn't a directory, then execute its contents as
         a shell script.

         Note that the filename hashing stuff has to take place up here,
         in the parent.  This is probably why the Bourne style shells
         don't handle it, since that would require them to go through
         this gnarly hair, for no good reason.
      */

It persists in the source to this day (except for the closing files bit).


--
``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/




reply via email to

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