Description of problem: when umounting during reboot or halt, if a device mount point in /media contains a space, the umount fails. for example, i used the part of the script responsible for umounting : there is the result : > mount | awk '{ print $3 }' | while read line; do > mount -n -o ro,remount $line > done mount: can't find /media/UDISK in /etc/fstab or /etc/mtab in fact, my usbkey is named "UDISK 2.0" and so is mounted in "/media/UDISK 2.0" and umount fails due to the space Version-Release number of selected component (if applicable): initscripts-8.31.1-1 How reproducible: always Steps to Reproduce: 1. mount a device labeled with a name containing a space 2. init 6 (or init 0) 3. enjoy Actual results: the device is not cleanly umounted at shutdown Expected results: the device MUST BE cleanly umounted at shudown Additional info:
umount using the device instead of the mount point would solve the problems. further more, it doesn't matter the way it's called when you umount prior to shutdown or reboot. changing awk {print $3} by awk {print $1} in the S01reboot script do the trick.
Yeah, but that will get multiple 'none' entries if any pseudo-fses are left, so that probably won't work. Does it work for you if you just quote the arg to mount?
how can you quote when listing mount point with mount ? it's mount that don't quote, not the script... so i suggest finding mounted devices like this : mount | awk '{ print $1 }' | grep "^/dev/"
Created attachment 126947 [details] Use bash arrays for paths from fstab Parsing (mount) output won't ever be reliable because (mount) doesn't escape anything and both device and mount point paths can contain arbitrary characters: /my/device on /no path on on /my path on type ext3 (rw) [label] type ext3 (rw) is one of the simpler cases (no embedded newlines). The attached patch converts initscripts to never parse (mount) output and to properly decode {fstab,mtab,/proc/mounts} entries. Handling arbitrary strings in shell is rather awkward... Note that this is only a proof of concept and it was very lightly tested. The real patch should probably also at least unify the cut&pasted unmounting loops. Does the idea look reasonable? If so, I'll try to prepare something rawhide-worthy.
That looks somewhat ugly, and probably rather slow. Perhaps just wrapping getmntent() would be simpler?
*** Bug 187554 has been marked as a duplicate of this bug. ***
Created attachment 128719 [details] Add with-fstab-escapes How about this (completely untested)? It allows (with-fstab-escapes umount $(awk 'whatever {print $2}')) which is much simpler than the previous approach, and should be a bit faster too. The "with-fstab-escapes" name is too LISPy and too long, I can't think of anything better though.
Created attachment 128724 [details] Replace the cut&pasted umounting loops by shell functions Additional cleanup: save ~50 lines of copy&pasted shell. Also adds handling of comments in fstab to same paths where it was missing.
I'd just call it 'fstab-escape'. Ideally, there would be a /libexec to stuff it in , but putting it in /sbin should be ok.
fstab-unescape? It doesn't escape anything...
Or decode, or.... really it doesn't matter that much, it's an implementation detail.
A fix for this is in 8.34-1.
Yes, this update resolves the issue (at least for my case). It should be noted that glib2 must be updated in order to use Rawhide initscripts 8.34-1 on Fedora Core 5.
*** Bug 189695 has been marked as a duplicate of this bug. ***