Re: Bash not escaping escape sequences in directory names

2022-02-02 Thread Lawrence Velázquez
On Wed, Feb 2, 2022, at 9:30 AM, L A Walsh wrote: > Instead of worrying about effects of dirnames on PS1, one might worry > about how the directory names were created in the first place, and then > worry about why one would deliberately 'cd' into such a directory. https://en.wikipedia.org/wiki/Red

Re: Bash not escaping escape sequences in directory names

2022-02-02 Thread L A Walsh
BTW, thinking about how this problem would arise On 2022/01/20 22:43, Lawrence Velázquez wrote: Depends what you consider to be an issue. Personally, I would be less than pleased if my whole terminal turned red just because I changed into a directory that happened to have a weird name. S

Re: Bash not escaping escape sequences in directory names

2022-01-26 Thread Andreas Kusalananda Kähäri
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 '

Re: Bash not escaping escape sequences in directory names

2022-01-26 Thread L A Walsh
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

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread Chet Ramey
On 1/24/22 6:39 PM, Robert Elz wrote: they're a sop to csh users that Korn put in his shell to try and make it more attractive to csh users (of all the things to worry about, this was about the least important), and then which bash copied. That is not true. Bash introduced these. -- ``The

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread konsolebox
On Mon, Jan 24, 2022 at 11:40 PM Robert Elz wrote: > It was just that you replied to Andreas' message (the reply to my message) > but didn't include him in the list of recipients, just me & the list. Well I'm not sure what happened there. I'm using Gmail and I always click the "Reply to all" but

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread Robert Elz
Date:Mon, 24 Jan 2022 23:00:38 + From:konsolebox Message-ID: | It's meant to be a general reply to the thread. It was just that you replied to Andreas' message (the reply to my message) but didn't include him in the list of recipients, just me & the list.

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread konsolebox
On Tue, Jan 25, 2022, 06:24 Robert Elz, wrote: > Date:Tue, 25 Jan 2022 05:45:23 +0800 > From:konsolebox > Message-ID: < > cajnmqwbvrbdijqcu8+oo0gvic7onew8nkv4djfyy3o5eepm...@mail.gmail.com> > > | As for me whatever it is, it should be done consistently and with no

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread Robert Elz
Date:Tue, 25 Jan 2022 05:45:23 +0800 From:konsolebox Message-ID: | As for me whatever it is, it should be done consistently and with no | compromise. I have no idea why you decided to send this message to me (as well as the list), my message was entirely about

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread konsolebox
On Tue, Jan 25, 2022, 05:07 Andreas Kusalananda Kähäri, < andreas.kah...@abc.se> wrote: > On Tue, Jan 25, 2022 at 02:24:26AM +0700, Robert Elz wrote: > > Date:Mon, 24 Jan 2022 19:53:03 +0100 > > From:Andreas Kusalananda =?utf-8?B?S8OkaMOkcmk=?= < > andreas.kah...@abc.se> >

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread Andreas Kusalananda Kähäri
On Tue, Jan 25, 2022 at 02:24:26AM +0700, Robert Elz wrote: > Date:Mon, 24 Jan 2022 19:53:03 +0100 > From:Andreas Kusalananda =?utf-8?B?S8OkaMOkcmk=?= > > Message-ID: > > | Why would people want it to do that (i.e. export PS1)? > > It isn't exporting PS1 that's t

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread Greg Wooledge
On Mon, Jan 24, 2022 at 07:53:03PM +0100, Andreas Kusalananda Kähäri wrote: > I was honestly a bit surprised to see bash picking up PS1 from the > environment. Why would people want it to do that (i.e. export PS1)? It removes the need for bash to re-set it from .bashrc every time a new interactiv

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread Robert Elz
Date:Mon, 24 Jan 2022 19:53:03 +0100 From:Andreas Kusalananda =?utf-8?B?S8OkaMOkcmk=?= Message-ID: | Why would people want it to do that (i.e. export PS1)? It isn't exporting PS1 that's the issue, it is importing it. And that I rely on quite frequently. (Of c

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread Andreas Kusalananda Kähäri
On Mon, Jan 24, 2022 at 10:41:32AM -0500, Chet Ramey wrote: > On 1/22/22 3:48 PM, Andreas Kusalananda Kähäri wrote: > > On Sat, Jan 22, 2022 at 01:28:50PM -0500, Chet Ramey wrote: > > > On 1/22/22 5:52 AM, Andreas Kusalananda Kähäri wrote: > > > > On Fri, Jan 21, 2022 at 06:33:02PM -0500, Chet Rame

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread Chet Ramey
On 1/22/22 3:48 PM, Andreas Kusalananda Kähäri wrote: On Sat, Jan 22, 2022 at 01:28:50PM -0500, Chet Ramey wrote: On 1/22/22 5:52 AM, Andreas Kusalananda Kähäri wrote: On Fri, Jan 21, 2022 at 06:33:02PM -0500, Chet Ramey wrote: On 1/21/22 6:13 PM, Mike Jonkmans wrote: On Fri, Jan 21, 2022 at

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread Chet Ramey
On 1/23/22 6:33 PM, Josh Harcombe wrote: "user-controlled substitutions" was the wrong phrasing I guess, what I meant was I was wondering if this same sanitization principle should be applied to other things that could become part of your prompt while being controlled by someone else, (e.g. pote

Re: Bash not escaping escape sequences in directory names

2022-01-23 Thread Josh Harcombe
> > I will look at doing something here to improve the situation, but I'll push > back on the notion that this is a security issue with bash. > > This is fair. I guess you're concerned with "(along with other user-controlled > substitutions in the prompt)". I'm not entirely sure what the OP > mea

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread Lawrence Velázquez
On Sat, Jan 22, 2022, at 6:10 PM, L A Walsh wrote: > So I would ask which user-controlled prompts are "illegal" such that > they would be sanitized? I guess you're concerned with "(along with other user-controlled substitutions in the prompt)". I'm not entirely sure what the OP meant by that, an

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread L A Walsh
On 2022/01/20 22:20, Lawrence Velázquez wrote: On Fri, Jan 21, 2022, at 12:22 AM, L A Walsh wrote: On 2022/01/18 22:31, Alex fxmbsw7 Ratchev wrote Fix: [sanitizing the prompt]. Sanitizing? What's that? Especially in a way that won't break existing legal usages? Curiou

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread Andreas Kusalananda Kähäri
On Sat, Jan 22, 2022 at 01:28:50PM -0500, Chet Ramey wrote: > On 1/22/22 5:52 AM, Andreas Kusalananda Kähäri wrote: > > On Fri, Jan 21, 2022 at 06:33:02PM -0500, Chet Ramey wrote: > > > On 1/21/22 6:13 PM, Mike Jonkmans wrote: > > > > On Fri, Jan 21, 2022 at 03:29:47PM -0500, Chet Ramey wrote: > >

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread Lawrence Velázquez
On Fri, Jan 21, 2022, at 3:29 PM, Chet Ramey wrote: > On 1/21/22 1:43 AM, Lawrence Velázquez wrote: > >> Personally, I would be >> less than pleased if my whole terminal turned red just because I >> changed into a directory that happened to have a weird name. > > A mild annoyance at best, don't you

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread Chet Ramey
On 1/22/22 5:52 AM, Andreas Kusalananda Kähäri wrote: On Fri, Jan 21, 2022 at 06:33:02PM -0500, Chet Ramey wrote: On 1/21/22 6:13 PM, Mike Jonkmans wrote: On Fri, Jan 21, 2022 at 03:29:47PM -0500, Chet Ramey wrote: On 1/21/22 1:43 AM, Lawrence Velázquez wrote: Personally, I would be less tha

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread Lawrence Velázquez
On Sat, Jan 22, 2022, at 5:57 AM, Andreas Schwab wrote: > On Jan 21 2022, Lawrence Velázquez wrote: > >> Depends what you consider to be an issue. Personally, I would be >> less than pleased if my whole terminal turned red just because I >> changed into a directory that happened to have a weird na

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread Koichi Murase
2022年1月22日(土) 19:54 Andreas Kusalananda Kähäri : > [...] > > Highly unlikely. It would require an implausible scenario. > > Mind if I use that quote? :-) > > Example of interesting values to test in PS1, with discussions: > > https://security.stackexchange.com/q/56307 These cases discussed

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread Andreas Schwab
On Jan 21 2022, Lawrence Velázquez wrote: > Depends what you consider to be an issue. Personally, I would be > less than pleased if my whole terminal turned red just because I > changed into a directory that happened to have a weird name. Put $(tput sgr0) in PS1. -- Andreas Schwab, sch...@linu

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread Andreas Kusalananda Kähäri
On Fri, Jan 21, 2022 at 06:33:02PM -0500, Chet Ramey wrote: > On 1/21/22 6:13 PM, Mike Jonkmans wrote: > > On Fri, Jan 21, 2022 at 03:29:47PM -0500, Chet Ramey wrote: > > > On 1/21/22 1:43 AM, Lawrence Velázquez wrote: > > > > > > > Personally, I would be > > > > less than pleased if my whole term

Re: Bash not escaping escape sequences in directory names

2022-01-21 Thread Chet Ramey
On 1/21/22 6:13 PM, Mike Jonkmans wrote: On Fri, Jan 21, 2022 at 03:29:47PM -0500, Chet Ramey wrote: On 1/21/22 1:43 AM, Lawrence Velázquez wrote: Personally, I would be less than pleased if my whole terminal turned red just because I changed into a directory that happened to have a weird name

Re: Bash not escaping escape sequences in directory names

2022-01-21 Thread Mike Jonkmans
On Fri, Jan 21, 2022 at 03:29:47PM -0500, Chet Ramey wrote: > On 1/21/22 1:43 AM, Lawrence Velázquez wrote: > > > Personally, I would be > > less than pleased if my whole terminal turned red just because I > > changed into a directory that happened to have a weird name. > > A mild annoyance at be

Re: Bash not escaping escape sequences in directory names

2022-01-21 Thread Chet Ramey
On 1/21/22 1:43 AM, Lawrence Velázquez wrote: Personally, I would be less than pleased if my whole terminal turned red just because I changed into a directory that happened to have a weird name. A mild annoyance at best, don't you think? -- ``The lyf so short, the craft so long to lerne.'' -

Re: Bash not escaping escape sequences in directory names

2022-01-21 Thread Chet Ramey
On 1/18/22 9:13 PM, Josh Harcombe wrote: Bash Version: 5.2 Patch Level: !PATCHLEVEL! Release Status: alpha Description: Note: this happens on 5.1 release version as well and probably many other previous versions If a folder that is being displayed as part of the PS1 prompt contains escape seque

Re: Bash not escaping escape sequences in directory names

2022-01-21 Thread Lawrence Velázquez
On Tue, Jan 18, 2022, at 9:13 PM, Josh Harcombe wrote: > If a folder that is being displayed as part of the PS1 prompt contains > escape sequences, bash will interpret them literally instead of escaping > them like zsh does for example. Escape sequences should be fine if directly > part of the prom

Re: Bash not escaping escape sequences in directory names

2022-01-21 Thread Alex fxmbsw7 Ratchev
maybe sub'ing them away, or making it print \\e instead \e On Fri, Jan 21, 2022, 09:24 Lawrence Velázquez wrote: > On Fri, Jan 21, 2022, at 12:22 AM, L A Walsh wrote: > > On 2022/01/18 22:31, Alex fxmbsw7 Ratchev wrote > >>> Fix: > >>> Haven't looked deeply into the bash internals but sanitizing

Re: Bash not escaping escape sequences in directory names

2022-01-21 Thread Lawrence Velázquez
On Fri, Jan 21, 2022, at 12:22 AM, L A Walsh wrote: > On 2022/01/18 22:31, Alex fxmbsw7 Ratchev wrote >>> Fix: >>> Haven't looked deeply into the bash internals but sanitizing the directory >>> name (along with other user-controlled substitutions in the prompt) should >>> work. >>> > Sanitizin

Re: Bash not escaping escape sequences in directory names

2022-01-20 Thread Alex fxmbsw7 Ratchev
i vote for a more generous escape en/disable option On Fri, Jan 21, 2022, 06:23 L A Walsh wrote: > On 2022/01/18 22:31, Alex fxmbsw7 Ratchev wrote > >> Fix: > >> Haven't looked deeply into the bash internals but sanitizing the > directory > >> name (along with other user-controlled substitutions

Re: Bash not escaping escape sequences in directory names

2022-01-20 Thread L A Walsh
On 2022/01/18 22:31, Alex fxmbsw7 Ratchev wrote Fix: Haven't looked deeply into the bash internals but sanitizing the directory name (along with other user-controlled substitutions in the prompt) should work. Sanitizing? What's that? Especially in a way that won't break existing legal usage

Re: Bash not escaping escape sequences in directory names

2022-01-18 Thread Alex fxmbsw7 Ratchev
i wanna add only few here, one i observed and was discussed a bit that is, also in declare -p, *sometimes* control chars arent escaped in my case they were messing terminal up after -p other case other dude, its output was escaped .. On Wed, Jan 19, 2022, 04:35 Josh Harcombe wrote: > Configura

Bash not escaping escape sequences in directory names

2022-01-18 Thread Josh Harcombe
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 uname output: Linux computator 5.10.89-1-MANJARO #1 SMP PREEMPT Wed Dec 29 18:09:17 UTC 2021 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 5