[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] expanding $'\c^A'
From: |
Grisha Levit |
Subject: |
Re: [PATCH] expanding $'\c^A' |
Date: |
Fri, 13 Oct 2023 09:17:30 -0700 |
On Fri, Oct 13, 2023, 09:13 Chet Ramey <chet.ramey@case.edu> wrote:
> On 10/13/23 12:36 AM, Grisha Levit wrote:
> > Handle $'\c^A' and $'\c^?' correctly when expanded by the parser:
> >
> > $ bash -c $'printf "%q\n" $\'\\c\001 \\c\177\''
> > $'\001\001 \001\177'
> >
> > ---
> > diff --git a/lib/sh/strtrans.c b/lib/sh/strtrans.c
> > index d3b27f3b..3df33ade 100644
> > --- a/lib/sh/strtrans.c
> > +++ b/lib/sh/strtrans.c
> > @@ -198,6 +198,8 @@ ansicstr (const char *string, size_t len, int
> > flags, int *sawc, size_t *rlen)
> > s++;
> > if ((flags & 2) && c == '\\' && c == *s)
> > s++; /* Posix requires $'\c\\' do backslash escaping */
> > + else if ((flags & 2) && c == CTLESC && (*s == CTLESC || *s ==
> CTLNUL))
> > + s++;
>
> It looks like that should be c = *s++.
>
Sorry that's exactly right, just realized I sent the wrong revision.
>