udisks unmount and detach return exit status zero upon failure

Bug #1249856 reported by Mahiar Mody
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
udisks (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

When the unmounting or detaching of an external USB flash drive (Pen drive) fails, using the udisks command, an exit status of SUCCESS (zero) is incorrectly returned.

Steps to reproduce:

1. Check that the external USB flash drive is mounted:

$ mount | grep ^/dev/sdb1
/dev/sdb1 on /media/mody/C207-484B type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2)

2. Ensure that the partition /dev/sdb1 is in use. To do so, simply open another terminal and move into it:

$ cd /media/mody/C207-484B/

3. In a separate terminal attempt to unmount the partition that is in use:

$ udisks --unmount /dev/sdb1
Unmount failed: Cannot unmount because file system on device is busy
$ echo $?
0

Another test

$ udisks --unmount /dev/sdb1 && echo "successfully unmonted" || echo "Failed to unmount"
Unmount failed: Cannot unmount because file system on device is busy
successfully unmonted

4. Similarly run the test for udisks --detach like so:

$ udisks --detach /dev/sdb; echo $?
Detach failed: One or more partitions are busy on /dev/sdb
0

As you can see, clearly the udisks --unmount and the udisks --detach commands fail, but the exit status returned is 0 or Success. This is incorrect behavior. The echo $? should return a non-zero value.

Additional information:

1) The release of Ubuntu used:

Description: Ubuntu 13.04
Release: 13.04

2) The version of udisks in use:

udisks:
  Installed: 1.0.4-7build1
  Candidate: 1.0.4-7build1
  Version table:
 *** 1.0.4-7build1 0
        500 http://us.archive.ubuntu.com/ubuntu/ raring/main amd64 Packages
        100 /var/lib/dpkg/status

3) What you expected to happen:

When udisks --unmount and udisks --detach fail, the exit status should return non-zero, indicating Failure.

4) What happened instead

When udisks --unmount and udisks --detach fail, the exit status currently returs zero, indicating Success.

Tags: udisks
Revision history for this message
Mahiar Mody (mahiarmody) wrote :

Any updates on this?

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in udisks (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.