[Bug 1880308] [NEW] rmlint in Bionic (18.04 LTS) does not prevent deletion of changed file marked as duplicate

Launchpad Bug Tracker 1880308 at bugs.launchpad.net
Thu Oct 22 20:15:55 UTC 2020


You have been subscribed to a public bug by Sebastien Bacher (seb128):

The shell script generated by version 2.6.1 of rmlint available in
Bionic (18.04 LTS) does not prevent the deletion of the file marked as
duplicate when it no longer matches the original.

steps to reproduce:
1. run rmlint to generate a script for deleting duplicates
rmlint <directory> --types=duplicates -pp -c sh:handler=remove
2. change contents of one of the files marked for removal
3. run generated rmlint.sh with parameter -p (Recheck that files are still identical before removing duplicates.)

expected result: file with changed content should be preserved
current result: the difference between files is discovered, the error is shown (!), but file is removed (!) 

This bug was fixed in the recent commit in the master branch of the
source, it contains the simple change in script template:

The shell script generated by version 2.6.1 of rmlint available in
Bionic (18.04 LTS) does not prevent the deletion of the file marked as
duplicate when it no longer matches the original.

steps to reproduce:
1. run rmlint to generate a script for deleting duplicates
rmlint <directory> --types=duplicates -pp -c sh:handler=remove
2. change contents of one of the files marked for removal
3. run generated rmlint.sh with parameter -p (Recheck that files are still identical before removing duplicates.)

expected result: file with changed content should be preserved
current result: the difference between files is discovered, the error is shown (!), but the file is removed (!) 

I consider this bug important, because it may lead to unexpected data
loss.

Based on git source history, it may be present even in the current
stable version (v. 2.9.0) of rmlint in Focal (20.04LTS).

This bug was fixed in the recent commit in the master branch of the source, it contains a simple change in script template:
$ git show b9d328be2
commit b9d328be2041e42813119d060c86893853b8e250
Author: sarfatis <63501438+sarfatis at users.noreply.github.com>
Date:   Mon May 11 10:02:57 2020 +0200

    fix .sh output template typo
    
    color_reset requires evaluating
    flag error in returned flow control value

diff --git a/lib/formats/sh.sh b/lib/formats/sh.sh
index 1a059e0b..3cdcf8be 100644
--- a/lib/formats/sh.sh
+++ b/lib/formats/sh.sh
(... part removed) 
@@ -160,6 +160,7 @@ original_check() {
     else
         if [ "$(check_for_equality "$1" "$2")" -ne "0" ]; then
             echo "${COL_RED}^^^^^^ Error: files no longer identical - cancelling.....${COL_RESET}"
+            return 1
         fi
     fi
 }
(END)

** Affects: rmlint (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: upgrade-software-version
-- 
rmlint in Bionic (18.04 LTS) does not prevent deletion of changed file marked as duplicate
https://bugs.launchpad.net/bugs/1880308
You received this bug notification because you are a member of Ubuntu Sponsors Team, which is subscribed to the bug report.



More information about the Ubuntu-sponsors mailing list