casper-helpers:where_is_mounted fails in obscure cases

Bug #346941 reported by Steve Dodd
2
Affects Status Importance Assigned to Milestone
casper (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: casper

where_is_mounted() in casper-helpers contains the following line:

grep "^$device " /proc/mounts | read d mountpoint rest

This will not work, as the read command is executed in a subshell because of the pipeline and so does not set the variables in the main script. The following should work instead:

mountpoint=`grep "^$device " /proc/mounts | awk '{print $2}'`

(tested at the commandline from an interrupted initramfs)

This will only cause problems if casper is looking for files to mount persistently on an already-mounted device, and that device is not mounted on whatever directory was left in $mountpoint from its previous use. The situation I encountered it in was trying to loopback mount an ext3 casper-rw file which was on the same partition as an iso image I was using with "iso-scan/filename=xxx."

This might explain bug #258990.

(OT: is there a reason to restrict find_cow_device to only looking for loopback-mountable images on vfat filesystems?)

Revision history for this message
Colin Watson (cjwatson) wrote :

Thanks. The only modification I'd make is the insertion of a head -n1, just in case it's already mounted in multiple places.

Regarding your question about find_cow_device, see bug 230703.

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

This bug was fixed in the package casper - 1.169

---------------
casper (1.169) jaunty; urgency=low

  * [ -w /cdrom ] turns out not to be a sufficient test for files under
    /cdrom being writable; with busybox, it always returns true even for
    read-only filesystems. Explicitly check for the read-only flag in mount
    output to work around this.
  * Fix where_is_mounted helper function to actually produce output (thanks,
    Steve Dodd; LP: #346941).
  * Add a comment to find_cow_device explaining why the choice of
    filesystems is restricted (I asked for this comment in LP #230703 but it
    apparently never got written).

 -- Colin Watson <email address hidden> Tue, 07 Apr 2009 01:47:05 +0100

Changed in casper (Ubuntu):
status: New → Fix Released
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.