Source: pcre2 Version: 10.39-1 Severity: important Tags: patch ftbfs User: debian-h...@lists.debian.org Usertags: hurd
This packages fails to build on hurd-i386 as of version 10.39-1; from the last build log for 10.39-3 [1]: | gcc -DHAVE_CONFIG_H -I. -I./src "-I./src" -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Dregcomp=PCRE2regcomp -Dregexec=PCRE2regexec -Dregerror=PCRE2regerror -Dregfree=PCRE2regfree -c -o src/pcre2grep-pcre2grep.o `test -f 'src/pcre2grep.c' || echo './'`src/pcre2grep.c | src/pcre2grep.c: In function ‘grep_or_recurse’: | src/pcre2grep.c:3365:25: error: ‘PATH_MAX’ undeclared (first use in this function) | 3365 | char resolvedpath[PATH_MAX]; | | ^~~~~~~~ | src/pcre2grep.c:3365:25: note: each undeclared identifier is reported only once for each function it appears in | Makefile:2574: recipe for target 'src/pcre2grep-pcre2grep.o' failed [1] https://buildd.debian.org/status/fetch.php?pkg=pcre2&arch=hurd-i386&ver=10.39-3&stamp=1637168178&raw=0 Attached is a simplistic patch.
--- pcre2-10.39.orig/src/pcre2grep.c +++ pcre2-10.39/src/pcre2grep.c @@ -3362,19 +3362,25 @@ if (isdirectory(pathname)) #ifdef HAVE_REALPATH { - char resolvedpath[PATH_MAX]; + char *resolvedpath; BOOL isSame; size_t rlen; - if (realpath(childpath, resolvedpath) == NULL) + if ((resolvedpath = realpath(childpath, NULL)) == NULL) continue; /* This path is invalid - we can skip processing this */ isSame = strcmp(pathname, resolvedpath) == 0; - if (isSame) continue; /* We have a recursion */ + if (isSame) + { + free(resolvedpath); + continue; /* We have a recursion */ + } rlen = strlen(resolvedpath); - if (rlen++ < sizeof(resolvedpath) - 3) + rlen++; { BOOL contained; + resolvedpath = (char *)realloc(resolvedpath, rlen + 1); strcat(resolvedpath, "/"); contained = strncmp(pathname, resolvedpath, rlen) == 0; + free(resolvedpath); if (contained) continue; /* We have a recursion */ } }