Compare commits
1
Commits
next
..
6cfeb4ab65
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cfeb4ab65 |
No files matched your search
@@ -689,10 +689,11 @@ scan: skipped /srv/a/closed (permission denied)
|
|||||||
scan: skipped /srv/a/pipe (a FIFO)
|
scan: skipped /srv/a/pipe (a FIFO)
|
||||||
```
|
```
|
||||||
|
|
||||||
The summary counts each path named in such a warning. A line for a path left out
|
The summary counts each path named in such a warning. When a file with several
|
||||||
on purpose starts with `scan: left out` instead, and is not counted. A search of
|
hard links cannot be read, each of its paths gets a warning. A line for a path
|
||||||
the log for `scan: skipped` therefore finds the paths the summary counts. When a
|
left out on purpose starts with `scan: left out` instead, and is not counted. A
|
||||||
file with several hard links cannot be read, each of its paths gets a warning.
|
search of the log for `scan: skipped` therefore finds the paths the summary
|
||||||
|
counts.
|
||||||
|
|
||||||
#### Stopping a scan
|
#### Stopping a scan
|
||||||
|
|
||||||
|
|||||||
@@ -752,9 +752,8 @@ func TestWalkPassesOverRemovedPaths(t *testing.T) {
|
|||||||
|
|
||||||
// TestScanWarnsAboutUnreadablePaths checks that a permission error is
|
// TestScanWarnsAboutUnreadablePaths checks that a permission error is
|
||||||
// still warned about and counted as skipped, unlike a removed path. The
|
// still warned about and counted as skipped, unlike a removed path. The
|
||||||
// walk reaches an unreadable directory. It also reaches a file and a
|
// walk reaches an unreadable directory, and a file in a directory that
|
||||||
// subdirectory in a directory that can be read but not searched. Another
|
// can be read but not searched. Another such file is an operand.
|
||||||
// such file is an operand.
|
|
||||||
//
|
//
|
||||||
//nolint:paralleltest // captureStderr replaces the process-wide os.Stderr
|
//nolint:paralleltest // captureStderr replaces the process-wide os.Stderr
|
||||||
func TestScanWarnsAboutUnreadablePaths(t *testing.T) {
|
func TestScanWarnsAboutUnreadablePaths(t *testing.T) {
|
||||||
@@ -766,7 +765,6 @@ func TestScanWarnsAboutUnreadablePaths(t *testing.T) {
|
|||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
tree := filepath.Join(dir, "tree")
|
tree := filepath.Join(dir, "tree")
|
||||||
walked := writeFile(t, tree, "unsearchable/f", []byte("x"))
|
walked := writeFile(t, tree, "unsearchable/f", []byte("x"))
|
||||||
subdir := filepath.Join(filepath.Dir(walked), "d")
|
|
||||||
operand := writeFile(t, dir, "unsearchable/f", []byte("y"))
|
operand := writeFile(t, dir, "unsearchable/f", []byte("y"))
|
||||||
unreadable := filepath.Join(tree, "unreadable")
|
unreadable := filepath.Join(tree, "unreadable")
|
||||||
|
|
||||||
@@ -775,11 +773,6 @@ func TestScanWarnsAboutUnreadablePaths(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.Mkdir(subdir, 0o750)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
modes := map[string]fs.FileMode{
|
modes := map[string]fs.FileMode{
|
||||||
unreadable: 0,
|
unreadable: 0,
|
||||||
filepath.Dir(walked): 0o400,
|
filepath.Dir(walked): 0o400,
|
||||||
@@ -800,15 +793,14 @@ func TestScanWarnsAboutUnreadablePaths(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
st := syncTree(t, openTestDB(t), tree, operand)
|
st := syncTree(t, openTestDB(t), tree, operand)
|
||||||
if st != (scanStats{skipped: 4}) {
|
if st != (scanStats{skipped: 3}) {
|
||||||
t.Errorf("stats = %+v, want 4 skipped and nothing else", st)
|
t.Errorf("stats = %+v, want 3 skipped and nothing else", st)
|
||||||
}
|
}
|
||||||
|
|
||||||
got := stderr()
|
got := stderr()
|
||||||
for _, warning := range []string{
|
for _, warning := range []string{
|
||||||
"scan: skipped " + unreadable + " (permission denied)\n",
|
"scan: skipped " + unreadable + " (permission denied)\n",
|
||||||
"scan: skipped " + walked + " (permission denied)\n",
|
"scan: skipped " + walked + " (permission denied)\n",
|
||||||
"scan: skipped " + subdir + " (permission denied)\n",
|
|
||||||
"scan: skipped " + operand + " (permission denied)\n",
|
"scan: skipped " + operand + " (permission denied)\n",
|
||||||
} {
|
} {
|
||||||
if !strings.Contains(got, warning) {
|
if !strings.Contains(got, warning) {
|
||||||
|
|||||||
Reference in new issue
Block a user