vc-list-files: fix another quoting bug
authorJim Meyering <meyering@redhat.com>
Sat, 25 Apr 2009 13:32:33 +0000 (15:32 +0200)
committerJim Meyering <meyering@redhat.com>
Sat, 25 Apr 2009 13:32:33 +0000 (15:32 +0200)
* build-aux/vc-list-files: Avoid sed backslash expansion
of pathological directory names.

ChangeLog
build-aux/vc-list-files

index 689b372..27de447 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-25  Jim Meyering  <meyering@redhat.com>
+
+       vc-list-files: fix another quoting bug
+       * build-aux/vc-list-files: Avoid sed backslash expansion
+       of pathological directory names.
+
 2009-04-25  Eric Blake  <ebb9@byu.net>
 
        vc-list-files: fix shell quoting error
index 08dc8ab..9376e3d 100755 (executable)
@@ -72,13 +72,15 @@ esac
 test "x$dir" = x && dir=.
 
 if test -d .git; then
-  test "x$dir" = x. && dir= || dir="$dir/"
+  test "x$dir" = x. \
+    && dir= sed_esc= \
+    || dir="$dir/" sed_esc=`echo "$dir"|sed 's,\([\\/]\),\\\\\1,g'`
   # Ignore git symlinks - either they point into the tree, in which case
   # we don't need to visit the target twice, or they point somewhere
   # else (often into a submodule), in which case the content does not
   # belong to this package.
   eval exec git ls-tree -r 'HEAD:"$dir"' \
-    \| sed -n '"s!^100[^       ]*.!$dir!p"' $postprocess
+    \| sed -n '"s/^100[^       ]*./$sed_esc/p"' $postprocess
 elif test -d .hg; then
   eval exec hg locate '"$dir/*"' $postprocess
 elif test -d .bzr; then