Skip to content

texi2dvi / egrep issue shows (a.o.) up in R-alpha

4 messages · Martin Maechler, Tobias Verbeke, Brian Ripley

#
L.S.

I noticed weird tools::texi2dvi behaviour on R-alpha
when specifying an absolute path to the .tex
file.

The same phenomenon also appears to occur on
R-2.12.2, so maybe the issue is independent
of R.

I hope I did not overlook any important information.

Best,
Tobias

 > require(tools)
Loading required package: tools
 > getwd()
[1] "/home/tobias"
 > texi2dvi("test.tex") # works OK
 > texi2dvi("/home/tobias/test.tex")
Error in texi2dvi("/home/tobias/test.tex") :
   Running 'texi2dvi' on '/home/tobias/test.tex' failed.
Messages:
egrep: Invalid range end
/usr/bin/texi2dvi: cannot read .//home/tobias/test.tex, skipping.
 > sessionInfo()
R version 2.13.0 alpha (2011-03-19 r54880)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C
  [3] LC_TIME=en_US.utf8        LC_COLLATE=en_US.utf8
  [5] LC_MONETARY=C             LC_MESSAGES=en_US.utf8
  [7] LC_PAPER=en_US.utf8       LC_NAME=C
  [9] LC_ADDRESS=C              LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C

attached base packages:
[1] tools     stats     graphics  grDevices utils     datasets  methods
[8] base
 >

This is Ubuntu 10.10 with GNU grep 2.6.3 and
texi2dvi (GNU Texinfo 4.13) 1.135.

The test file is most simple:

\documentclass{article}
\begin{document}
Test document.
\end{document}
#
> L.S.  I noticed weird tools::texi2dvi behaviour on R-alpha
    > when specifying an absolute path to the .tex file.

    > The same phenomenon also appears to occur on R-2.12.2, so
    > maybe the issue is independent of R.

Yes. I think it's independent of R.

In any case, there's been a bug in the (Unix/Linux/teTeX/....)
texi2dvi  sh script, 
a bug which I think typically only bites if you work in non-ASCII
locales -- as you and I, eg.

Here's the patch that I have had in place for quite a while :

MM at lynne$ diff -ubBw  /usr/bin/texi2dvi /usr/local/bin/scripts/texi2dvi
--- /usr/bin/texi2dvi	2011-01-11 15:33:52.000000000 +0100
+++ /usr/local/bin/scripts/texi2dvi	2010-07-09 08:32:36.000025000 +0200
@@ -33,7 +33,7 @@
 set -e
 
 # This string is expanded by rcs automatically when this file is checked out.
-rcs_revision='$Revision: 1.135 $'
+rcs_revision='$Revision: 1.135__mod.SfS_ETHZ $'
 rcs_version=`set - $rcs_revision; echo $2`
 program=`echo $0 | sed -e 's!.*/!!'`
 
@@ -1683,7 +1683,7 @@
 
   # If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex),
   # prepend `./' in order to avoid that the tools take it as an option.
-  echo "$command_line_filename" | $EGREP '^(/|[A-Za-z]:/)' >&6 \
+  echo "$command_line_filename" | $EGREP '^(/|[[:alpha:]]:/)' >&6 \
   || command_line_filename="./$command_line_filename"
 
   # See if the file exists.  If it doesn't we're in trouble since, even
MM at lynne$

Best regards,
Martin
#
On 03/22/2011 08:41 AM, Martin Maechler wrote:
Many thanks, Martin. That was indeed the issue and the patch
works perfectly fine.

Kind regards,
Tobias
#
After some offline checks, another workaround is to set LC_COLLATE=C, 
and we'll arrange for tools::texi2dvi() to do that.
On Tue, 22 Mar 2011, Tobias Verbeke wrote: