[Top][All Lists]

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

Re: [PATCH] Fix escaping of \034 (^\) in paths for \w, \W, and \s

From: Koichi Murase
Subject: Re: [PATCH] Fix escaping of \034 (^\) in paths for \w, \W, and \s
Date: Tue, 15 Mar 2022 07:02:31 +0900

2022年3月15日(火) 4:06 Chet Ramey <chet.ramey@case.edu>:
> > Description:
> >
> >    The escaping of the invisible characters in the directory names in
> >    the prompt escapes \w, \W and the path in \s has been implemented in
> >    the function `sh_backslash_quote_for_double_quotes'
> >    (lib/sh/shquote.c:323) in commit b4e5e550.  The primary purpose of
> >    the function `sh_backslash_quote_for_double_quotes' is to quote
> >    special characters in double quotes with a backslash.  When the
> >    escaping of the invisible characters are turned on by the argument
> >    FLAG, a backslash in the visible representation of $'\034', '^\', it
> >    not properly escaped by another backslash.  This may break the
> >    escaping of the succeeding special character.
> I did it this way precisely to avoid two passes through the string. If
> that's not an issue, you can just call sh_strvis and then
> sh_backslash_quote_for_double_quotes on the result.

Thank you for the suggestion. You are right. I have updated patch A
[see attached 0001-fix-prompt-charvis-A.v2.patch]. Or maybe another
option might be to just drop the argument FLAGS from
`sh_backslash_quote_for_double_quotes' and call `sh_strvis' at the
caller side [see another patch C attached as


Attachment: 0001-fix-prompt-charvis-A.v2.patch
Description: Source code patch

Attachment: 0001-fix-prompt-charvis-C.patch
Description: Binary data

reply via email to

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