Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8c7882cc7 |
@@ -522,9 +522,10 @@ Rules for the walk:
|
|||||||
- Filesystem boundaries are crossed by default. With `-x` (long form
|
- Filesystem boundaries are crossed by default. With `-x` (long form
|
||||||
`--one-file-system`, following the GNU `du`/`rsync` convention), never descend
|
`--one-file-system`, following the GNU `du`/`rsync` convention), never descend
|
||||||
into a directory on a different filesystem than its `PATH` operand; each
|
into a directory on a different filesystem than its `PATH` operand; each
|
||||||
operand is bounded by its own filesystem. The records below such a directory
|
operand is bounded by its own filesystem. The records below such a directory,
|
||||||
count as outside the scanned operands, as described in "`scan` mode" above:
|
unless they lie below an operand at or inside that directory, count as outside
|
||||||
they are not deleted, and their sizes join the size census.
|
the scanned operands, as described in "`scan` mode" above: they are not
|
||||||
|
deleted, and their sizes join the size census.
|
||||||
- On any per-path error (permission denied, file vanished between passes,
|
- On any per-path error (permission denied, file vanished between passes,
|
||||||
unreadable): print a one-line warning to stderr, skip the path, and continue.
|
unreadable): print a one-line warning to stderr, skip the path, and continue.
|
||||||
Per-file errors never abort the run; the final summary reports how many were
|
Per-file errors never abort the run; the final summary reports how many were
|
||||||
|
|||||||
@@ -1334,6 +1334,38 @@ func TestScanOneFilesystemRecordsNestedFileOnce(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestScanOneFilesystemWalksNestedFileOperand checks that with -x a
|
||||||
|
// regular-file operand under another operand is kept when its directory
|
||||||
|
// is on a different filesystem than that operand: the walk of the other
|
||||||
|
// operand does not enter the directory, so the file is recorded once,
|
||||||
|
// as its own operand. The other operand is given a device that no
|
||||||
|
// directory here is on.
|
||||||
|
func TestScanOneFilesystemWalksNestedFileOperand(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
dir := t.TempDir()
|
||||||
|
db := openTestDB(t)
|
||||||
|
file := writeFile(t, dir, "sub/f", pattern(1, 10))
|
||||||
|
|
||||||
|
info, err := os.Lstat(dir)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
dev, ok := deviceOfInfo(info)
|
||||||
|
if !ok {
|
||||||
|
t.Skip("platform exposes no device id")
|
||||||
|
}
|
||||||
|
|
||||||
|
st := syncOneFilesystem(t, db, []string{dir, file}, map[string]uint64{
|
||||||
|
dir: dev + 1, filepath.Dir(file): dev,
|
||||||
|
})
|
||||||
|
|
||||||
|
if st.added != 1 {
|
||||||
|
t.Errorf("%s recorded %d times, want once", file, st.added)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// buildSmokeTree recreates the README smoke-test filesystem layout
|
// buildSmokeTree recreates the README smoke-test filesystem layout
|
||||||
// with deterministic content and returns the tree root.
|
// with deterministic content and returns the tree root.
|
||||||
func buildSmokeTree(t *testing.T) string {
|
func buildSmokeTree(t *testing.T) string {
|
||||||
|
|||||||
Reference in New Issue
Block a user