Skip to content
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

a subdirectory scan may "loose" files outside that subdirectory #15

Closed
poeml opened this issue Jun 5, 2015 · 0 comments
Closed

a subdirectory scan may "loose" files outside that subdirectory #15

poeml opened this issue Jun 5, 2015 · 0 comments

Comments

@poeml
Copy link
Owner

poeml commented Jun 5, 2015

                                                                                                                                        [          ]

Issue migrated (2015-06-05) from old issue tracker http://mirrorbrain.org/issues/issue19

Title    a subdirectory scan may "loose" files outside that subdirectory
 Priority   bug                    Status           resolved
Superseder                        Nosy List         poeml
Assigned To poeml                 Keywords

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:

http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/tools/scanner.pl?view=markup

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/%'.

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.

History
         Date         User  Action            Args
2009-11-04 19:04:02 poeml set    status: testing -> resolved
                                   messages: + msg48
2009-10-30 12:18:12 poeml set    messages: + msg46
2009-10-30 12:12:50 poeml set    messages: + msg45
2009-10-30 12:11:59 poeml set    status: unread -> testing
2009-10-30 12:11:53 poeml create

(end of migrated issue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant