-
-
Notifications
You must be signed in to change notification settings - Fork 268
rm -Rf $BUILD_DIR/outputfs if it is not mounted anymore #578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
rm -Rf $BUILD_DIR/outputfs if it is not mounted anymore
|
I am curious how this can happen. If the filesystem is unmounted, there should not be any file left under the mountpoint, unless |
|
What is actually the purpose of |
|
@pcahyna |
|
@jsmeix I saw that comment and I don't understand it, because here
|
Instead of special code in cleanup_build_area_and_end_program(), use the shared helper to remove $BUILD_DIR/outputfs. This translates to using rmdir always instead of using rm -Rf in case the filesystem is not mounted. This is simpler and safer (disaster could arise if the mointpoint command fails for any unexpected reason, for example). It intentionally reverts PR rear#578 (commit 606d8ce). It is not clear why was .lockfile present in the unmounted outputfs (this was the reason for the change). According to my understanding of the code, this should not happen. Even if this happens, it means that some part of the code is using outputfs incorrectly (it should be used only if mounted, otherwise data put there are lost) andf it is better to be warned about the problem rather than ignore it by blindly removing the whole directory.
Instead of special code in cleanup_build_area_and_end_program(), use the shared helper to remove $BUILD_DIR/outputfs. This translates to using rmdir always instead of using rm -Rf in case the filesystem is not mounted. This is simpler and safer (disaster could arise if the mountpoint command fails for any unexpected reason, for example). It intentionally reverts PR rear#578 (commit 606d8ce). It is not clear why was .lockfile present in the unmounted outputfs (this was the reason for the change). According to my understanding of the code, this should not happen. Even if this happens, it means that some part of the code is using outputfs incorrectly (it should be used only if mounted, otherwise data put there are lost) and it is better to be warned about the problem rather than ignoring it by blindly removing the whole directory.
I guess that this is the use case indeed to prevent overwriting of logs. The 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 >&2Or, at least comment it out. |
Instead of special code in cleanup_build_area_and_end_program(), use the shared helper to remove $BUILD_DIR/outputfs. This translates to using rmdir always instead of using rm -Rf in case the filesystem is not mounted. This is simpler and safer (disaster could arise if the mountpoint command fails for any unexpected reason, for example). It intentionally reverts PR rear#578 (commit 606d8ce). It is not clear why was .lockfile present in the unmounted outputfs (this was the reason for the change). According to my understanding of the code, this should not happen. Even if this happens, it means that some part of the code is using outputfs incorrectly (it should be used only if mounted, otherwise data put there are lost) and it is better to be warned about the problem rather than ignoring it by blindly removing the whole directory.
Instead of special code in cleanup_build_area_and_end_program(), use the shared helper to remove $BUILD_DIR/outputfs. This translates to using rmdir always instead of using rm -Rf in case the filesystem is not mounted. This is simpler and safer (disaster could arise if the mountpoint command fails for any unexpected reason, for example). It intentionally reverts PR rear#578 (commit 606d8ce). It is not clear why was .lockfile present in the unmounted outputfs (this was the reason for the change). According to my understanding of the code, this should not happen. Even if this happens, it means that some part of the code is using outputfs incorrectly (it should be used only if mounted, otherwise data put there are lost) and it is better to be warned about the problem rather than ignoring it by blindly removing the whole directory.
…-updated Fix backup removal in exit task and cleanup handling of URL mountpoints: Cleanup of temporary mount point handling, particularly for output. Unification of mount point umount and cleanup move to the mount_url() and umount_url() functions. Replaced the various "rm -rf" of the mountpoint by "rmdir" which fixes #2611 Added lazy umount in case normal umount does not succeed. If build dir is kept (cf. KEEP_BUILD_DIR), propose a safe way to remove it to the user via "rm -Rf --one-file-system" instead of just "rm -Rf" where the user risks to remove everything below that mountpoint if still mounted. Fixes also some other bugs noted in the process: Filesystem-specific umount command not called 20359a9#r51319634 Unknown schemes considered invalid, see the discussion under #932 Identical scripts under DUPLICITY and YUM replaced by symlinks. Reverted #782 that had reintroduced #465 which got re-reported as #2611 Reverted #578 because it is not clear how .lockfile can exist in the unmounted filesystem, and if it does, it is a bug. Reverted d850c40 because it became meanwhile obsoleted by a8fdc44
Instead of special code in cleanup_build_area_and_end_program(), use the shared helper to remove $BUILD_DIR/outputfs. This translates to using rmdir always instead of using rm -Rf in case the filesystem is not mounted. This is simpler and safer (disaster could arise if the mountpoint command fails for any unexpected reason, for example). It intentionally reverts PR rear#578 (commit 606d8ce). It is not clear why was .lockfile present in the unmounted outputfs (this was the reason for the change). According to my understanding of the code, this should not happen. Even if this happens, it means that some part of the code is using outputfs incorrectly (it should be used only if mounted, otherwise data put there are lost) and it is better to be warned about the problem rather than ignoring it by blindly removing the whole directory.
Hi,
this is the pull request for #575 to delete $BUILD_DIR/outputfs if it is not mounted anymore.
regards
goldzahn