bug-texinfo
[Top][All Lists]
Advanced

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

texi2dvi: Beware of local, and find DVIPS figures


From: Akim Demaille
Subject: texi2dvi: Beware of local, and find DVIPS figures
Date: Mon, 23 Jul 2007 15:28:53 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux)

I can't bootstrap CVS texinfo :(  I think local.test is correct, but I
can't run it :(

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * util/texi2dvi: Update DVIPSHEADERS so that dvips finds its
        special headers.
        Don't rely on non-IFS splitting when using local.
        Maybe we should just not use local at all.
        Or never use it to assign at the same time: declare, then assign.
        * util/local.test: Check that "local" is used properly with quotes.

Index: util/local.test
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/local.test,v
retrieving revision 1.8
diff -u -u -r1.8 local.test
--- util/local.test 1 Jul 2007 22:32:12 -0000 1.8
+++ util/local.test 23 Jul 2007 13:25:47 -0000
@@ -23,6 +23,16 @@
 
 set -e
 
+# Make sure quotes are used to protect the value.  See the comment in
+# texi2dvi itself about local.
+if $EGREP "local [a-zA-Z_0-9]*=[^\"']" $TEXI2DVI; then
+  false
+else
+  true
+fi
+
+
+# Make sure each name is used only once.
 if sed -n 's/.*local \([a-zA-Z_0-9]*\)\(=.*\|\)$/\1/gp' $TEXI2DVI |
     sort |
     uniq -c |
Index: util/texi2dvi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi,v
retrieving revision 1.100
diff -u -u -r1.100 texi2dvi
--- util/texi2dvi 23 Jul 2007 13:10:43 -0000 1.100
+++ util/texi2dvi 23 Jul 2007 13:25:47 -0000
@@ -195,7 +195,27 @@
 ## --------------------- ##
 
 
-# In case `local' is not supported by the shell.
+# In case `local' is not supported by the shell, provide a function
+# that simulates it by simply performing the assignments.  This means
+# that we must not expect `local' to work, i.e., we must not (i) rely
+# on it during recursion, and (ii) have two local declarations of the
+# same variable.  (ii) is easy to check statically, and our test suite
+# does make sure there is never twice a static local declaration of a
+# variable.  (i) cannot be checked easily, so just be careful.
+#
+# Note that since we might use a function simulating `local', we can
+# no longer rely on the fact that no IFS-splitting is performed.  So,
+# while
+#
+# foo=$bar
+#
+# is fine (no IFS-splitting), never write
+#
+# local foo=$bar
+#
+# but rather
+#
+# local foo="$bar"
 (
   foo=bar
   test_local () {
@@ -260,7 +280,7 @@
 # Return true if PROG is somewhere in PATH, else false.
 findprog ()
 {
-  local saveIFS=$IFS
+  local saveIFS="$IFS"
   IFS=$path_sep  # break path components at the path separator
   for dir in $PATH; do
     IFS=$saveIFS
@@ -318,7 +338,7 @@
 # Report an error and exit with failure if EXIT_STATUS is non null.
 error ()
 {
-  local s=$1
+  local s="$1"
   shift
   report "$@"
   if test "$s" != 0; then
@@ -363,7 +383,7 @@
 # preceded by SEP.
 list_prefix ()
 {
-  local lp_p=$2
+  local lp_p="$2"
   eval set X \$$1
   shift
   local lp_res
@@ -381,7 +401,7 @@
 {
   eval set X \$$1
   shift
-  local la_IFS=$IFS
+  local la_IFS="$IFS"
   IFS=$path_sep
   echo "$*"
   IFS=$la_IFS
@@ -393,7 +413,7 @@
 # Currently unused, but should replace absolute_filenames some day.
 list_dir_to_abs ()
 {
-  local ld_l=$1
+  local ld_l="$1"
   eval set X \$$ld_l
   shift
   local ld_res
@@ -445,7 +465,7 @@
 
 # Save TEXINPUTS so we can construct a new TEXINPUTS path for each file.
 # Likewise for bibtex and makeindex.
-tex_envvars="BIBINPUTS BSTINPUTS INDEXSTYLE TEXINPUTS"
+tex_envvars="BIBINPUTS BSTINPUTS DVIPSHEADERS INDEXSTYLE TEXINPUTS"
 for var in $tex_envvars; do
   eval ${var}_orig=\$$var
   export $var
@@ -753,7 +773,7 @@
   esac
 
   # Note that this will be used via an eval: quote properly.
-  local cmd=$tex
+  local cmd="$tex"
 
   # If possible, make TeX report error locations in GNU format.
   if test "${tex_help:+set}" != set; then
@@ -1184,7 +1204,7 @@
 # to handle images some day.
 run_hevea ()
 {
-  local hevea=${HEVEA:-hevea}
+  local hevea="${HEVEA:-hevea}"
   local run_hevea="$hevea"
 
   case $1 in
@@ -1293,7 +1313,7 @@
   cd_orig
   local to_remove="$t2ddir"
   $tidy || {
-    local log=$work_build/$in_noext.log
+    local log="$work_build/$in_noext.log"
     to_remove=$to_remove" $log "$(generated_files_get "$work_build/$in_noext")
   }
   remove $to_remove




reply via email to

[Prev in Thread] Current Thread [Next in Thread]