Bug 209 - VFS doesn't work if directory names have spaces in them
VFS doesn't work if directory names have spaces in them
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: mc (Show other bugs)
5.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Federico Musto
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1998-11-27 19:10 EST by Marc MERLIN
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-03-18 10:45:54 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Marc MERLIN 1998-11-27 19:10:40 EST
This is not a new problem.
The supplied patch is for the rpm subsystem, but it affects
the other ones equally

This patch (which I will only send by Email) protects all
the occurences of $1 with quotes, to protect any spaces that
it might contain.
This patch also contains the patch that I found here with
the problem of browsing rpms with the new rpm binary.

Note once again that other vfs filesytems are also affected

This report was also sent to the mc mailing list.
Marc

--- rpm.redhat  Mon Jul 27 19:15:18 1998
+++ rpm Fri Nov 27 14:41:36 1998
@@ -18,8 +18,8 @@
       MCFASTRPM=$MCFASTRPM_DFLT
     fi
     FILEPREF="-r--r--r--   1 root     root    "
-    DESC=`rpm -qip $1`
-    DATE=`rpm -qp --qf "%{BUILDTIME:date}" $1 | cut -c
5-11,21-24`
+    DESC=`rpm -qip "$1"`
+    DATE=`rpm -qp --qf "%{BUILDTIME:date}" "$1" | cut -c
5-11,21-24`
     HEADERSIZE=`echo "$DESC" | wc -c`
     echo "-r--r--r--   1 root     root  $HEADERSIZE $DATE
HEADER"
     echo "-r-xr-xr-x   1 root     root    39 $DATE INSTALL"
@@ -30,25 +30,25 @@
     echo "$FILEPREF 0 $DATE INFO/BUILDHOST"
     echo "$FILEPREF 0 $DATE INFO/SOURCERPM"
     if test "$MCFASTRPM" = 0 ; then
-     test "`rpm -qp --qf \"%{DISTRIBUTION}\" $1`" =
"(none)" ||
+     test "`rpm -qp --qf \"%{DISTRIBUTION}\" \"$1\"`" =
"(none)" ||
         echo "$FILEPREF 0 $DATE INFO/DISTRIBUTION"
-     test "`rpm -qp --qf \"%{VENDOR}\" $1`" = "(none)" ||
+     test "`rpm -qp --qf \"%{VENDOR}\" \"$1\"`" = "(none)"
||
         echo "$FILEPREF 0 $DATE INFO/VENDOR"
-     test "`rpm -qp --qf \"%{DESCRIPTION}\" $1`" = "(none)"
||
+     test "`rpm -qp --qf \"%{DESCRIPTION}\" \"$1\"`" =
"(none)" ||
          echo "$FILEPREF 0 $DATE INFO/DESCRIPTION"
-     test "`rpm -qp --qf \"%{SUMMARY}\" $1`" = "(none)" ||
+     test "`rpm -qp --qf \"%{SUMMARY}\" \"$1\"`" = "(none)"
||
          echo "$FILEPREF 0 $DATE INFO/SUMMARY"
-     if test "`rpm -qp --qf
\"%{RPMTAG_PREIN}%{RPMTAG_POSTIN}%{RPMTAG_PREUN}%{RPMTAG_POSTUN}%{VERIFYSCRIPT}\"
$1`" != "(none)(none)(none)(none)(none)"; then
+     if test "`rpm -qp --qf
\"%{RPMTAG_PREIN}%{RPMTAG_POSTIN}%{RPMTAG_PREUN}%{RPMTAG_POSTUN}%{VERIFYSCRIPT}\"
\"$1\"`" != "(none)(none)(none)(none)(none)"; then
        echo "dr-xr-xr-x   1 root     root     0 $DATE
INFO/SCRIPTS"
-       test "`rpm -qp --qf \"%{RPMTAG_PREIN}\" $1`" =
'(none)' ||
+       test "`rpm -qp --qf \"%{RPMTAG_PREIN}\" \"$1\"`" =
'(none)' ||
           echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREIN"
-       test "`rpm -qp --qf \"%{RPMTAG_POSTIN}\" $1`" =
'(none)' ||
+       test "`rpm -qp --qf \"%{RPMTAG_POSTIN}\" \"$1\"`" =
'(none)' ||
           echo "$FILEPREF 0 $DATE INFO/SCRIPTS/POSTIN"
-       test "`rpm -qp --qf \"%{RPMTAG_PREUN}\" $1`" =
'(none)' ||
+       test "`rpm -qp --qf \"%{RPMTAG_PREUN}\" \"$1\"`" =
'(none)' ||
           echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREUN"
-       test "`rpm -qp --qf \"%{RPMTAG_POSTUN}\" $1`" =
'(none)' ||
+       test "`rpm -qp --qf \"%{RPMTAG_POSTUN}\" \"$1\"`" =
'(none)' ||
           echo "$FILEPREF 0 $DATE INFO/SCRIPTS/POSTUN"
