#578 PR merged: rm -Rf $BUILD_DIR/outputfs if it is not mounted anymore

Labels: enhancement

goldzahn opened issue at 2015-04-22 11:24:

Hi,

this is the pull request for #575 to delete $BUILD_DIR/outputfs if it is not mounted anymore.

regards
goldzahn

pcahyna commented at 2021-05-26 16:27:

I am curious how this can happen. If the filesystem is unmounted, there should not be any file left under the mountpoint, unless $BUILD_DIR/outputfs has not been a mountpoint at all and .lockfile got created in the local filesystem, which would indicate a bug (if $BUILD_DIR/outputfs is not a mounted filesystem and we put files under it, the files will just get lost).

pcahyna commented at 2021-05-26 16:36:

What is actually the purpose of .lockfile? The only use seems to be to prevent double moves of the result directory if $OUTPUT_URL == $BACKUP_URL and NETFS_KEEP_OLD_BACKUP_COPY and KEEP_OLD_OUTPUT_COPY are used (and what will hapen if the former is set and the latter is unset?).

jsmeix commented at 2021-05-27 09:08:

@pcahyna
I don't know what the actual purpose of .lockfile is.
I would have to reverse engineer it by digging its actual usage in the code.
At first glance I found
https://github.com/rear/rear/blob/master/usr/share/rear/output/default/250_create_lock.sh
see the initial comment therein.
I never used KEEP_OLD_OUTPUT_COPY.
I only tried out NETFS_KEEP_OLD_BACKUP_COPY at some longer time ago
cf. what I wrote about "Regarding NETFS_KEEP_OLD_BACKUP_COPY" in
https://en.opensuse.org/SDB:Disaster_Recovery

pcahyna commented at 2021-05-27 09:14:

@jsmeix I saw that comment and I don't understand it, because here https://github.com/rear/rear/blob/7bcad6b517aad2fcaf42d2a12464b42b5508a856/usr/share/rear/output/default/150_save_copy_of_prefix_dir.sh#L15 the lockfile gets just removed if it exists, so I don't see how can it avoid anything.

gdha commented at 2021-06-11 09:26:

@pcahyna

What is actually the purpose of .lockfile? The only use seems to be to prevent double moves of the result directory if $OUTPUT_URL == $BACKUP_URL and NETFS_KEEP_OLD_BACKUP_COPY and KEEP_OLD_OUTPUT_COPY are used (and what will hapen if the former is set and the latter is unset?).

I guess that this is the use case indeed to prevent overwriting of logs. The KEEP_OLD_OUTPUT_COPY variable I never used (and to be honest did not know it existed which proofs that even I is out-of-sync ;-) with all the ReaR attributes). Sig...

In script https://github.com/rear/rear/blob/master/usr/share/rear/output/default/150_save_copy_of_prefix_dir.sh I think it would be wiser to remove the lines

# an old lockfile from a previous run not cleaned up by output is possible
[[ -f ${opath}/.lockfile ]] && rm -f ${opath}/.lockfile >&2

Or, at least comment it out.


[Export of Github issue for rear/rear.]