maint.mk: make VC_LIST_EXCEPT robustly handle a srcdir containing "."
authorJim Meyering <meyering@redhat.com>
Thu, 21 Jan 2010 15:47:34 +0000 (16:47 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 21 Jan 2010 18:32:54 +0000 (19:32 +0100)
* top/maint.mk (_dot_escaped_srcdir): Define.
(VC_LIST_EXCEPT): Use it in LHS of preprocessing sed substitution.

ChangeLog
top/maint.mk

index 681b56a26836205da2fbf5a6896ed831a7b116a3..e294c72523d1d13f04953ed6243ba40192c0663a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-21  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: handle source file names containing "." robustly
+       * top/maint.mk (_dot_escaped_srcdir): Define.
+       (VC_LIST): Use it in LHS of sed substitution.
+
 2010-01-21  Jiri Denemark  <jdenemar@redhat.com>
 
        maint.mk: fix VC_LIST_EXCEPT for srcdir != builddir
 2010-01-21  Jiri Denemark  <jdenemar@redhat.com>
 
        maint.mk: fix VC_LIST_EXCEPT for srcdir != builddir
index bbf8a9197511f8ac0213d6e676994a0ce11476d4..1ef28d39195f46df70b351b53559bd8491c3d3b2 100644 (file)
@@ -40,8 +40,13 @@ VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
 # matching files to ignore.
 VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$
 
 # matching files to ignore.
 VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$
 
+# This is to preprocess robustly the output of $(VC_LIST), so that even
+# when $(srcdir) is a pathological name like "....", the leading sed command
+# removes only the intended prefix.
+_dot_escaped_srcdir = $(subst .,\\.,$(srcdir))
+
 VC_LIST_EXCEPT = \
 VC_LIST_EXCEPT = \
-  $(VC_LIST) | sed 's|^$(srcdir)/||' \
+  $(VC_LIST) | sed 's|^$(_dot_escaped_srcdir)/||' \
        | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
          else grep -Ev -e "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi \
        | grep -Ev -e '$(VC_LIST_ALWAYS_EXCLUDE_REGEX)' \
        | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
          else grep -Ev -e "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi \
        | grep -Ev -e '$(VC_LIST_ALWAYS_EXCLUDE_REGEX)' \