pkgconf: Handle spaces correctly when expanding variables
ci/woodpecker/push/woodpecker Pipeline failed
Details
ci/woodpecker/push/woodpecker Pipeline failed
Details
Given the following .pc fragment: includedir=/mingw64/include Cflags: -I${includedir} -I${includedir}/taglib Should includedir be assigned the value 'C:/Program\ Files/Git/mingw64/include', the expansion of ${includedir} will be chopped off after the first space: Cflags: -IC:/Program\ With this patch, the expansion is corrected: Cflags: -IC:/Program\ Files/Git/mingw64/include -IC:/Program\ Files/Git/mingw64/include/taglib Create spaces-in-paths.pcpull/249/head
parent
27287f323d
commit
1c3f246198
|
@ -80,7 +80,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
if (escaped)
|
if (escaped)
|
||||||
{
|
{
|
||||||
/* POSIX: only \CHAR is special inside a double quote if CHAR is {$, `, ", \, newline}. */
|
/* POSIX: only \CHAR is special inside a double quote if CHAR is {$, `, ", \, newline}. */
|
||||||
if (quote == '\"')
|
if (quote)
|
||||||
{
|
{
|
||||||
if (!(*src_iter == '$' || *src_iter == '`' || *src_iter == '"' || *src_iter == '\\'))
|
if (!(*src_iter == '$' || *src_iter == '`' || *src_iter == '"' || *src_iter == '\\'))
|
||||||
*dst_iter++ = '\\';
|
*dst_iter++ = '\\';
|
||||||
|
@ -88,7 +88,14 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
*dst_iter++ = *src_iter;
|
*dst_iter++ = *src_iter;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
/* If we are outside a quoted string/char, an escaped space is usually used to
|
||||||
|
preserve spaces in file names. */
|
||||||
|
if (*src_iter != ' ')
|
||||||
|
*dst_iter++ = '\\';
|
||||||
|
|
||||||
*dst_iter++ = *src_iter;
|
*dst_iter++ = *src_iter;
|
||||||
|
}
|
||||||
|
|
||||||
escaped = false;
|
escaped = false;
|
||||||
}
|
}
|
||||||
|
@ -118,11 +125,9 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
}
|
}
|
||||||
else switch(*src_iter)
|
else switch(*src_iter)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
|
||||||
case '\\':
|
case '\\':
|
||||||
escaped = true;
|
escaped = true;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case '\"':
|
case '\"':
|
||||||
case '\'':
|
case '\'':
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
prefix=/test\ with\ spaces
|
||||||
|
includedir=${prefix}/include
|
||||||
|
|
||||||
|
Name: spaces-in-paths
|
||||||
|
Version: 1
|
||||||
|
Description: test package for properly expanding spaces in variables
|
||||||
|
Cflags: -I${includedir} -I${includedir}/subdir
|
Loading…
Reference in New Issue