Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 372275 - sys-apps/uam: add support for handling eject requests
Summary: sys-apps/uam: add support for handling eject requests
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement
Assignee: Michał Górny
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-19 16:31 UTC by Michał Górny
Modified: 2011-08-30 11:13 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-06-19 16:31:51 UTC
As now uam does mounts on CD/DVD media changes, it would be useful if it could handle eject requests as well.

This probably means introducing a new uam-eject.sh script or adding a new feature to uam-umount.sh. The script has to unmount the device (without -f/-l) and eject it if the unmount succeeded. Otherwise, it would wait for an another eject request.
Comment 1 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2011-06-19 22:14:58 UTC
From my very limited understanding of the architecture of uam, my best guess is:

-ACTION=="change", RUN+="/lib/udev/uam/uam-mount.sh"
+ACTION=="change", RUN+="/lib/udev/uam/uam-remount.sh"

where uam-remount.sh would just run uam-umount.sh and then uam-mount.sh. I assume this is the nature of udev CDROM events -- that the state of media being present has changed but in an unknown way? Also, uam-remount.sh could first check if the media present is still the same as it used to be and then noop.

Sorry, I don't use uam myself though I probably should try it out ;-). And it seems much more convenient of a way to mount flashdrives...
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-06-20 06:38:58 UTC
(In reply to comment #1)
> From my very limited understanding of the architecture of uam, my best guess
> is:
> 
> -ACTION=="change", RUN+="/lib/udev/uam/uam-mount.sh"
> +ACTION=="change", RUN+="/lib/udev/uam/uam-remount.sh"
> 
> where uam-remount.sh would just run uam-umount.sh and then uam-mount.sh. I
> assume this is the nature of udev CDROM events -- that the state of media being
> present has changed but in an unknown way? Also, uam-remount.sh could first
> check if the media present is still the same as it used to be and then noop.

Well, the trick is that when media change event occurs, the CD is no longer mounted. It seems that either eject or the kernel unmounts it beforehand. Though it may be a good idea to run an orphan scan there.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-06-20 07:23:43 UTC
Fixed in two commits:
- 27f8832 [1] to cleanup orphans when media ejected using 'eject' program,
- d016417 [2] to unmount filesystems when using the 'eject' button.

I think this is going to be released as 0.2.

[1]:https://github.com/mgorny/uam/commit/27f8832
[2]:https://github.com/mgorny/uam/commit/d016417
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-08-30 11:13:20 UTC
Ok, this was fixed in uam-0.2.