[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#262868: Fix for the free space problem



Jurij Smakov wrote:
> I was able to trace this problem down to the enable_swap call in the 
> storage_device/label/do_option script of partman-partitioning udeb. As I 
> understand, the device on which the operations are performed is passed 
> to parted_server automatically, based on the current working directory. 
> The call to enable_swap in the above script actually changes the working 
> directory while rescanning the partitions, and "forgets" to restore it to 
> the correct original value on exit. As a result, on a system with more 
> than one disk the subsequent operations may be performed on the disk 
> different from the one they are actually meant for, leading to erratic 
> behavior. A simple patch seems to take care of the problem:

Nice detective work. Since this is a pretty bad behavior of enable_swap I
think it's best to fix it there, with this patch:

Index: definitions.sh
===================================================================
--- definitions.sh	(revision 24301)
+++ definitions.sh	(working copy)
@@ -575,6 +575,7 @@
 
 enable_swap () {
     local swaps dev num id size type fs path name method
+    local startdir="$(pwd)"
     # do swapon only when we will be able to swapoff afterwards
     [ -f /proc/swaps ] || return 0
     swaps=''
@@ -595,6 +596,7 @@
     for path in $swaps; do
 	swapon $path || true
     done
+    cd "$startdir"
 }
 
 disable_swap () {

I have only one drive in my sparc, so I cannot really test this, but I
assume it'll work. I've uploaded partman with this patch.

FWIW, all other scripts that call enable_swap don't seem to care what
the pwd is changed to, except for partman-auto/autopartition which
probably also has a problem on sparc.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature


Reply to: