diff options
author | Karl Berry <karl@freefriends.org> | 2013-08-06 23:52:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-08-06 23:52:15 +0000 |
commit | 6f855519650fde622bd6326b68315d8cf2650380 (patch) | |
tree | ef13638aa742c62c26c2964c2b3ff8b166b188a9 /Build | |
parent | a2703f81b605770555f3b6ff889723fb17d15c25 (diff) |
do not ignore text on a non-terminated final line, plus new test; move all kpse tests to subdir
git-svn-id: svn://tug.org/texlive/trunk@31370 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/kpathsea/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/Makefile.am | 4 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/Makefile.in | 7 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/line.c | 15 | ||||
-rwxr-xr-x | Build/source/texk/kpathsea/tests/cnfnewline.test | 16 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/tests/cnfnewline/texmf.cnf | 1 | ||||
-rwxr-xr-x | Build/source/texk/kpathsea/tests/kpseaccess.test (renamed from Build/source/texk/kpathsea/kpseaccess.test) | 0 | ||||
-rwxr-xr-x | Build/source/texk/kpathsea/tests/kpsereadlink.test (renamed from Build/source/texk/kpathsea/kpsereadlink.test) | 0 | ||||
-rwxr-xr-x | Build/source/texk/kpathsea/tests/kpsestat.test (renamed from Build/source/texk/kpathsea/kpsestat.test) | 0 | ||||
-rwxr-xr-x | Build/source/texk/kpathsea/tests/kpsewhich.test (renamed from Build/source/texk/kpathsea/kpsewhich.test) | 0 |
10 files changed, 40 insertions, 10 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index a86834b3847..4937bbdb3e7 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,5 +1,12 @@ 2013-08-07 Karl Berry <karl@tug.org> + * line.c (read_line): only at EOF if loc==0, i.e., do not ignore a + non-terminated last "line" of a file; distressingly common on Windows. + * Makefile.am (TESTS): add cnfnewline.test; + move all *.test to tests/ subdir. + (EXTRA_DIST): add tests/cnfnewline/texmf.cnf, a file without a + final newline. + * kpsewhich.test: also check that we can read the environment variable that we set. diff --git a/Build/source/texk/kpathsea/Makefile.am b/Build/source/texk/kpathsea/Makefile.am index 029fe0cd950..46e103d41eb 100644 --- a/Build/source/texk/kpathsea/Makefile.am +++ b/Build/source/texk/kpathsea/Makefile.am @@ -303,9 +303,11 @@ install-exec-hook: install-bin-links uninstall-hook: uninstall-bin-links ## The tests -TESTS = kpseaccess.test kpsereadlink.test kpsestat.test kpsewhich.test +TESTS = tests/cnfnewline.test tests/kpseaccess.test +TESTS += tests/kpsereadlink.test tests/kpsestat.test tests/kpsewhich.test TESTS_ENVIRONMENT = LN_S='$(LN_S)' LT_OBJDIR='$(LT_OBJDIR)' EXTRA_DIST += $(TESTS) +EXTRA_DIST += tests/cnfnewline/texmf.cnf # Rebuild rebuild_prereq = diff --git a/Build/source/texk/kpathsea/Makefile.in b/Build/source/texk/kpathsea/Makefile.in index 97fbc457996..ea6bb2b27ec 100644 --- a/Build/source/texk/kpathsea/Makefile.in +++ b/Build/source/texk/kpathsea/Makefile.in @@ -682,7 +682,8 @@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I ../../m4 SUBDIRS = . doc man $(am__append_6) EXTRA_DIST = BUGS PROJECTS putenv.c strcasecmp.c strtol.c strstr.c \ - bsnl.awk cnf-to-paths.awk $(TESTS) mktex.cnf + bsnl.awk cnf-to-paths.awk $(TESTS) tests/cnfnewline/texmf.cnf \ + mktex.cnf AM_CPPFLAGS = -I$(top_builddir)/.. -I$(top_srcdir)/.. AM_CFLAGS = $(WARNING_CFLAGS) lib_LTLIBRARIES = libkpathsea.la @@ -781,7 +782,9 @@ dist_web2c_DATA = mktex.opt mktexdir.opt mktexnam.opt dist_noinst_SCRIPTS = mktexlsr mktexmf mktexpk mktextfm dist_noinst_DATA = texmf.cnf bin_links = mktexlsr:texhash -TESTS = kpseaccess.test kpsereadlink.test kpsestat.test kpsewhich.test +TESTS = tests/cnfnewline.test tests/kpseaccess.test \ + tests/kpsereadlink.test tests/kpsestat.test \ + tests/kpsewhich.test TESTS_ENVIRONMENT = LN_S='$(LN_S)' LT_OBJDIR='$(LT_OBJDIR)' # Rebuild diff --git a/Build/source/texk/kpathsea/line.c b/Build/source/texk/kpathsea/line.c index 9d8e4e9eb13..c26303a3012 100644 --- a/Build/source/texk/kpathsea/line.c +++ b/Build/source/texk/kpathsea/line.c @@ -43,11 +43,15 @@ read_line (FILE *f) } } - /* If we read anything, return it. This can't represent a last - ``line'' which doesn't end in a newline, but so what. */ - if (c != EOF) { + /* If we read anything, return it, even a partial last-line-if-file + which is not properly terminated. */ + if (loc == 0 && c == EOF) { + /* At end of file. */ + free (line); + line = NULL; + } else { /* Terminate the string. We can't represent nulls in the file, - either. Again, it doesn't matter. */ + but this doesn't matter. */ line[loc] = 0; /* Absorb LF of a CRLF pair. */ if (c == '\r') { @@ -56,9 +60,6 @@ read_line (FILE *f) ungetc (c, f); } } - } else { /* At end of file. */ - free (line); - line = NULL; } return line; diff --git a/Build/source/texk/kpathsea/tests/cnfnewline.test b/Build/source/texk/kpathsea/tests/cnfnewline.test new file mode 100755 index 00000000000..d1e64d7d6ad --- /dev/null +++ b/Build/source/texk/kpathsea/tests/cnfnewline.test @@ -0,0 +1,16 @@ +#!/bin/sh +# Copyright 2013 Peter Breitenlohner <tex-live@tug.org> +# You may freely use, modify and/or distribute this file. + +TEXMFCNF=$srcdir/tests/cnfnewline; export TEXMFCNF + +val=`./kpsewhich --debug=-1 --var-value=lastvar` +test x"$val" = xlastval || exit 1 + +# verbose for testing. +#if test x"$val" = xlastval; then +# echo "$0: ok" +#else +# echo "$0: bad, got \`$val'" +# exit 1 +#fi diff --git a/Build/source/texk/kpathsea/tests/cnfnewline/texmf.cnf b/Build/source/texk/kpathsea/tests/cnfnewline/texmf.cnf new file mode 100644 index 00000000000..a3a189023f4 --- /dev/null +++ b/Build/source/texk/kpathsea/tests/cnfnewline/texmf.cnf @@ -0,0 +1 @@ +lastvar = lastval # with comment, but no final newline
\ No newline at end of file diff --git a/Build/source/texk/kpathsea/kpseaccess.test b/Build/source/texk/kpathsea/tests/kpseaccess.test index 5006bcf1afa..5006bcf1afa 100755 --- a/Build/source/texk/kpathsea/kpseaccess.test +++ b/Build/source/texk/kpathsea/tests/kpseaccess.test diff --git a/Build/source/texk/kpathsea/kpsereadlink.test b/Build/source/texk/kpathsea/tests/kpsereadlink.test index 7770a00bd03..7770a00bd03 100755 --- a/Build/source/texk/kpathsea/kpsereadlink.test +++ b/Build/source/texk/kpathsea/tests/kpsereadlink.test diff --git a/Build/source/texk/kpathsea/kpsestat.test b/Build/source/texk/kpathsea/tests/kpsestat.test index 8e1cf8526a4..8e1cf8526a4 100755 --- a/Build/source/texk/kpathsea/kpsestat.test +++ b/Build/source/texk/kpathsea/tests/kpsestat.test diff --git a/Build/source/texk/kpathsea/kpsewhich.test b/Build/source/texk/kpathsea/tests/kpsewhich.test index b15f2b35400..b15f2b35400 100755 --- a/Build/source/texk/kpathsea/kpsewhich.test +++ b/Build/source/texk/kpathsea/tests/kpsewhich.test |