diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-04-23 13:07:21 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-04-23 13:07:21 +0000 |
commit | d64e27494d29684b840753c87fc3e8a5b6ec3694 (patch) | |
tree | d111d1c03bf74ddb42039b778e338787ba176ee5 /Build/source/texk | |
parent | 57c7d41397ed1ec0e244316a88a33bd2b0324ec1 (diff) |
more pTeX fixes
git-svn-id: svn://tug.org/texlive/trunk@17974 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/web2c/Makefile.in | 50 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/ChangeLog | 9 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/am/ptex.am | 9 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/kanji.h | 4 | ||||
-rwxr-xr-x | Build/source/texk/web2c/ptexdir/pbibtex-longline-test.pl | 38 | ||||
-rwxr-xr-x | Build/source/texk/web2c/ptexdir/pbibtex-mem.test | 69 | ||||
-rwxr-xr-x | Build/source/texk/web2c/ptexdir/pbibtex-openout-test.pl | 22 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/pbibtex.ch | 13 | ||||
-rwxr-xr-x | Build/source/texk/web2c/ptexdir/pbibtex.test | 14 | ||||
-rw-r--r-- | Build/source/texk/web2c/web2c/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/web2c/fixwrites.c | 3 |
11 files changed, 205 insertions, 30 deletions
diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in index d3ce571193a..91dcd7b7d96 100644 --- a/Build/source/texk/web2c/Makefile.in +++ b/Build/source/texk/web2c/Makefile.in @@ -1231,6 +1231,7 @@ EXTRA_DIST = PROJECTS cftests config.h cpascal.h help.h triptrap-sh \ ptexdir/pdvitype.ch ptexdir/ppltotf.ch ptexdir/ptftopl.ch \ ptexdir/COPYRIGHT ptexdir/COPYRIGHT.jis ptexdir/ChangeLog \ ptexdir/Changes.txt ptexdir/INSTALL.txt ptexdir/README.txt \ + tests/memdata1.bst tests/memdata2.bst tests/memdata3.bst \ ptexdir/ptrip.diffs ptexdir/Files ptexdir/pbibtex.defines \ ptexdir/ptex.mk ptexdir/ptex-base.ch.orig \ ptexdir/ptex-include.ch ptexdir/ptexhelp.h ptexdir/reautoconf \ @@ -1409,25 +1410,26 @@ DISTCLEANFILES = $(EXTRA_LIBRARIES) tangle.c tangle.h tangle.p \ $(pweb_programs:=.c) $(pweb_programs:=.h) $(pweb_programs:=.p) \ $(pweb_programs:=-web2c) $(pweb_programs:=.web) \ $(nodist_ptex_SOURCES) ptex.web ptex.ch ptex-web2c ptex.p \ - ptex.pool ptex-tangle ptexdir/ptex.version tests/xstory.dvityp \ - tests/xpagenum.typ tests/xcmr10.tfm tests/xcmr10.pl \ - ptrip.diffs $(nodist_pdftex_SOURCES) pdftex.ch pdftex-web2c \ - pdftex.p pdftex.pool pdftex-tangle pdftexdir/pdftex.version \ - pdftexdir/etex.version $(nodist_libluatex_a_SOURCES) \ - $(nodist_xetex_SOURCES) xetex.web xetex-web2c xetex.p \ - xetex.pool xetex-tangle xetexdir/etex.version \ - xetexdir/xetex.version $(omegaware_programs:=.c) \ - $(omegaware_programs:=.h) $(omegaware_programs:=.p) \ - $(omegaware_programs:=-web2c) omegaware/tests/xlevel1.ofm \ - omegaware/tests/xlevel1.opl ofont*vf omegaware/tests/xofont* \ - omegaware/tests/Cherokee.tfm omegaware/tests/OCherokee.ofm \ - omegaware/tests/OCherokee.opl omegaware/tests/OCherokee.ovf \ - omegaware/tests/xCherokee.* omegaware/tests/xOCherokee.* \ - cftest.p omegaware/tests/xrepeated.* \ - omegaware/tests/specialhex.ofm omegaware/tests/specialhex.opl \ - omegaware/tests/specialhex.ovf omegaware/tests/xspecialhex.* \ - $(nodist_aleph_SOURCES) aleph.web aleph.ch aleph-web2c aleph.p \ - aleph.pool aleph-tangle + ptex.pool ptex-tangle ptexdir/ptex.version tests/xexampl.aux \ + tests/xexampl.bbl tests/xexampl.blg tests/memtest* \ + tests/xstory.dvityp tests/xpagenum.typ tests/xcmr10.tfm \ + tests/xcmr10.pl ptrip.diffs $(nodist_pdftex_SOURCES) pdftex.ch \ + pdftex-web2c pdftex.p pdftex.pool pdftex-tangle \ + pdftexdir/pdftex.version pdftexdir/etex.version \ + $(nodist_libluatex_a_SOURCES) $(nodist_xetex_SOURCES) \ + xetex.web xetex-web2c xetex.p xetex.pool xetex-tangle \ + xetexdir/etex.version xetexdir/xetex.version \ + $(omegaware_programs:=.c) $(omegaware_programs:=.h) \ + $(omegaware_programs:=.p) $(omegaware_programs:=-web2c) \ + omegaware/tests/xlevel1.ofm omegaware/tests/xlevel1.opl \ + ofont*vf omegaware/tests/xofont* omegaware/tests/Cherokee.tfm \ + omegaware/tests/OCherokee.ofm omegaware/tests/OCherokee.opl \ + omegaware/tests/OCherokee.ovf omegaware/tests/xCherokee.* \ + omegaware/tests/xOCherokee.* cftest.p \ + omegaware/tests/xrepeated.* omegaware/tests/specialhex.ofm \ + omegaware/tests/specialhex.opl omegaware/tests/specialhex.ovf \ + omegaware/tests/xspecialhex.* $(nodist_aleph_SOURCES) \ + aleph.web aleph.ch aleph-web2c aleph.p aleph.pool aleph-tangle CLEANFILES = TRIPTRAP = $(am__append_6) $(am__append_9) $(am__append_15) \ $(am__append_19) $(am__append_24) @@ -1625,12 +1627,10 @@ pweb_programs = pbibtex pdvitype ppltotf ptftopl # pTeX Tests # -ptex_tests = \ - ptexdir/pdvitype.test \ - ptexdir/ppltotf.test \ - ptexdir/ptftopl.test \ - ptexdir/ptrip.test - +ptex_tests = ptexdir/pbibtex.test ptexdir/pdvitype.test \ + ptexdir/ppltotf.test ptexdir/ptftopl.test ptexdir/ptrip.test \ + ptexdir/pbibtex-openout-test.pl \ + ptexdir/pbibtex-longline-test.pl ptexdir/pbibtex-mem.test pproglib = lib/libp.a ptex_CPPFLAGS = $(ptex_cppflags) ptex_CFLAGS = $(WARNING_CFLAGS) diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog index 588ea2908ce..ce52dcdf827 100644 --- a/Build/source/texk/web2c/ptexdir/ChangeLog +++ b/Build/source/texk/web2c/ptexdir/ChangeLog @@ -1,3 +1,12 @@ +2010-04-23 Peter Breitenlohner <peb@mppmu.mpg.de> + + * pbibtex.ch, kanji.h: Use input_line2() with five arguments + for correct handling of buffer_overflow. + + * pbibtex-longline-test.pl, pbibtex-openout-test.pl, + pbibtex-mem.test, pbibtex.test: New tests. + * am/ptex.am: Add them. + 2010-04-22 Peter Breitenlohner <peb@mppmu.mpg.de> * pdvitype.ch: Remove unnecessary change. diff --git a/Build/source/texk/web2c/ptexdir/am/ptex.am b/Build/source/texk/web2c/ptexdir/am/ptex.am index 14cb8361c65..d621d079cca 100644 --- a/Build/source/texk/web2c/ptexdir/am/ptex.am +++ b/Build/source/texk/web2c/ptexdir/am/ptex.am @@ -12,6 +12,7 @@ pweb_programs = pbibtex pdvitype ppltotf ptftopl # pTeX Tests # ptex_tests = \ + ptexdir/pbibtex.test \ ptexdir/pdvitype.test \ ptexdir/ppltotf.test \ ptexdir/ptftopl.test \ @@ -118,6 +119,9 @@ pbibtex.web: tie$(EXEEXT) bibtex.web bibtex.ch $(tie) -m pbibtex.web bibtex.web bibtex.ch EXTRA_DIST += ptexdir/pbibtex.ch web2c/cvtbib.sed +ptex_tests += ptexdir/pbibtex-openout-test.pl ptexdir/pbibtex-longline-test.pl +ptex_tests += ptexdir/pbibtex-mem.test + ## pDVItype ## nodist_pdvitype_SOURCES = pdvitype.c pdvitype.h @@ -183,6 +187,11 @@ endif PTEX ## Test data and results ## +## ptexdir/pbibtex.test +DISTCLEANFILES += tests/xexampl.aux tests/xexampl.bbl tests/xexampl.blg +## ptexdir/pbibtex-mem.test +EXTRA_DIST += tests/memdata1.bst tests/memdata2.bst tests/memdata3.bst +DISTCLEANFILES += tests/memtest* ## ptexdir/pdvitype.test DISTCLEANFILES += tests/xstory.dvityp tests/xpagenum.typ ## ptexdir/ppltotf.test diff --git a/Build/source/texk/web2c/ptexdir/kanji.h b/Build/source/texk/web2c/ptexdir/kanji.h index 6d514f6bdc7..901c5903c72 100644 --- a/Build/source/texk/web2c/ptexdir/kanji.h +++ b/Build/source/texk/web2c/ptexdir/kanji.h @@ -30,7 +30,11 @@ extern integer kcatcodekey(integer c); #define putc(c,fp) putc2(c,fp) #endif /* !PRESERVE_PUTC */ +#ifdef PBIBTEX +#define inputline2(fp,buff,pos,size,ptr) input_line2(fp,buff,pos,size,ptr) +#else #define inputline2(fp,buff,pos,size) input_line2(fp,buff,pos,size,NULL) +#endif #ifdef MP #undef TEXMFPOOLNAME diff --git a/Build/source/texk/web2c/ptexdir/pbibtex-longline-test.pl b/Build/source/texk/web2c/ptexdir/pbibtex-longline-test.pl new file mode 100755 index 00000000000..a7db4dadea6 --- /dev/null +++ b/Build/source/texk/web2c/ptexdir/pbibtex-longline-test.pl @@ -0,0 +1,38 @@ +#!/usr/bin/env perl +# $Id: pbibtex-openout-test.pl 17085 2010-02-18 18:03:18Z karl $ +# Public domain. Originally written 2010, Karl Berry. +# Check that pbibtex does not break long strings (change in 2010). + +# srcdir = web2c (in the source tree) +BEGIN { chomp ($srcdir = $ENV{"srcdir"} || `cd \`dirname $0\`/.. && pwd`); } +require "$srcdir/../tests/common-test.pl"; + +exit (&main ()); + +sub main +{ + # The blg and bbl file names are based on the aux name and cannot be + # overridden. We can't write to the aux (source) directory, though, + # because that's an absolute path and openout_any=p. Therefore, copy + # the input files to our working directory. + for my $ext ("aux", "bib") { + &test_file_copy ("$srcdir/tests/longline.$ext", "./longline.$ext"); + } + + # Run pBibTeX, quit if it fails. + my $ret = &test_run ("./pbibtex", "./longline.aux"); + return 1 if $ret != 0; + + # There should be lines longer than 80 chars in the output. + # (In older versions of pBibTeX, they are forcibly split, with a %.) + local *IN; + $IN = "longline.bbl"; + open (IN) || die "open($IN) failed: $!"; + while (<IN>) { + last if length ($_) >= 80; + } + + # We failed if all lines were < 80. + my $bad = ! (length $_ >= 80); + return $bad; +} diff --git a/Build/source/texk/web2c/ptexdir/pbibtex-mem.test b/Build/source/texk/web2c/ptexdir/pbibtex-mem.test new file mode 100755 index 00000000000..69773b5f751 --- /dev/null +++ b/Build/source/texk/web2c/ptexdir/pbibtex-mem.test @@ -0,0 +1,69 @@ +#! /bin/sh + +# Copyright (C) 2010 Peter Breitenlohner <tex-live@tug.org> +# You may freely use, modify and/or distribute this file. + +# Using test data from Philipp Lehman <lehman@gmx.net> + +test -d tests || mkdir -p tests + +# Create bib data +mk_bib () { + for i + do + for j in 0 1 2 3 4 5 6 7 8 9; do + for k in 0 1 2 3 4 5 6 7 8 9; do + for l in 0 1 2 3 4 5 6 7 8 9; do + cat <<EOF +@Type{key$i$j$k$l, + field001 = {Value 001}, + field002 = {Value 002}, + field003 = {Value 003}, + field004 = {Value 004}, + field005 = {Value 005}, + field006 = {Value 006}, + field007 = {Value 007}, + field008 = {Value 008}, + field009 = {Value 009}, + field010 = {Value 010} +} + +EOF + done + done + done + done +} + +# Create aux data +mk_aux () { + cat <<EOF +\relax +\citation{*} +\bibstyle{$1} +\bibdata{memtest} +EOF +} + +for t in 1 2 3; do + + mk_aux memdata$t >tests/memtest$t.aux + + env= + + case $t in + 1) mk_bib 0 >tests/memtest.bib;; + 2) mk_bib 1 >>tests/memtest.bib;; + 3) env='ent_str_size=2000 glob_str_size=2000';; + esac + + echo "Running memtest$t ..." + + eval $env \ + TEXMFCNF=$srcdir/../kpathsea \ + BSTINPUTS=$srcdir/tests \ + BIBINPUTS=./tests \ + ./pbibtex tests/memtest$t || exit 1 + +done + diff --git a/Build/source/texk/web2c/ptexdir/pbibtex-openout-test.pl b/Build/source/texk/web2c/ptexdir/pbibtex-openout-test.pl new file mode 100755 index 00000000000..c733f60b691 --- /dev/null +++ b/Build/source/texk/web2c/ptexdir/pbibtex-openout-test.pl @@ -0,0 +1,22 @@ +#!/usr/bin/env perl +# $Id: pbibtex-openout-test.pl 17384 2010-03-08 18:49:47Z karl $ +# Public domain. Originally written 2010, Karl Berry. +# Check that pbibtex respects openout_any. + +# srcdir = web2c (in the source tree) +BEGIN { chomp ($srcdir = $ENV{"srcdir"} || `cd \`dirname $0\`/.. && pwd`); } +require "$srcdir/../tests/common-test.pl"; + +exit (&main ()); + +sub main +{ + $ENV{"openout_any"} = "p"; # should already be in texmf.cnf, but ... + + # .blg open of abs path should fail: + my $ret = &test_run ("./pbibtex", "$srcdir/exampl.aux"); + + # The test fails if the program succeeded. Could also check the output. + my $bad = ($ret == 0); + return $bad; +} diff --git a/Build/source/texk/web2c/ptexdir/pbibtex.ch b/Build/source/texk/web2c/ptexdir/pbibtex.ch index c2f36651dda..fae1c10b497 100644 --- a/Build/source/texk/web2c/ptexdir/pbibtex.ch +++ b/Build/source/texk/web2c/ptexdir/pbibtex.ch @@ -188,6 +188,12 @@ for i:=@'240 to 254 do char_width[i]:=514; @z @x [48] JBibTeX and dynamic buf_size. +label loop_exit; +@y +label loop_exit; +var i:c_int_type; +@z +@x [still 48] JBibTeX and dynamic buf_size. while (not eoln(f)) do begin if (last >= buf_size) then @@ -197,12 +203,11 @@ for i:=@'240 to 254 do char_width[i]:=514; end; vgetc (f); {skip the eol} @y - last := input_line2(f,buffer,last,buf_size); - while (not eof(f)) and (last > 0) and (buffer[last-1] <> xord[10]) - and (buffer[last-1] <> xord[13]) do + last := input_line2(f,buffer,last,buf_size,address_of(i)); + while (not eof(f)) and (last > 0) and (i <> 10) and (i <> 13) do begin buffer_overflow; - last := input_line2(f,buffer,last,buf_size); + last := input_line2(f,buffer,last,buf_size,address_of(i)); end; @z diff --git a/Build/source/texk/web2c/ptexdir/pbibtex.test b/Build/source/texk/web2c/ptexdir/pbibtex.test new file mode 100755 index 00000000000..32b9f0b1e8a --- /dev/null +++ b/Build/source/texk/web2c/ptexdir/pbibtex.test @@ -0,0 +1,14 @@ +#! /bin/sh + +# Copyright (C) 2010 Peter Breitenlohner <tex-live@tug.org> +# You may freely use, modify and/or distribute this file. + +test -d tests || mkdir -p tests + +cp $srcdir/tests/exampl.aux tests/xexampl.aux + +TEXMFCNF=$srcdir/../kpathsea \ + BSTINPUTS=$srcdir/tests \ + BIBINPUTS=$srcdir/tests \ + ./pbibtex tests/xexampl || exit 1 + diff --git a/Build/source/texk/web2c/web2c/ChangeLog b/Build/source/texk/web2c/web2c/ChangeLog index 89f963309f6..db4fdc14cbd 100644 --- a/Build/source/texk/web2c/web2c/ChangeLog +++ b/Build/source/texk/web2c/web2c/ChangeLog @@ -1,3 +1,7 @@ +2010-04-23 Peter Breitenlohner <peb@mppmu.mpg.de> + + * fixwrites.c (main): Recognize 'conststringcast...' as string. + 2010-04-20 Peter Breitenlohner <peb@mppmu.mpg.de> * coerce.h: Remove luaTeX specific code. diff --git a/Build/source/texk/web2c/web2c/fixwrites.c b/Build/source/texk/web2c/web2c/fixwrites.c index a087ece220e..91d4dbe9d11 100644 --- a/Build/source/texk/web2c/web2c/fixwrites.c +++ b/Build/source/texk/web2c/web2c/fixwrites.c @@ -402,7 +402,8 @@ main (int argc, string *argv) } /* And yet another kludge, to handle stringcast (<whatever>) */ - else if (strncmp (cp, "stringcast", 10) == 0) + else if (strncmp (cp, "stringcast", 10) == 0 + || strncmp (cp, "conststringcast", 10) == 0) { *as++ = '%'; *as++ = 's'; |