You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Title a subdirectory scan may "loose" files outside that subdirectory
Priority bug Status resolved
Superseder Nosy List poeml
Assigned To poeml Keywords
The list of filenames that is grabbed at the beginning of a "subdirectory scan" ('mb scan -d DIR') is too broad. It uses a string prefix
match that isn't terminated with a trailing slash. Thus, a scan in "factory" grabs also files in "factory-snapshot". This leads to
deletion of all the files outside of the directory at the end of the scan.
(The deletion is supposed to happen only for the files that have disappeared in the given subdirectory; this is implemented by copying
the list of known files into a temporary database table at the beginning, and each file that is seen on the mirror during scanning is
removed from that table. All remaining files are deleted in the end. Thus, if too many files are grabbed in the beginning, they'll be
deleted, too.)
277 if(length $start_dir) {
278 $sql = "CREATE TEMPORARY TABLE temp1 AS
279 SELECT id FROM filearr
280 WHERE path LIKE '$start_dir%'
281 AND $row->{id} = ANY(mirrors)";
The LIKE expression needs be changed to '$start_dir/%'.
Issue migrated (2015-06-05) from old issue tracker http://mirrorbrain.org/issues/issue19
msg44 (view) Author: poeml Date: 2009-10-30.12:11:52
The list of filenames that is grabbed at the beginning of a "subdirectory scan" ('mb scan -d DIR') is too broad. It uses a string prefix
match that isn't terminated with a trailing slash. Thus, a scan in "factory" grabs also files in "factory-snapshot". This leads to
deletion of all the files outside of the directory at the end of the scan.
(The deletion is supposed to happen only for the files that have disappeared in the given subdirectory; this is implemented by copying
the list of known files into a temporary database table at the beginning, and each file that is seen on the mirror during scanning is
removed from that table. All remaining files are deleted in the end. Thus, if too many files are grabbed in the beginning, they'll be
deleted, too.)
The problem is here:
The LIKE expression needs be changed to '$start_dir/%'.
msg45 (view) Author: poeml Date: 2009-10-30.12:12:50
The fix is successfully tested in openSUSE's setup, where the bug was noticed
msg46 (view) Author: poeml Date: 2009-10-30.12:18:12
Fixed in trunk
http://svn.mirrorbrain.org/viewvc/mirrorbrain?view=revision&revision=7846
msg48 (view) Author: poeml Date: 2009-11-04.19:04:02
Fixed with the 2.10.2 release.
(end of migrated issue)
The text was updated successfully, but these errors were encountered: