From: Pádraig Brady Date: Wed, 3 Apr 2024 14:46:47 +0000 (+0100) Subject: quotearg: fix shell-escape quoting with single quotes X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=bba154a7aa3a26d6abbf6bd11cb8ac417e43d2da;p=gnulib.git quotearg: fix shell-escape quoting with single quotes With shell-escape quoting, we misquoted strings where the first and last characters required escaping, while the string also contained single quotes. * lib/quotearg.c (quotearg_buffer_restyled): Ensure that pending_shell_escape_end is reset to the initial state when reprocessing input due to single quotes. Reported by Grisha Levit --- diff --git a/ChangeLog b/ChangeLog index 0a198b207f..0388bc0749 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2024-04-03 Pádraig Brady + + quotearg: fix shell-escape quoting with single quotes + With shell-escape quoting, we misquoted strings + where the first and last characters required escaping, + while the string also contained single quotes. + + * lib/quotearg.c (quotearg_buffer_restyled): Ensure that + pending_shell_escape_end is reset to the initial state + when reprocessing input due to single quotes. + Reported by Grisha Levit + 2024-04-02 Pádraig Brady renameatu: handle ENOSYS from renameatx_np diff --git a/lib/quotearg.c b/lib/quotearg.c index 847101e605..5ca511a492 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -260,7 +260,6 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, bool backslash_escapes = false; bool unibyte_locale = MB_CUR_MAX == 1; bool elide_outer_quotes = (flags & QA_ELIDE_OUTER_QUOTES) != 0; - bool pending_shell_escape_end = false; bool encountered_single_quote = false; bool all_c_and_shell_quote_compat = true; @@ -303,7 +302,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, } \ while (0) - process_input: + process_input: ; + bool pending_shell_escape_end = false; switch (quoting_style) {