-       test "`rpm -qp --qf \"%{VERIFYSCRIPT}\" $1`" =
'(none)' ||
+       test "`rpm -qp --qf \"%{VERIFYSCRIPT}\" \"$1\"`" =
'(none)' ||
           echo "$FILEPREF 0 $DATE
INFO/SCRIPTS/VERIFYSCRIPT"
         echo "$FILEPREF 0 $DATE INFO/SCRIPTS/ALL"
      fi
@@ -66,13 +66,13 @@
      echo "$FILEPREF 0 $DATE INFO/SCRIPTS/ALL"
     fi
     if test "$MCFASTRPM" = 0 ; then
-     test "`rpm -qp --qf \"%{PACKAGER}\" $1`" = "(none)" ||
+     test "`rpm -qp --qf \"%{PACKAGER}\" \"$1\"`" =
"(none)" ||
         echo "$FILEPREF 0 $DATE INFO/PACKAGER"
-     test "`rpm -qp --qf \"%{URL}\" $1`" = "(none)" ||
+     test "`rpm -qp --qf \"%{URL}\" \"$1\"`" = "(none)" ||
         echo "$FILEPREF 0 $DATE INFO/URL"
-     test "`rpm -qp --qf \"%{SERIAL}\" $1`" = "(none)" ||
+     test "`rpm -qp --qf \"%{SERIAL}\" \"$1\"`" = "(none)"
||
         echo "$FILEPREF 0 $DATE INFO/SERIAL"
-     test "`rpm -qp --qf \"%{COPYRIGHT}\" $1`" = "(none)"
||
+     test "`rpm -qp --qf \"%{COPYRIGHT}\" \"$1\"`" =
"(none)" ||
         echo "$FILEPREF 0 $DATE INFO/COPYRIGHT"
     else
         echo "$FILEPREF 0 $DATE INFO/PACKAGER"
@@ -85,11 +85,11 @@
     echo "$FILEPREF 0 $DATE INFO/OS"
     echo "$FILEPREF 0 $DATE INFO/SIZE"
     if test "$MCFASTRPM" != 0 ; then
-    rpm -qp --qf "[%{REQUIRENAME}\n]" $1 | grep "(none)" >
/dev/null ||
+    rpm -qp --qf "[%{REQUIRENAME}\n]" "$1" | grep "(none)"
> /dev/null ||
        echo "$FILEPREF 0 $DATE INFO/REQUIRENAME"
-    rpm -qp --qf "[%{PROVIDES}\n]" $1 | grep "(none)" >
/dev/null ||
+    rpm -qp --qf "[%{PROVIDES}\n]" "$1" | grep "(none)" >
/dev/null ||
        echo "$FILEPREF 0 $DATE INFO/PROVIDES"
-    test "`rpm -qp --qf \"%{CHANGELOGTEXT}\" $1`" =
"(none)" ||
+    test "`rpm -qp --qf \"%{CHANGELOGTEXT}\" \"$1\"`" =
"(none)" ||
        echo "$FILEPREF 0 $DATE INFO/CHANGELOG"
     else
        echo "$FILEPREF 0 $DATE INFO/REQUIRENAME"
@@ -97,47 +97,47 @@
         echo "$FILEPREF 0 $DATE INFO/CHANGELOG"
     fi

-    rpm -qlvp $1 | sed -e 's/^\(..........\)[-t] /\1 1 /'
+    rpm -qlvp "$1" | sed -e 's/^\(..........\)/\1 1 /'
 }

 mcrpmfs_copyout ()
 {
     case "$2" in
-       HEADER) rpm -qip $1 > $3; exit 0;;
+       HEADER) rpm -qip "$1" > $3; exit 0;;
        INSTALL) echo "# Run this to install this RPM
package" > $3; exit 0;;
        UPGRADE) echo "# Run this to upgrade this RPM
