rpms/libguestfs/F-12 libguestfs-1.0.85-bash-regexp-quoting-fix-for-rhel-5.patch, NONE, 1.1 libguestfs.spec, 1.114, 1.115

Richard W.M. Jones rjones at fedoraproject.org
Tue Mar 2 16:33:15 UTC 2010


Author: rjones

Update of /cvs/pkgs/rpms/libguestfs/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17780

Modified Files:
	libguestfs.spec 
Added Files:
	libguestfs-1.0.85-bash-regexp-quoting-fix-for-rhel-5.patch 
Log Message:
Attempt a more complete fix for bash regexp quoting problem (RHBZ#566511).

libguestfs-1.0.85-bash-regexp-quoting-fix-for-rhel-5.patch:
 supermin-split.sh.in |   30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

--- NEW FILE libguestfs-1.0.85-bash-regexp-quoting-fix-for-rhel-5.patch ---
>From 4891ff9945177e8666af8381d1e0a54b8ce363e2 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at redhat.com>
Date: Tue, 2 Mar 2010 10:34:20 +0000
Subject: [PATCH] More complete fix for bash regexp quoting bug.

Commit 457fccae1b665347 was not a complete fix, in that it
didn't work properly on RHEL 5 era bash (3.2.x).  For example:

  file=libntfs-3g.so.74
  [[ "$file" =~ ^lib(.*)\.so\.([0-9]+)\. ]] && \
    echo "lib${BASH_REMATCH[1]}.so.${BASH_REMATCH[2]}.*"

would on those old shells print:

  libntfs-3g.so.7.*

It seems the final \. was being treated as a plain period (ie.
match anything).

The only way to work around this incompatibility is to assign the
patterns to variables and match on those, ie:

  p='^lib(.*)\.so\.([0-9]+)\.'
  [[ "$file" =~ $p ]] && ...

This works in both old and new shells.
---
 appliance/supermin-split.sh.in |   29 ++++++++++++++++++++---------
 1 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/appliance/supermin-split.sh.in b/appliance/supermin-split.sh.in
index 753fca3..cd29b8a 100755
--- a/appliance/supermin-split.sh.in
+++ b/appliance/supermin-split.sh.in
@@ -55,24 +55,35 @@ for path in $(find -not -name fakeroot.log); do
     # question E14 here http://tiswww.case.edu/php/chet/bash/FAQ and
     # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487387#25
     # (RHBZ#566511).
+    p_etc='^\./etc'
+    p_dev='^\./dev'
+    p_var='^\./var'
+    p_lib_modules='^\./lib/modules/'
+    p_builddir='^\./builddir'
+    p_ld_so='^ld-[.0-9]+\.so$'
+    p_libbfd='^libbfd-.*\.so$'
+    p_libgcc='^libgcc_s-.*\.so\.([0-9]+)$'
+    p_lib123so='^lib(.*)-[-.0-9]+\.so$'
+    p_lib123so123='^lib(.*)-[-.0-9]+\.so\.([0-9]+)\.'
+    p_libso123='^lib(.*)\.so\.([0-9]+)\.'
 
     # All we're going to keep are the special files /init, the daemon,
     # configuration files (/etc), devices and modifiable stuff (/var).
     if [ "$path" = "./init" -o "$file" = "guestfsd" ]; then
         echo "$path" >&5
 
-    elif [[ "$path" =~ ^\./etc || "$path" =~ ^\./dev || "$path" =~ ^\./var ]]
+    elif [[ "$path" =~ $p_etc || "$path" =~ $p_dev || "$path" =~ $p_var ]]
     then
         echo "$path" >&5
 
     # Kernel modules are always copied in from the host, including all
     # the dependency files.
-    elif [[ "$path" =~ ^\./lib/modules/ ]]; then
+    elif [[ "$path" =~ $p_lib_modules ]]; then
         :
 
     # On mock/Koji, exclude bogus /builddir directory which for some
     # reason contains some yum temporary files (RHBZ#566512).
-    elif [[ "$path" =~ ^\./builddir ]]; then
+    elif [[ "$path" =~ $p_builddir ]]; then
         :
 
     elif [ -d "$path" ]; then
@@ -82,27 +93,27 @@ for path in $(find -not -name fakeroot.log); do
 
     # Some libraries need fixed version numbers replaced by wildcards.
 
-    elif [[ "$file" =~ ^ld-[.0-9]+\.so$ ]]; then
+    elif [[ "$file" =~ $p_ld_so ]]; then
         echo "$dir/ld-*.so" >&6
 
     # Special case for libbfd
-    elif [[ "$file" =~ ^libbfd-.*\.so$ ]]; then
+    elif [[ "$file" =~ $p_libbfd ]]; then
         echo "$dir/libbfd-*.so" >&6
 
     # Special case for libgcc_s-<gccversion>-<date>.so.N
-    elif [[ "$file" =~ ^libgcc_s-.*\.so\.([0-9]+)$ ]]; then
+    elif [[ "$file" =~ $p_libgcc ]]; then
         echo "$dir/libgcc_s-*.so.${BASH_REMATCH[1]}" >&6
 
     # libfoo-1.2.3.so
-    elif [[ "$file" =~ ^lib(.*)-[-.0-9]+\.so$ ]]; then
+    elif [[ "$file" =~ $p_lib123so ]]; then
         echo "$dir/lib${BASH_REMATCH[1]}-*.so" >&6
 
     # libfoo-1.2.3.so.1.2.3 (but NOT '*.so.N')
-    elif [[ "$file" =~ ^lib(.*)-[-.0-9]+\.so\.([0-9]+)\. ]]; then
+    elif [[ "$file" =~ $p_lib123so123 ]]; then
         echo "$dir/lib${BASH_REMATCH[1]}-*.so.${BASH_REMATCH[2]}.*" >&6
 
     # libfoo.so.1.2.3 (but NOT '*.so.N')
-    elif [[ "$file" =~ ^lib(.*)\.so\.([0-9]+)\. ]]; then
+    elif [[ "$file" =~ $p_libso123 ]]; then
         echo "$dir/lib${BASH_REMATCH[1]}.so.${BASH_REMATCH[2]}.*" >&6
 
     else
-- 
1.6.5.2



Index: libguestfs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libguestfs/F-12/libguestfs.spec,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -p -r1.114 -r1.115
--- libguestfs.spec	1 Mar 2010 18:05:53 -0000	1.114
+++ libguestfs.spec	2 Mar 2010 16:33:14 -0000	1.115
@@ -42,7 +42,7 @@ Summary:       Access and modify virtual
 Name:          libguestfs
 Epoch:         1
 Version:       1.0.85
-Release:       1%{?dist}
+Release:       1%{?dist}.1
 License:       LGPLv2+
 Group:         Development/Libraries
 URL:           http://libguestfs.org/
@@ -52,6 +52,9 @@ BuildRoot:     %{_tmppath}/%{name}-%{ver
 # Disable FUSE tests, not supported in Koji at the moment.
 Patch0:        libguestfs-1.0.79-no-fuse-test.patch
 
+# More complete fix for bash regexp quoting screw-up.
+Patch1:        libguestfs-1.0.85-bash-regexp-quoting-fix-for-rhel-5.patch
+
 # Basic build requirements:
 BuildRequires: /usr/bin/pod2man
 BuildRequires: /usr/bin/pod2text
@@ -374,6 +377,7 @@ Requires:      jpackage-utils
 %setup -q
 
 %patch0 -p1
+%patch1 -p1
 
 mkdir -p daemon/m4
 
@@ -644,6 +648,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Tue Mar  2 2010 Richard W.M. Jones <rjones at redhat.com> - 1:1.0.85-1.fc12.1
+- Attempt a more complete fix for bash regexp quoting problem (RHBZ#566511).
+
 * Mon Mar  1 2010 Richard W.M. Jones <rjones at redhat.com> - 1:1.0.85-1
 - New upstream version 1.0.85.
 - Remove hivex, now a separate upstream project and package.



More information about the scm-commits mailing list