Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16df355ef2 |
No files matched your search
@@ -841,15 +841,15 @@ Only one `scan` runs against a database at a time.
|
||||
- For its whole run, `scan` holds a lock on a lock file beside the database. The
|
||||
lock is taken with the `flock(2)` system call, and only one process can hold
|
||||
it. The lock file's name is the database's path, with symlinks resolved, plus
|
||||
`.lock`. By default that is `/var/lib/sfdupes/db.sqlite.lock`. Every path to
|
||||
one database therefore names the same lock file.
|
||||
`.lock`. By default that is `/var/lib/sfdupes/db.sqlite.lock`. A path through
|
||||
a symlink names the same lock file.
|
||||
- `scan` takes the lock before it walks the filesystem or opens the database.
|
||||
Just before that, it creates the database file, empty, if it is missing. So
|
||||
the lock file is named the same way before the first scan as after. A symlink
|
||||
at the database path is followed, and its target is created.
|
||||
- A second `scan` against the same database does not wait. It fails at once with
|
||||
an error naming the lock file, and exits 1. It has walked nothing and opened
|
||||
nothing. The running scan carries on.
|
||||
an error naming the lock file, and exits 1. It has walked nothing and has not
|
||||
opened the database. The running scan carries on.
|
||||
- The lock file is created on first use and never deleted. Only its owner may
|
||||
open it. A leftover file blocks nothing. The lock ends with the process that
|
||||
holds it, however that process ends. Deleting the file while a scan runs would
|
||||
|
||||
+1
-1
@@ -1340,7 +1340,7 @@ func assertSecondScanFails(t *testing.T, path string) {
|
||||
}
|
||||
|
||||
func TestRunSecondScanThroughSymlinkFails(t *testing.T) {
|
||||
// README §Database: every path to one database names the same lock
|
||||
// README §Database: a path through a symlink names the same lock
|
||||
// file, so while a scan holds it through one path, a scan through
|
||||
// another fails, naming the lock file beside the database's real
|
||||
// path.
|
||||
|
||||
Reference in new issue
Block a user