Package: xpdf
Version: 3.02-20
Severity: normal
Tags: patch

Because the "echo" and "read" commands interpret the backslash as a
special character, the xpdf wrapper doesn't correctly handle backslash
in file names after the -m option.

The attached patch correct this:

* many="$many\n$1" is replaced by many=$(printf "%s\n%s" "$many" "$1")
  to add a real newline character.

* echo "$many" is replaced by printf "%s\n" "$many" to avoid backslash
  being regarded as a special character.

* The -r read option (specified by POSIX) has been added for the same
  purpose.

Note: a newline in a filename is not handled correctly, but to handle
it, one would need to output null byte terminated file names to a
temporary file and use xargs -0 -n 1 (unfortunately, neither bash
not dash can handle null bytes in parameters, that's why a temporary
file would be needed).

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.ISO8859-1 (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages xpdf depends on:
ii  lesstif2                      1:0.95.2-1 OSF/Motif 2.1 implementation relea
ii  libc6                         2.13-13    Embedded GNU C Library: Shared lib
ii  libgcc1                       1:4.6.1-5  GCC support library
ii  libpoppler13                  0.16.7-2   PDF rendering library
ii  libstdc++6                    4.6.1-5    GNU Standard C++ Library v3
ii  libx11-6                      2:1.4.4-1  X11 client-side library
ii  libxt6                        1:1.1.1-2  X11 toolkit intrinsics library

Versions of packages xpdf recommends:
ii  gsfonts-x11                   0.22       Make Ghostscript fonts available t
ii  poppler-data                  0.4.4-1    Encoding data for the poppler PDF 
ii  poppler-utils                 0.16.7-2   PDF utilities (based on Poppler)

xpdf suggests no packages.

-- no debconf information
--- /usr/bin/xpdf       2011-07-31 09:57:48.000000000 +0200
+++ xpdf        2011-08-02 23:52:11.000000000 +0200
@@ -33,7 +33,7 @@
         while [ "$#" -gt "0" ]; do
             case "$1" in
                 -*) break ;;
-                *) many="$many\n$1" ;;
+                *) many=$(printf "%s\n%s" "$many" "$1") ;;
             esac
             shift
         done
@@ -49,7 +49,7 @@
 
 test "$title" != "" || title="Xpdf: $file"
 if [ "$many" != "" ]; then
-    echo "$many" | while read file; do
+    printf "%s\n" "$many" | while read -r file; do
         test ! -f "$file" || $0 "$file" &
     done
 elif [ "$file" = "" ]; then

Reply via email to