texlive[53454] Build/source/texk/kpathsea: drop NUL (zero) bytes in
commits+karl at tug.org
commits+karl at tug.org
Sun Jan 19 18:04:03 CET 2020
Revision: 53454
http://tug.org/svn/texlive?view=revision&revision=53454
Author: karl
Date: 2020-01-19 18:04:02 +0100 (Sun, 19 Jan 2020)
Log Message:
-----------
drop NUL (zero) bytes in texmf.cnf and other files read by kpse
Modified Paths:
--------------
trunk/Build/source/texk/kpathsea/ChangeLog
trunk/Build/source/texk/kpathsea/Makefile.am
trunk/Build/source/texk/kpathsea/Makefile.in
trunk/Build/source/texk/kpathsea/line.c
Added Paths:
-----------
trunk/Build/source/texk/kpathsea/tests/cnfnull.test
Modified: trunk/Build/source/texk/kpathsea/ChangeLog
===================================================================
--- trunk/Build/source/texk/kpathsea/ChangeLog 2020-01-19 00:54:27 UTC (rev 53453)
+++ trunk/Build/source/texk/kpathsea/ChangeLog 2020-01-19 17:04:02 UTC (rev 53454)
@@ -1,3 +1,10 @@
+2020-01-19 Karl Berry <karl at freefriends.org>
+
+ * line.c (read_line): silently drop nul (zero) bytes.
+ * tests/cnfnull.test: test for nul bytes in texmf.cnf.
+ * Makefile.am (TESTS),
+ (tests/cnfnull.test): add it.
+
2020-01-16 Karl Berry <karl at freefriends.org>
* doc/kpathsea.texi,
Modified: trunk/Build/source/texk/kpathsea/Makefile.am
===================================================================
--- trunk/Build/source/texk/kpathsea/Makefile.am 2020-01-19 00:54:27 UTC (rev 53453)
+++ trunk/Build/source/texk/kpathsea/Makefile.am 2020-01-19 17:04:02 UTC (rev 53454)
@@ -275,11 +275,12 @@
AM_TESTS_ENVIRONMENT = LN_S='$(LN_S)'; export LN_S;
AM_TESTS_ENVIRONMENT += LT_OBJDIR='$(LT_OBJDIR)'; export LT_OBJDIR;
#
-TESTS = tests/cnfline.test tests/cnfnewline.test tests/cnfprog.test
+TESTS = tests/cnfline.test tests/cnfnewline.test
+TESTS += tests/cnfnull.test tests/cnfprog.test
TESTS += tests/kpseaccess.test
TESTS += tests/kpsereadlink.test tests/kpsestat.test tests/kpsewhich.test
#
-tests/cnfline.log tests/cnfnewline.log tests/cnfprog.log \
+tests/cnfline.log tests/cnfnewline.log tests/cnfnull.log tests/cnfprog.log \
tests/kpsewhich.log: kpsewhich$(EXEEXT)
tests/kpseaccess.log: kpseaccess$(EXEEXT)
tests/kpsereadlink.log: kpsereadlink$(EXEEXT)
Modified: trunk/Build/source/texk/kpathsea/Makefile.in
===================================================================
--- trunk/Build/source/texk/kpathsea/Makefile.in 2020-01-19 00:54:27 UTC (rev 53453)
+++ trunk/Build/source/texk/kpathsea/Makefile.in 2020-01-19 17:04:02 UTC (rev 53454)
@@ -858,9 +858,10 @@
AM_TESTS_ENVIRONMENT = LN_S='$(LN_S)'; export LN_S; \
LT_OBJDIR='$(LT_OBJDIR)'; export LT_OBJDIR;
#
-TESTS = tests/cnfline.test tests/cnfnewline.test tests/cnfprog.test \
- tests/kpseaccess.test tests/kpsereadlink.test \
- tests/kpsestat.test tests/kpsewhich.test
+TESTS = tests/cnfline.test tests/cnfnewline.test tests/cnfnull.test \
+ tests/cnfprog.test tests/kpseaccess.test \
+ tests/kpsereadlink.test tests/kpsestat.test \
+ tests/kpsewhich.test
# Rebuild
rebuild_prereq =
@@ -2422,7 +2423,7 @@
else :; fi; \
done
#
-tests/cnfline.log tests/cnfnewline.log tests/cnfprog.log \
+tests/cnfline.log tests/cnfnewline.log tests/cnfnull.log tests/cnfprog.log \
tests/kpsewhich.log: kpsewhich$(EXEEXT)
tests/kpseaccess.log: kpseaccess$(EXEEXT)
tests/kpsereadlink.log: kpsereadlink$(EXEEXT)
Modified: trunk/Build/source/texk/kpathsea/line.c
===================================================================
--- trunk/Build/source/texk/kpathsea/line.c 2020-01-19 00:54:27 UTC (rev 53453)
+++ trunk/Build/source/texk/kpathsea/line.c 2020-01-19 17:04:02 UTC (rev 53454)
@@ -1,6 +1,6 @@
/* line.c: return the next line from a file, or NULL.
- Copyright 1992, 1993, 1995, 1996, 2008, 2013, 2014 Karl Berry.
+ Copyright 1992, 1993, 1995, 1996, 2008, 2013, 2014, 2020 Karl Berry.
Copyright 1998, 1999, 2001, 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -55,6 +55,11 @@
FLOCKFILE (f);
while ((c = getc (f)) != EOF && c != '\n' && c != '\r') {
+ /* Silently drop null bytes. */
+ if (c == 0) {
+ continue;
+ }
+
line[loc] = c;
loc++;
Added: trunk/Build/source/texk/kpathsea/tests/cnfnull.test
===================================================================
--- trunk/Build/source/texk/kpathsea/tests/cnfnull.test (rev 0)
+++ trunk/Build/source/texk/kpathsea/tests/cnfnull.test 2020-01-19 17:04:02 UTC (rev 53454)
@@ -0,0 +1,23 @@
+#!/bin/sh -vx
+# $Id$
+# Copyright 2020 Karl Berry <tex-live at tug.org>
+# You may freely use, modify and/or distribute this file.
+#
+# Test nul (zero) bytes in texmf.cnf.
+
+cnf_dir=cnfnull
+cnf_file=$cnf_dir/texmf.cnf
+
+# Create the texmf.cnf dynamically so we don't have to check in a file
+# containing nul bytes.
+rm -rf $cnf_dir
+mkdir $cnf_dir
+test -d $cnf_dir || exit 1
+printf 'x\0=1\n\0' >$cnf_file || exit 1
+
+val=`./kpsewhich "--cnf-line=TEXMFCNF=$cnf_dir" --var-value=x`
+test x"$val" = x1 || exit 1
+
+# Before we dropped nul bytes in 2020, kpse gave a warning:
+# warning: cnfnull/texmf.cnf:1: (kpathsea) No cnf value on line: x.
+# and did not assign anything (since the string ended with the x).
Property changes on: trunk/Build/source/texk/kpathsea/tests/cnfnull.test
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
More information about the tex-live-commits
mailing list