libpkgconf: argvsplit: fix escape handling in tokenizer (closes #163)

feature/tap-sh
William Pitcock 2017-12-14 22:41:14 -06:00
parent 6073a49229
commit cf96c562e1
3 changed files with 3 additions and 8 deletions

View File

@ -88,12 +88,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
*dst_iter++ = *src_iter;
}
else
{
if (*src_iter == '\\')
*dst_iter++ = '\\';
*dst_iter++ = *src_iter;
}
escaped = false;
}
@ -101,7 +96,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
{
if (*src_iter == quote)
quote = 0;
else if (*src_iter == '\\')
else if (*src_iter == '\\' && quote != '\'')
escaped = true;
else
*dst_iter++ = *src_iter;

View File

@ -405,7 +405,7 @@ fragment_should_quote(const pkgconf_fragment_t *frag)
(*src > 'Z' && *src < '^') ||
(*src == '`') ||
(*src > 'z' && *src < '~') ||
(*src > '~')) && *src != '\\')
(*src > '~')))
return true;
}

View File

@ -118,7 +118,7 @@ escaped_backslash_body()
{
atf_check \
-e ignore \
-o inline:"-IC:\\\\\\\\A \n" \
-o inline:"'-IC:\\A' \n" \
pkgconf --with-path=${selfdir}/lib1 --cflags escaped-backslash
}