Bug 608502 - Fails to unmount phone card accessed via USB due to space in mount point
Summary: Fails to unmount phone card accessed via USB due to space in mount point
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: eject
Version: 13
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Kamil Dudka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-06-27 21:30 UTC by Bill Crawford
Modified: 2010-08-03 00:43 UTC (History)
1 user (show)

Fixed In Version: eject-2.1.5-18.fc12
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-07-08 18:20:02 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Bill Crawford 2010-06-27 21:30:06 UTC
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 21:40:26 UTC
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 21:52:42 UTC
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 23:49:09 UTC
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 23:54:33 UTC
[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 10:13:54 UTC
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 10:44:35 UTC
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 13:02:28 UTC
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 20:21:38 UTC
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 09:45:56 UTC
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 15:52:29 UTC
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 15:52:35 UTC
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 17:16:51 UTC
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 17:29:33 UTC
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 18:19:56 UTC
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-03 00:43:08 UTC
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.