Re: sed bug when installing texlive-latex-base

Terje Bråten <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
Hi again.

Here is a shortened example of how I can trigger the sed bug.

Put the three files updmap_edit, input1 and input2 in the same directory.
Then run the file updmap_edit (sh updmap_edit).

This crashes when I have the following locale:
LANG=nb_NO.UTF-8
LANGUAGE=nb:en
LC_CTYPE=nb_NO.UTF-8
LC_NUMERIC="nb_NO.UTF-8"
LC_TIME="nb_NO.UTF-8"
LC_COLLATE=nb_NO.UTF-8
LC_MONETARY="nb_NO.UTF-8"
LC_MESSAGES=nb_NO.UTF-8
LC_PAPER="nb_NO.UTF-8"
LC_NAME="nb_NO.UTF-8"
LC_ADDRESS="nb_NO.UTF-8"
LC_TELEPHONE="nb_NO.UTF-8"
LC_MEASUREMENT="nb_NO.UTF-8"
LC_IDENTIFICATION="nb_NO.UTF-8"
LC_ALL=

If I run it with
$  LC_ALL=C sh updmap_edit
then nothing crashes and all seems to be normal.



Terje Bråten.
updmap_edit (text/plain, 1.6 KB)
#!/bin/sh -x

###############################################################################
# normalizeLines()
#   remove comments, whitespace is exactly one space, no empty lines,
#   no whitespace at end of line, one space before and after ",
#   no CR's (as in skaknew).
###############################################################################
normalizeLines()
{
  sed \
      -e '/^[*#;%]/d' \
      -e 's@[ 	][ 	]*@ @g' \
      -e '/^ *$/d' \
      -e 's@ $@@' \
      -e 's@ *" *@ " @g' \
      -e 's@" \([^"]*\) "@"\1"@g' \
   | tr -d '\r' \
   | sort | uniq
}

###############################################################################
# dvips2dvipdfm()
#   reads from stdin, writes to stdout. It transforms "dvips"-like syntax into
#   "dvipdfm"-like syntax. It is a very ugly hack.
###############################################################################
dvips2dvipdfm()
{
  sed -e 's@$@ %@' \
      -e 's@^\(\([^ ]*\).*\)@\1\2@' \
      -e 's@\(.*<\[* *\([^ ]*\)\.enc\(.*\)\)@\1 \2@' \
      -e '/%[^ ]*$/s@$@ default@' \
      -e 's@\(.*<<* *\([^ ]*\)\.pf[ab].*\)@\1 \2@' \
      -e '/%[^ ]* [^ ]*$/s@\( \([^ ]*\).*\)$@\1 \2@' \
      -e 's@\(.*[" ]\([.0-9-][.0-9-]*\) *ExtendFont.*\)@\1 -e \2@' \
      -e 's@\(.*[" ]\([.0-9-][.0-9-]*\) *SlantFont.*\)@\1 -s \2@' \
      -e 's@.*%@@' |
  awk '$1 == $3 && $2 == "default" {$2=""; $3=""} {print}' > $tmp8

  egrep '^(cm|eu|la|lc|line|msam|xy)' $tmp8 \
    | sed 's@$@ -r@; s@\(fmex[789]\) -r$@\1@'
  egrep -v '^(cm|eu|la|lc|line|msam|xy)' $tmp8
}


 tmp8=output8

 <input1 normalizeLines | dvips2dvipdfm | normalizeLines >> output1
 <input1 normalizeLines | dvips2dvipdfm | normalizeLines >> output2
input1 (text/plain, 282.2 KB) - not displayed
input2 (text/plain, 280.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.