1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-21 00:25:50 +00:00

devel/pkgconf: Import patch to support non-newline-terminated .pc files

It fixes a bug in pkgconf(1) where the last line, if not terminated by a
newline character, would be chopped by one byte. This could lead to
incorrect flags returned by pkgconf(1).

An example is cppunit.pc from devel/cppunit: the cppunit.pc.in, used to
generate cppunit.pc, isn't newline-terminated. Our sed(1) currently adds
a newline to the last line, no matter what the input stream has. But
that's not the case with GNU sed and our sed should be soon fixed too. In
this case, "pkgconf --cflags cppunit" returned "-I" before this fix,
instead of "-I/usr/local/include" now.

This patch is already committed upstream.

Reviewed by:	bapt@
Approved by:	bapt@
Phabric:	https://phabric.freebsd.org/D532
This commit is contained in:
Jean-Sébastien Pédron 2014-08-04 10:00:37 +00:00
parent 743d1f51c0
commit a20c123ba4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=363986
3 changed files with 35 additions and 0 deletions

View File

@ -2,6 +2,7 @@
PORTNAME= pkgconf
PORTVERSION= 0.9.6
PORTREVISION= 1
CATEGORIES= devel
MASTER_SITES= http://rabbit.dereferenced.org/~nenolod/distfiles/ \
http://files.etoilebsd.net/pkgconf/

View File

@ -0,0 +1,23 @@
--- ./fileio.c.orig 2014-06-07 22:32:08.000000000 +0200
+++ ./fileio.c 2014-08-04 11:24:32.522803742 +0200
@@ -83,10 +83,18 @@
}
- *s = '\0';
-
if (c == EOF && (s == line || ferror(stream)))
return NULL;
+ *s = '\0';
+
+ /* Remove newline character. */
+ if (s > line && *(--s) == '\n') {
+ *s = '\0';
+
+ if (s > line && *(--s) == '\r')
+ *s = '\0';
+ }
+
return line;
}

View File

@ -0,0 +1,11 @@
--- ./pkg.c.orig 2014-06-07 22:32:08.000000000 +0200
+++ ./pkg.c 2014-08-04 11:24:32.524802321 +0200
@@ -212,8 +212,6 @@
{
char op, *p, *key, *value;
- readbuf[strlen(readbuf) - 1] = '\0';
-
p = readbuf;
while (*p && (isalpha(*p) || isdigit(*p) || *p == '_' || *p == '.'))
p++;