Package: exifprobe
Version: 2.0.1-1
Severity: normal
Tags: patch

exifgrep does not escape patterns passed to egrep properly, leading to
completely wrong behaviour because they are mis-interpreted as glob patterns
by the shell.

Commandline:

> cd /tmp; echo f > .foo; exifgrep '.*' ~/lib/pics/rl/2010-09-11/P1000944.JPG

Expected output:

FileName = /home/derf/lib/pics/rl/2010-09-11/P1000944.JPG
FileType = JPEG
FileSize = 4667969
JPEG.APP1 = @2:32156
[...]

Actual output:

..X0-lock: 954
..foo:f


The attached patch should fix this.


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages exifprobe depends on:
ii  libc6                         2.11.2-6   Embedded GNU C Library: Shared lib

exifprobe recommends no packages.

exifprobe suggests no packages.

-- no debconf information
diff -u a/exifgrep b/exifgrep
--- a/exifgrep	2010-09-16 21:40:26.774929524 +0200
+++ b/exifgrep	2010-09-16 21:42:19.867969768 +0200
@@ -183,7 +183,7 @@
                  *) notpattern="$2"; shift; shift; break ;;
               esac
               ;;
-           *) pattern=$1; shift
+           *) pattern="$1"; shift
               case $1 in
                 NOT) case "$2" in
                         -f) notpattern="-f $3"; shift; shift; shift; break ;;
@@ -213,17 +213,17 @@
 # exifprobe -L output.
 
 case $# in
-     0) egrep ${egrep_options} ${pattern} | format
+     0) egrep ${egrep_options} "${pattern}" | format
         ;;
      *) case $# in
             1) ;;
             *) nameopt="-n" ;;  # Use names if more than one file
         esac
         case "${notpattern}" in
-            "") ${PROBE} -L ${coloropt} ${nameopt} ${tagopt} $* | egrep ${egrep_options} ${pattern} | format ;;
+            "") ${PROBE} -L ${coloropt} ${nameopt} ${tagopt} $* | egrep ${egrep_options} "${pattern}" | format ;;
              *) case "${pattern}" in
-                    "") ${PROBE} -L ${coloropt} ${nameopt} ${tagopt} $* | egrep ${egrep_options} -v ${notpattern} | format ;;
-                     *) ${PROBE} -L ${coloropt} ${nameopt} ${tagopt} $* | egrep ${egrep_options} ${pattern} | egrep -v ${notpattern} | format ;;
+                    "") ${PROBE} -L ${coloropt} ${nameopt} ${tagopt} $* | egrep ${egrep_options} -v "${notpattern}" | format ;;
+                     *) ${PROBE} -L ${coloropt} ${nameopt} ${tagopt} $* | egrep ${egrep_options} "${pattern}" | egrep -v "${notpattern}" | format ;;
                 esac
                 ;;
         esac

Reply via email to