[Rear-users] stopping rear ends with empty usb disk

Jeroen Hoekx jeroen.hoekx at hamok.be
Thu Jul 14 12:58:24 CEST 2011


Hi all,

On 13 July 2011 10:59, Schlomo Schapiro <schlomo at schapiro.org> wrote:

>> I think, under such conditions, never a rm -rf should run. This is an
>> absolute nogo.
>
> I guess we should check for active mounts before removing, just as a
> safety precaution.

I have attached a patch that's safer in the long run, as far as I can tell.

There are a lot of places in Rear where BUILD_DIR is used instead of
TMP_DIR. The patch fixes that. As a result, only usbfs/, netfs/, tmp/
and root/ are created in BUILD_DIR. I did also change the rm -rf to a
rmdir and the usbfs and netfs stages rmdir their own directory. The
tmp/ and root/ folders can be safely rm -rf'ed because nothing gets
mounted in there.

With the patch, if unmounting fails, the worst thing to happen is that
some directories remain in tmp/.

Is this approach OK for everyone?
Please take a look to see if nothing breaks. If you don't see any
problems, I'll commit the patch tomorrow. It worked fine in my test
VM's and my own machine.

Greetings,

Jeroen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rear-fix-rmrf.patch
Type: application/octet-stream
Size: 33303 bytes
Desc: not available
Url : http://pikachu.3ti.be/pipermail/rear-users/attachments/20110714/25a646e5/attachment.obj 


More information about the rear-users mailing list