pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/59916: pkgtools/plist-utils: plist-sort crash



The following reply was made to PR pkg/59916; it has been noted by GNATS.

From: Rob Whitlock <rwhitlock22%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/59916: pkgtools/plist-utils: plist-sort crash
Date: Wed, 14 Jan 2026 13:11:27 -0500

 This bug is due to plist_getline skipping lines when the line is =
 completely empty but not when the line only contains a newline. (I had =
 ended the last line in the PLIST with a newline, but plist-sort chokes =
 on blank lines in the middle of the file too.) The following patch =
 corrects this.
 
 
 Skip lines that are only a newline, not just empty ones.
 
 Index: files/plist_getline.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /cvsroot/pkgsrc/pkgtools/plist-utils/files/plist_getline.c,v
 retrieving revision 1.3
 diff -u -r1.3 plist_getline.c
 --- files/plist_getline.c	11 May 2021 09:24:17 -0000	1.3
 +++ files/plist_getline.c	14 Jan 2026 17:59:50 -0000
 @@ -51,7 +51,7 @@
 =20
  	if ((buf =3D fgetln(stream, &len)) !=3D NULL) {
  		++lineno;
 -		if (len =3D=3D 0) {
 +		if (len =3D=3D 0 || len =3D=3D 1 && buf[0] =3D=3D '\n') =
 {
  			warnx("Empty line at %zu -- skipped", lineno);
  			goto repeat;
  		}
 


Home | Main Index | Thread Index | Old Index