The problem seems to be not treating a single quote that follows a backslash as the end of a single-quoted string.
diff --git a/bashline.c b/bashline.c index 774f813f..b1837d43 100644 --- a/bashline.c +++ b/bashline.c @@ -4077,15 +4077,13 @@ bash_dequote_filename (char *text, int quote_char) ret = (char *)xmalloc (l + 1); for (quoted = quote_char, p = text, r = ret; p && *p; p++) { - /* Allow backslash-escaped characters to pass through unscathed. */ - if (*p == '\\') + /* Allow backslash-escaped characters to pass through unscathed, + unless in single quotes */ + if (quoted != '\'' && *p == '\\') { - /* Backslashes are preserved within single quotes. */ - if (quoted == '\'') - *r++ = *p; /* Backslashes are preserved within double quotes unless the character is one that is defined to be escaped */ - else if (quoted == '"' && ((sh_syntaxtab[(unsigned char)p[1]] & CBSDQUOTE) == 0)) + if (quoted == '"' && ((sh_syntaxtab[(unsigned char)p[1]] & CBSDQUOTE) == 0)) *r++ = *p; *r++ = *++p;