Re: vfs/extfs/rpm



Jakub Jelinek wrote:
On Fri, Jan 21, 2005 at 01:46:29PM +0100, Roland Illig wrote:

I just noticed that we quoted too much in the rpm script. After applying the patch, rpm works again for me, using rpm-2.5.4 on NetBSD.

But I'm a little bit confused about the bug report that is mentioned in out script:
   https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=64007


Are you sure the rpm you're using doesn't have some patches applied
that change the escaping behaviour?
Standard rpm really needs that level of escaping to get through
popt unescaping.

Is has not been patched. It's just old and stable. ;)

Version 3.0.6 is ok, too.

So I suggest the appended patch.

Roland
Index: rpm
===================================================================
RCS file: /cvsroot/mc/mc/vfs/extfs/rpm,v
retrieving revision 1.22
diff -u -p -u -r1.22 rpm
--- rpm	3 Sep 2004 21:23:05 -0000	1.22
+++ rpm	21 Jan 2005 14:18:01 -0000
@@ -24,12 +24,25 @@ if rpm --nosignature --version >/dev/nul
 else
   RPM="rpm"
 fi
+rpm_version=`$RPM --version`
+
 RPM2CPIO="rpm2cpio"
 SED="sed"
 # Surround the whole filename with single quotes and handle specially
 # \', ' and \ at the end of the string.
 SEDCMD="s/\\(\\\\\\?\\)'/'\\1\\1\\\\''/g;s/\\\\\$/'\\\\\\\\'/;s/^/'/;s/\$/'/"
 
+mcrpmfs_quote() {
+  case $1 in
+    /*) quoted_name="$1";;
+    *) quoted_name="./$1";;
+  esac
+  case $rpm_version in
+    "RPM version 4."*) echo "$quoted_name" | sed "$SEDCMD";;
+    *) echo "$quoted_name";;
+  esac
+}
+
 mcrpmfs_list ()
 {
     # set MCFASTRPM_DFLT to 1 for faster rpm files handling by default, to 0 for
@@ -38,7 +51,7 @@ mcrpmfs_list ()
     if test -z "$MCFASTRPM"; then
       MCFASTRPM=$MCFASTRPM_DFLT
     fi
-    f="`echo "$1" | $SED "$SEDCMD"`"
+    f=`mcrpmfs_quote "$1"`
     FILEPREF="-r--r--r--   1 root     root    "
     DESC=`$RPM -qip "$f" 2>/dev/null` || {
 	echo "$FILEPREF 0 "`date +"%b %d %H:%M"`" ERROR"
@@ -133,7 +146,7 @@ mcrpmfs_list ()
 
 mcrpmfs_copyout ()
 {
-    f="`echo "$1" | $SED "$SEDCMD"`"
+    f=`mcrpmfs_quote "$1"`
     case "$2" in
 	HEADER) $RPM -qip "$f" > "$3"; exit 0;;
 	INSTALL) echo "# Run this to install this RPM package" > "$3"; exit 0;;
@@ -175,7 +188,7 @@ mcrpmfs_copyout ()
 
 mcrpmfs_run ()
 {
-    f="`echo "$1" | $SED "$SEDCMD"`"
+    f=`mcrpmfs_quote "$1"`
     case "$2" in
 	INSTALL) echo "Installing \"\"$f\"\""; $RPM -ivh "$f"; exit 0;;
 	UPGRADE) echo "Upgrading \"\"$f\"\""; $RPM -Uvh "$f"; exit 0;;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]