From 42b355310faa9dff7ed33e557c186ad951018146 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Sat, 30 May 2020 12:39:43 -0600 Subject: [PATCH] fix missing backslashes in paths on Windows According to https://docs.microsoft.com/fr-fr/windows/win32/fileio/naming-a-file backslashes (with slashes) are a path separator, hence must no be considered as an escape code. The first fix, in argvsplit.c, disables this. But because of fragment_quote(), the backslashes are doubled. Hence the second fix in fragment.c With this pc file : prefix=C:/Documents/msys2/opt/efl_64 libdir=${prefix}/lib includedir=${prefix}/include Name: eina Description: efl: eina Version: 1.24.99 Requires.private: iconv Libs: -L${libdir} -leina -pthread -levil Libs.private: -lpsapi -lole32 -lws2_32 -lsecur32 -luuid -lregex -lm Cflags:-I${includedir}/eina-1 -I${includedir}/efl-1 -I${includedir}/eina-1/eina -pthread pkgconf.exe --cflags eina returns : -IC:\Documents\msys2\opt\efl_64/include/eina-1 -IC:\Documents\msys2\opt\efl_64/include/efl-1 -IC:\Documents\msys2\opt\efl_64/include/eina-1/eina -pthread -DWINICONV_CONST= -IC:\Documents\msys2\opt\ewpi_64/include --- libpkgconf/argvsplit.c | 2 ++ libpkgconf/fragment.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libpkgconf/argvsplit.c b/libpkgconf/argvsplit.c index 02ce1a3..aaba858 100644 --- a/libpkgconf/argvsplit.c +++ b/libpkgconf/argvsplit.c @@ -118,9 +118,11 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv) } else switch(*src_iter) { +#ifndef _WIN32 case '\\': escaped = true; break; +#endif case '\"': case '\'': diff --git a/libpkgconf/fragment.c b/libpkgconf/fragment.c index 37830c8..1937f33 100644 --- a/libpkgconf/fragment.c +++ b/libpkgconf/fragment.c @@ -433,7 +433,11 @@ fragment_quote(const pkgconf_fragment_t *frag) (*src > ')' && *src < '+') || (*src > ':' && *src < '=') || (*src > '=' && *src < '@') || - (*src > 'Z' && *src < '^') || + (*src > 'Z' && *src < '\\') || +#ifndef _WIN32 + (*src == '\\') || +#endif + (*src > '\\' && *src < '^') || (*src == '`') || (*src > 'z' && *src < '~') || (*src > '~')))