package" > $3; exit 0;;
-       INFO/NAME-VERSION-RELEASE)      rpm -qp --qf
"%{NAME}-%{VERSION}-%{RELEASE}\n" $1 > $3; exit 0;;
-       INFO/RELEASE)           rpm -qp --qf "%{RELEASE}\n"
$1 > $3; exit 0;;
-       INFO/GROUP)             rpm -qp --qf "%{GROUP}\n" $1
> $3; exit 0;;
-       INFO/DISTRIBUTION)      rpm -qp --qf
"%{DISTRIBUTION}\n" $1 > $3; exit 0;;
-       INFO/VENDOR)            rpm -qp --qf "%{VENDOR}\n"
$1 > $3; exit 0;;
-       INFO/BUILDHOST)         rpm -qp --qf
"%{BUILDHOST}\n" $1 > $3; exit 0;;
-  INFO/SOURCERPM)         rpm -qp --qf
"%{SOURCERPM}\n" $1 > $3; exit 0;;
-       INFO/DESCRIPTION)       rpm -qp --qf
"%{DESCRIPTION}\n" $1 > $3; exit 0;;
-       INFO/PACKAGER)          rpm -qp --qf "%{PACKAGER}\n"
$1 > $3; exit 0;;
-       INFO/URL)               rpm -qp --qf "%{URL}\n" $1
>$3; exit 0;;
-       INFO/BUILDTIME)         rpm -qp --qf
"%{BUILDTIME:date}\n" $1 >$3; exit 0;;
-       INFO/SERIAL)            rpm -qp --qf "%{SERIAL}\n"
$1 >$3; exit 0;;
-       INFO/COPYRIGHT)         rpm -qp --qf
"%{COPYRIGHT}\n" $1 >$3; exit 0;;
-       INFO/RPMVERSION)        rpm -qp --qf
"%{RPMVERSION}\n" $1 >$3; exit 0;;
-       INFO/REQUIRENAME)       rpm -qp --qf
"[%{REQUIRENAME} %{REQUIREFLAGS:depflags}
%{REQUIREVERSION}\n]" $1 >$3; exit 0;;
-       INFO/PROVIDES)          rpm -qp --qf
"[%{PROVIDES}\n]" $1 >$3; exit 0;;
-       INFO/SCRIPTS/PREIN)     rpm -qp --qf
"%{RPMTAG_PREIN}\n" $1 >$3; exit 0;;
-       INFO/SCRIPTS/POSTIN)    rpm -qp --qf
"%{RPMTAG_POSTIN}\n" $1 >$3; exit 0;;
-       INFO/SCRIPTS/PREUN)     rpm -qp --qf
"%{RPMTAG_PREUN}\n" $1 >$3; exit 0;;
-       INFO/SCRIPTS/POSTUN)    rpm -qp --qf
"%{RPMTAG_POSTUN}\n" $1 >$3; exit 0;;
-       INFO/SCRIPTS/VERIFYSCRIPT)      rpm -qp --qf
"%{VERIFYSCRIPT}\n" $1 >$3; exit 0;;
-       INFO/SCRIPTS/ALL)               rpm -qp --scripts $1
> $3; exit 0;;
-       INFO/SUMMARY)           rpm -qp --qf "%{SUMMARY}\n"
$1 > $3; exit 0;;
-       INFO/OS)                rpm -qp --qf "%{OS}\n" $1 >
$3; exit 0;;
-       INFO/CHANGELOG)         rpm -qp --qf "[*
%{CHANGELOGTIME:date}
%{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]\n" $1 > $3; exit 0;;
-       INFO/SIZE)              rpm -qp --qf "%{SIZE}
bytes\n" $1 > $3; exit 0;;
+       INFO/NAME-VERSION-RELEASE)      rpm -qp --qf
"%{NAME}-%{VERSION}-%{RELEASE}\n" "$1" > $3; exit 0;;
+       INFO/RELEASE)           rpm -qp --qf "%{RELEASE}\n"
"$1" > $3; exit 0;;
+       INFO/GROUP)             rpm -qp --qf "%{GROUP}\n"
"$1" > $3; exit 0;;
+       INFO/DISTRIBUTION)      rpm -qp --qf
"%{DISTRIBUTION}\n" "$1" > $3; exit 0;;
+       INFO/VENDOR)            rpm -qp --qf "%{VENDOR}\n"
"$1" > $3; exit 0;;
+       INFO/BUILDHOST)         rpm -qp --qf
"%{BUILDHOST}\n" "$1" > $3; exit 0;;
+       INFO/SOURCERPM)         rpm -qp --qf
"%{SOURCERPM}\n" "$1" > $3; exit 0;;
+       INFO/DESCRIPTION)       rpm -qp --qf
"%{DESCRIPTION}\n" "$1" > $3; exit 0;;
+       INFO/PACKAGER)          rpm -qp --qf "%{PACKAGER}\n"
"$1" > $3; exit 0;;
+       INFO/URL)               rpm -qp --qf "%{URL}\n" "$1"
>$3; exit 0;;
+       INFO/BUILDTIME)         rpm -qp --qf
"%{BUILDTIME:date}\n" "$1" >$3; exit 0;;
+       INFO/SERIAL)            rpm -qp --qf "%{SERIAL}\n"
"$1" >$3; exit 0;;
+       INFO/COPYRIGHT)         rpm -qp --qf
"%{COPYRIGHT}\n" "$1" >$3; exit 0;;
+       INFO/RPMVERSION)        rpm -qp --qf
"%{RPMVERSION}\n" "$1" >$3; exit 0;;
+       INFO/REQUIRENAME)       rpm -qp --qf
"[%{REQUIRENAME} %{REQUIREFLAGS:depflags}
%{REQUIREVERSION}\n]" "$1" >$3; exit 0;;
+       INFO/PROVIDES)          rpm -qp --qf
"[%{PROVIDES}\n]" "$1" >$3; exit 0;;
+       INFO/SCRIPTS/PREIN)     rpm -qp --qf
"%{RPMTAG_PREIN}\n" "$1" >$3; exit 0;;
+       INFO/SCRIPTS/POSTIN)    rpm -qp --qf
"%{RPMTAG_POSTIN}\n" "$1" >$3; exit 0;;
+       INFO/SCRIPTS/PREUN)     rpm -qp --qf
"%{RPMTAG_PREUN}\n" "$1" >$3; exit 0;;
+       INFO/SCRIPTS/POSTUN)    rpm -qp --qf
"%{RPMTAG_POSTUN}\n" "$1" >$3; exit 0;;
+       INFO/SCRIPTS/VERIFYSCRIPT)      rpm -qp --qf
"%{VERIFYSCRIPT}\n" "$1" >$3; exit 0;;
+       INFO/SCRIPTS/ALL)               rpm -qp --scripts
"$1" > $3; exit 0;;
+       INFO/SUMMARY)           rpm -qp --qf "%{SUMMARY}\n"
"$1" > $3; exit 0;;
+       INFO/OS)                rpm -qp --qf "%{OS}\n" "$1"
> $3; exit 0;;
+       INFO/CHANGELOG)         rpm -qp --qf "[*
%{CHANGELOGTIME:date}
%{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]\n" "$1" > $3; exit
0;;
+       INFO/SIZE)              rpm -qp --qf "%{SIZE}
bytes\n" "$1" > $3; exit 0;;
        *)
            TMPDIR=/tmp/mctmpdir.$$
            mkdir $TMPDIR
            cd $TMPDIR
