Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 608502 - Fails to unmount phone card accessed via USB due to space in mount point
Fails to unmount phone card accessed via USB due to space in mount point
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: eject (Show other bugs)
13
All Linux
low Severity medium
: ---
: ---
Assigned To: Kamil Dudka
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-27 17:30 EDT by Bill Crawford
Modified: 2010-08-02 20:43 EDT (History)
1 user (show)

See Also:
Fixed In Version: eject-2.1.5-18.fc12
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-07-08 14:20:02 EDT
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 Bill Crawford 2010-06-27 17:30:06 EDT
Description of problem:
Cannot unmount phone card using "eject".

Version-Release number of selected component (if applicable):
2.1.5-18.fc13.i686

How reproducible:
Try to eject a USB device.

Steps to Reproduce:
1. Plug in a Sony Ericsson phone with internal flash card
2. Do stuff
3. Try to eject (which ends the USB connection)
  
Actual results:
Fails with error shown below

Expected results:
Phone displays a "USB connection ended" message (works fine with an older phone where the mount appears as "PHONECARD" without the space).

Additional info:

[root@dhcppc1 tmp]# eject sdc
umount: /media/PHONE\040CARD: not found
eject: unmount of `/media/PHONE\040CARD' failed
[root@dhcppc1 tmp]# ls /media
PHONE CARD
[root@dhcppc1 tmp]# mount
...
/dev/sdc1 on /media/PHONE CARD type vfat (rw,nosuid,nodev,uid=500,utf8,shortname=mixed,flush)
[root@dhcppc1 tmp]# cat /proc/mounts 
...
/dev/sdc1 /media/PHONE\040CARD vfat rw,nosuid,nodev,relatime,uid=500,fmask=0022,dmask=0022,codepage=cp437,iocharset=ascii,shortname=mixed,utf8,flush,errors=remount-ro 0 0
Comment 1 Bill Crawford 2010-06-27 17:40:26 EDT
Works fine when run as "eject sdc1" i.e. referring directly to the partition, so not at all sure what's going on here.
Comment 2 Kamil Dudka 2010-06-27 17:52:42 EDT
Did you try to unmount it by 'unmount'?  What does exactly differ in using 'eject' when compared to 'unmount'?
Comment 3 Bill Crawford 2010-06-27 19:49:09 EDT
As I stated above, "eject" differs from "unmount" and "umount" in that it causes the USB device to be "safely removed" ... I have no idea how this works, I just know it does.

I tried "umount" and it works fine; but that seems to be because bash's tab-completion correctly escapes the space. I speculate that "eject" is not allowing for the \040 escape in the output from /proc/mounts.

I'm disappointed that you're asking *me* for information about how this works, since I'm reporting that it isn't working in this case.
Comment 4 Bill Crawford 2010-06-27 19:54:33 EDT
[root@dhcppc1 tmp]# umount /media/PHONE\ CARD
[root@dhcppc1 tmp]# eject sdc1
[root@dhcppc1 tmp]# 

So in fact my first comment was probably incorrect, I'd already unmounted it before I tried again with the eject. But yes, umount worked correctly with no errors. The eject command needs to correctly interpret the escaping applied in /proc/mounts in order to pass correct arguments to umount.
Comment 5 Kamil Dudka 2010-06-28 06:13:54 EDT
Thanks for the info!  I'll check the processing of mount table in eject.

(In reply to comment #3)
> I'm disappointed that you're asking *me* for information about how this works,
> since I'm reporting that it isn't working in this case.

I was asking for more info, because I need to figure out some reliable steps to reproduce.  Your original steps to reproduce were hard to satisfy for me, as I have no "Sony Ericsson phone with internal flash card" :-)
Comment 6 Bill Crawford 2010-06-28 06:44:35 EDT
OK, fair enough. I thought you were complaining I hadn't tested it (I did). I'm sorry for overreacting.

Should be possible to test by mounting any removable device on a mount point with a space in it, as far as I can tell. I will try when I get home.
Comment 7 Kamil Dudka 2010-06-28 09:02:28 EDT
I've tried to reproduce it with a CD-ROM and the space in mount point does not seem to cause any problems to eject:

# mkdir 'foo bar'

# mount /dev/cdrom 'foo bar'
mount: block device /dev/sr0 is write-protected, mounting read-only

# grep foo /proc/mounts 
/dev/sr0 /root/foo\040bar iso9660 ro,relatime 0 0

# eject -v
eject: using default device `cdrom'
eject: device name is `cdrom'
eject: expanded name is `/dev/cdrom'
eject: `/dev/cdrom' is a link to `/dev/sr0'
eject: `/dev/sr0' is mounted at `/root/foo bar'
eject: checking if device "/dev/sr0" has a removable or hotpluggable flag
eject: unmounting device `/dev/sr0' from `/root/foo bar'
eject: `/dev/sr0' is not a multipartition device
eject: trying to eject `/dev/sr0' using CD-ROM eject command
eject: CD-ROM eject command succeeded
Comment 8 Bill Crawford 2010-06-28 16:21:38 EDT
It only happens when ejecting a device (e.g. "sdc") when a partition of that device is mounted (in this case, /dev/sdc1 on "/media/PHONE CARD"). What other information can I give you?
Comment 9 Kamil Dudka 2010-07-02 05:45:56 EDT
It looks like a call of DeMangleMount() is missing there:

diff --git a/eject.c b/eject.c
index 948e2b2..057d2ea 100644
--- a/eject.c
+++ b/eject.c
@@ -1040,6 +1040,8 @@ static void UnmountDevices(const char *pattern)
  while (fgets(line, sizeof(line), fp) != 0) {
    status = sscanf(line, "%1023s %1023s", s1, s2);
    if (status >= 2) {
+     DeMangleMount(s1);
+     DeMangleMount(s2);
      status = regexec(&preg, s1, 0, 0, 0);
      if (status == 0) {
        if (v_option)


Unfortunately I have no suitable removable device around at the moment, will check it later today.
Comment 10 Fedora Update System 2010-07-02 11:52:29 EDT
eject-2.1.5-18.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/eject-2.1.5-18.fc12
Comment 11 Fedora Update System 2010-07-02 11:52:35 EDT
eject-2.1.5-19.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/eject-2.1.5-19.fc13
Comment 12 Fedora Update System 2010-07-06 13:16:51 EDT
eject-2.1.5-18.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update eject'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/eject-2.1.5-18.fc12
Comment 13 Fedora Update System 2010-07-06 13:29:33 EDT
eject-2.1.5-19.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update eject'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/eject-2.1.5-19.fc13
Comment 14 Fedora Update System 2010-07-08 14:19:56 EDT
eject-2.1.5-19.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 15 Fedora Update System 2010-08-02 20:43:08 EDT
eject-2.1.5-18.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

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