scan: never record its own database files (closes #115)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
When the database lay under a scanned operand, the walk recorded the database file, its -wal and -shm files and its .lock file like any other file, so every rescan updated them and report paired them with empty files. Once the database and the lock file are open, the scan now notes their device and inode, and the walk passes over a file with one of them, as an operand or below one, printing no line and counting nothing. Matching by device and inode holds through a symlinked directory, where comparing paths would not. A record an earlier scan left for one of them is deleted as unverified. README's smoke-test note on keeping the database out of the tree is gone, as it no longer holds. Judgement call: walkRules, in exclude.go, carries the noted files to the walk. Model: opus-5-5
This commit was merged in pull request #128.
This commit is contained in:
@@ -575,6 +575,15 @@ Rules for the walk:
|
||||
- Never descend into a directory named `.zfs` (ZFS snapshot pseudo-dirs; walking
|
||||
them would list every file once per snapshot), not even when it is an operand;
|
||||
such an operand is dropped the same way.
|
||||
- Never record the scan's own database. Once the database and its `.lock` file
|
||||
are open, `scan` notes the device and inode of the database file, its `-wal`
|
||||
and `-shm` files and its `.lock` file, and the walk passes over a file with
|
||||
one of them, however it reaches it: as an operand, below one, or through a
|
||||
symlinked directory. It prints no line for such a file and does not count it
|
||||
as skipped. A record that an earlier scan left for one of them is deleted,
|
||||
like the record of any file the scan no longer verifies. There is no
|
||||
`-journal` file during the walk, because the database is in WAL mode then (see
|
||||
"Database").
|
||||
- Filesystem boundaries are crossed by default. With `-x` (long form
|
||||
`--one-file-system`, following the GNU `du`/`rsync` convention), never descend
|
||||
into a directory on a different filesystem than its `PATH` operand; each
|
||||
@@ -1161,10 +1170,6 @@ All of the following, run in this directory, must pass:
|
||||
./sfdupes report
|
||||
```
|
||||
|
||||
(The database lives in a temp directory of its own: inside `$d`, the scan
|
||||
would record it, and its empty lock file would join the `empty1`/`empty2`
|
||||
group.)
|
||||
|
||||
Expected from the first `report`: `one.bin`/`copy.bin`/`copy2.bin` form one
|
||||
group (two dupe rows, `first` is the lexicographically smallest path);
|
||||
`t1/f1`/`t2/f1`/`t3/f1` form one group; `t1/sub/f2`/
|
||||
|
||||
Reference in New Issue
Block a user