[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why does </proc/self/environ not work in bash?
From: |
Koichi Murase |
Subject: |
Re: why does </proc/self/environ not work in bash? |
Date: |
Mon, 12 Feb 2024 00:12:33 +0900 |
2024年2月11日(日) 23:17 Greg Wooledge <greg@wooledge.org>:
> But... wait, now I'm even more confused:
>
> unicorn:~$ ( sleep 3 & exec 3</proc/$!/environ ; cat <&3 )
> unicorn:~$
>
> How come *that* one didn't print anything?
I think the stream opened for /proc/xxx/environ is invalidated on exec
of the process of PID xxx. Then, the next question is why
/proc/xxx/comm and /proc/xxx/cmdline are not invalidated on exec of
the process. I found an interesting behavior:
$ bash -c 'read -N 1;printf %s "$REPLY"; cat' < /proc/self/cmdline
bat
I'm on GNU/Linux. This might mean that the stream for
/proc/xxx/cmdline only remembers the offset and just accesses the
"current" memory block allocated for the command line when `read' is
requested.
- Re: why does </proc/self/environ not work in bash?, (continued)
- Re: why does </proc/self/environ not work in bash?, Christoph Anton Mitterer, 2024/02/11
- Re: why does </proc/self/environ not work in bash?, Christoph Anton Mitterer, 2024/02/11
- Re: why does </proc/self/environ not work in bash?, Chet Ramey, 2024/02/12
- Re: why does </proc/self/environ not work in bash?, Christoph Anton Mitterer, 2024/02/12
- Re: why does </proc/self/environ not work in bash?, Lawrence Velázquez, 2024/02/12
- Re: why does </proc/self/environ not work in bash?, Chet Ramey, 2024/02/13
- Re: why does </proc/self/environ not work in bash?, Chet Ramey, 2024/02/13
- Re: why does </proc/self/environ not work in bash?, Kerin Millar, 2024/02/11
- Re: why does </proc/self/environ not work in bash?, Christoph Anton Mitterer, 2024/02/11
Re: why does </proc/self/environ not work in bash?, Greg Wooledge, 2024/02/11
Re: why does </proc/self/environ not work in bash?, Chet Ramey, 2024/02/12
- Re: why does </proc/self/environ not work in bash?, Zachary Santer, 2024/02/12
- Re: why does </proc/self/environ not work in bash?, Chet Ramey, 2024/02/12
- Re: why does </proc/self/environ not work in bash?, Zachary Santer, 2024/02/12
- Re: why does </proc/self/environ not work in bash?, Chet Ramey, 2024/02/13
- Re: why does </proc/self/environ not work in bash?, Zachary Santer, 2024/02/13
- Re: why does </proc/self/environ not work in bash?, Chet Ramey, 2024/02/13
- Re: why does </proc/self/environ not work in bash?, Zachary Santer, 2024/02/13