/usr/lib/os-probes/50mounted-tests uses /var as a temporary directory

Bug #638861 reported by Sachin Garg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
os-prober (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: os-prober

Apart from the fact that os-prober installs itself under the "/usr" hierarchy, thus making it useless to be run in environments where /usr, /var are separate partitions, it also uses the /var directory as a container for temporary mount-points!!!

file: /usr/lib/os-probes/50mounted-tests

 43 tmpmnt=/var/lib/os-prober/mount
 44 if [ ! -d "$tmpmnt" ]; then
 45 mkdir "$tmpmnt"
 46 fi
 47
 48 for type in $types $delaytypes; do
 49 if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then
 50 debug "mounted as $type filesystem"
 51 for test in /usr/lib/os-probes/mounted/*; do
 52 debug "running subtest $test"
 53 if [ -f "$test" ] && [ -x "$test" ]; then
 54 if "$test" "$partition" "$tmpmnt" "$type"; then
 55 debug "os found by subtest $test"
 56 if ! umount "$tmpmnt"; then
 57 warn "failed to umount $tmpmnt"
 58 fi
 59 rmdir "$tmpmnt" || true
 60 exit 0
 61 fi
 62 fi
 63 done
 64 if ! umount "$tmpmnt"; then
 65 warn "failed to umount $tmpmnt"
 66 fi
 67 break
 68 fi
 69 done
 70
 71 rmdir "$tmpmnt" || true

As I understand, we should use the "/tmp" directory for this purpose and lines 43-46 should read:

 43 tmpmnt=/tmp/os-prober/mount
 44 if [ ! -d "$tmpmnt" ]; then
 45 mkdir -p "$tmpmnt"
 46 fi

Use the "-p" option to mkdir to ensure intermediate directories are also created.

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.