bug-bash
[Top][All Lists]
Advanced

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

Re: Bash not escaping escape sequences in directory names


From: Andreas Kusalananda Kähäri
Subject: Re: Bash not escaping escape sequences in directory names
Date: Wed, 26 Jan 2022 09:55:27 +0100

On Wed, Jan 26, 2022 at 12:26:05AM -0800, L A Walsh wrote:
> On 2022/01/22 12:48, Andreas Kusalananda Kähäri wrote:
> > The shell even keeps the PS1 variable's value from its inherited
> > environment
> > without sanitizing it.
> ----
> 
> 
> This is a requirement of the unix/posix model that has 'fork'
> 
> create a new process that is a new unfiltered, unsanitized copy of the
> original.
> 
> All memory, not just environment vars are exact copies of the
> parent.
> 
> If a child process did not contain an exact copy of its parent after
> a fork, it would be a serious problem.
> 
> What you are insinuating as a  problem "the shell even keeps the PS1
> variable's value from its inherited environment without sanitizing it",
> is a requirement not just for PS1, but all memory.
> 
> If you don't like that feature, you move to an entirely different
> OS -- like 'NT' (at base of windows), where new processes are created
> by a special OS-function that has no automatic importation of anything
> from the previous process.  Everything is created 'anew' with nothing
> in the new process being automatically inherited from the previous process.
> 
> If a shell or any process didn't inherit it's parent's memory, it would be
> a serious error.
> 
> 
> 

You seem to misunderstand my comment, and I'm not entirely sure whether
you choose to do that on purpose to try to make it sound like I don't
know how environment variables work, or if I was genuinely unclear.

Just like IFS is reset to a predefined value for a new shell session
(required to be so by POSIX), so could PS1 be.  In fact, POSIX
explicitly says that "$ " shall be the default value of PS1, but does
not say that it needs to be reset to this value for new shells.

As you may read in other parts of this thread, I'm no longer pursuing
this though.  But for you, I could be convinced to discuss the nature of
environment variables, and the fact that the shell *could* reset the
value of PS1 if it was present in the inherited environment.

-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.



reply via email to

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