Re: Patch for knoppix-mkimage
On Sun, Apr 27, 2008 at 12:32:44AM +0200, Ronny Standtke wrote:
> Hi all,
> Today I used Knoppix-5.3.1 for a while and then decided to create a persistent
> KNOPPIX disk image.
> My first attempt failed with an error message from rsync that there is no
> space left on the device. I tried increasing the disk image size again and
> again but it did not help. Then I noticed that the path names in the rsync
> error message became longer and longer and looked like an endless recursion.
> At this point in time I started to investigate this issue a little more...
> knoppix-mkimage mounts the disk image to /tmp/knxhome and uses this directory
> as the destination when rsync'ing /ramdisk. There is one central issue
> here: /tmp/knxhome is a subdirectory of /ramdisk. So basically, you are
> rsyncing a directory to one of its own subdirectories. In previous versions
> of Knoppix this was probably not really a problem, because older versions of
> rsync first get a complete file-list and then start to copy files. But, since
> version 3.0 rsync uses a feature called "incremental file-list recursion". It
> just looks up some files, transfers them, looks up the next bunch of files,
> etc. Now you probably see the problem: When /ramdisk contains much more files
> than rsync catches with its first file-list creation round and rsync finally
> reaches /ramdisk/tmp/knxhome it considers the already copied files as new
> files to be copied. Eternal recursion starts and the universe collapses. :-)
> You can reproduce this bug by booting Knoppix, creating a lot of files in your
> home directory (i.e. surf the web for a while, install some software packages
> or unpack some source packages) and try creating the persistent disk image.
Curiously, I did not catch this bug before, probably because of what you
suggested, that previous versions of rsync handled overlapping src/dst
copies differently. And it just was wrong to mount the persistent home
inside the directory to copy in the first place. Actually, /tmp should
probably be a different tmpfs than /ramdisk.
> I fixed this bug by using /tmp_knxhome as mount point for the disk image (see
> attached patch). I am not a l33t shell script h4xor, not at all. I don't know
> if I did everything right. Please take a look.
Your patch looks OK, thanks a lot. Scheduled for next release.