-           rpm2cpio $1 | cpio -iumd --quiet $2 >/dev/null
-           mv $2 $3
+           rpm2cpio "$1" | cpio -iumd --quiet "$2"
>/dev/null
+           mv "$2" "$3"
            cd /
            rm -rf $TMPDIR;;
     esac
@@ -146,8 +146,8 @@
 mcrpmfs_run ()
 {
     case "$2" in
-       INSTALL) echo "Installing $1"; rpm -ivh $1; exit 0;;
-       UPGRADE) echo "Upgrading $1"; rpm -iUvh $1; exit 0;;
+       INSTALL) echo "Installing \"$1\""; rpm -ivh "$1";
exit 0;;
+       UPGRADE) echo "Upgrading \"$1\""; rpm -iUvh "$1";
exit 0;;
     esac
 }

@@ -156,8 +156,8 @@
 export LC_ALL

 case "$1" in
-  list) mcrpmfs_list $2; exit 0;;
-  copyout) mcrpmfs_copyout $2 $3 $4; exit 0;;
-  run) mcrpmfs_run $2 $3; exit 1;;
+  list) mcrpmfs_list "$2"; exit 0;;
+  copyout) mcrpmfs_copyout "$2" "$3" "$4"; exit 0;;
+  run) mcrpmfs_run "$2" "$3"; exit 1;;
 esac
 exit 1
Comment 1 Marc MERLIN 1998-11-27 20:28:59 EST
"which I will only send by Email" -> "which I will also send by Email"
(as suggested by the FAQ).
Sorry for the confusion

PS: Not just $1 has to be protected, other numeral variables also do
Comment 2 Aleksey Nogin 1998-12-04 03:33:59 EST
Because of the bug in Bugzilla, e-mail with the patch went to the
wrong directory. It can be found at
http://developer.redhat.com/bugzilla/data/maildir/09/1

P.S. I created a bug report #292 describing this problem
Comment 3 Marc MERLIN 1998-12-05 01:19:59 EST
While reporting the bug to the mc team, I fixed this part of the
patch (posted by someone else on bugzilla and that I re-used):
-    rpm -qlvp $1 | sed -e 's/^\(..........\)[-t] /\1 1 /'
+    rpm -qlvp "$1" | sed -e 's/^\(..........\)/\1 1 /'

to become

-    rpm -qlvp $1 | sed -e 's/^\(..........\)[-t] /\1 1 /'
+    rpm -qlvp "$1" | sed -e 's/^\(..........\)[-t]* /\1 1 /'

This way it will work with both older and newer versions of RPM
Comment 4 Marc MERLIN 1999-03-17 15:46:59 EST
FYI, I reported the bug and send a fix to the mc team a couple of
months ago. It was checked in their CVS tree, and the fix should be
in the latest release
Comment 5 Preston Brown 1999-03-18 10:45:59 EST
fixed in latest mc release, as reported.

Note You need to log in before you can comment on or make changes to this bug.