Compare commits

..

2 Commits

Author SHA1 Message Date
Dylan Baker 6de71767ab fragment: Mingw needs to use POSIX handling for `\\`
Otherwise it won't correctly escape things like spaces, and can print
out the `\` literal escaping nothing, which causes most shell lexers to
choke.

Fixes: #238
2023-06-05 14:39:27 -07:00
Dylan Baker 5c545fc9dc tests: Add a test for an escaped space 2023-06-05 11:52:47 -07:00
4 changed files with 14 additions and 1 deletions

View File

@ -95,6 +95,7 @@ EXTRA_DIST = pkg.m4 \
tests/lib1/metapackage-2.pc \ tests/lib1/metapackage-2.pc \
tests/lib1/explicit-sysroot.pc \ tests/lib1/explicit-sysroot.pc \
tests/lib1/escaped-backslash.pc \ tests/lib1/escaped-backslash.pc \
tests/lib1/escaped-space.pc \
tests/lib1/cflags-internal.pc \ tests/lib1/cflags-internal.pc \
tests/lib1/requires-internal.pc \ tests/lib1/requires-internal.pc \
tests/lib1/requires-internal-2.pc \ tests/lib1/requires-internal-2.pc \

View File

@ -438,7 +438,7 @@ fragment_quote(const pkgconf_fragment_t *frag)
(*src > ':' && *src < '=') || (*src > ':' && *src < '=') ||
(*src > '=' && *src < '@') || (*src > '=' && *src < '@') ||
(*src > 'Z' && *src < '\\') || (*src > 'Z' && *src < '\\') ||
#ifndef _WIN32 #if !defined(_WIN32) && !defined(__MINGW32__)
(*src == '\\') || (*src == '\\') ||
#endif #endif
(*src > '\\' && *src < '^') || (*src > '\\' && *src < '^') ||

View File

@ -0,0 +1,4 @@
Name: escaped-space
Version: 1
Description: test package for backslash escape of spaces
Cflags: -IC:\\A\ space

View File

@ -138,6 +138,14 @@ escaped_backslash_body()
pkgconf --with-path=${selfdir}/lib1 --cflags escaped-backslash pkgconf --with-path=${selfdir}/lib1 --cflags escaped-backslash
} }
escaped_space_body()
{
atf_check \
-e ignore \
-o inline:"-IC:\\\\\\\\A space\n" \
pkgconf --with-path=${selfdir}/lib1 --cflags escaped-space
}
quoted_body() quoted_body()
{ {
export PKG_CONFIG_PATH="${selfdir}/lib1" export PKG_CONFIG_PATH="${selfdir}/lib1"