Leave caches out of the walk by default (closes #181)
check / check (push) Canceled after 0s

The default excludes now cover caches that programs and package
managers fill again on their own. On Linux: /var/cache and, for root
and each user under /home, .cache, .npm, .cargo/registry and
go/pkg/mod. On macOS: /private/var/folders, /Library/Caches and, for
each user, Library/Caches plus the same four. README and scan --help
list them; --no-default-excludes still turns them all off.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-11 05:41:30 +00:00
1 parent 6caaff935a
commit 8ff9353da0
4 files changed
+75 -15

No files matched your search

+22 -12
View File
@@ -129,8 +129,8 @@ walk"). As the file `/etc/cron.d/sfdupes`:
- one line naming the database;
- progress lines, as described under "Progress";
- a warning for each path it skips;
- a line for each system or temporary directory the walk leaves out (see
"Rules for the walk");
- a line for each system, temporary or cache directory the walk leaves out
(see "Rules for the walk");
- a line for each path left out because its filesystem is one the kernel,
the core of the operating system, makes up or keeps in memory, such as
`tmpfs`;
@@ -302,8 +302,9 @@ The reference below is also the program's specification.
directories on other filesystems, as the same flag does for `du` and `rsync`.
By default the walk also enters directories on other filesystems.
- `--no-default-excludes` (`scan`) lets the walk enter the default excludes.
Those are the system and temporary directories the walk otherwise leaves out,
such as `/var/tmp` on Linux (see "Rules for the walk").
Those are the system, temporary and cache directories the walk otherwise
leaves out, such as `/var/tmp` and `/var/cache` on Linux (see "Rules for the
walk").
- `--exclude PATH` (`scan`) keeps the walk out of `PATH` and everything below
it. `PATH` may be a directory or a file. The flag may be given more than once.
The walk knows `PATH` by its device ID and inode number, as it knows the
@@ -570,13 +571,18 @@ walk practical on large or busy storage pools.
it, as described under "What a scan does to the database".
`--no-default-excludes` does not change this rule.
- Below an operand, the walk does not enter a default exclude. On Linux, the
default excludes hold temporary files and the kernel's view of the running
system. They depend on the system, and `sfdupes scan --help` lists those of
the system it runs on. On Linux they are:
- Below an operand, the walk does not enter a default exclude. The default
excludes hold the kernel's view of the running system, temporary files, and
caches. A cache here is data that programs and package managers download or
build again on their own. The default excludes depend on the system, and
`sfdupes scan --help` lists those of the system it runs on. In the lists, `*`
stands for any one directory name, so `/home/*/.cache` covers each user's
cache. On Linux they are:
```
/proc, /sys, /dev, /run, /tmp, /var/tmp
/proc, /sys, /dev, /run, /tmp, /var/tmp, /var/cache
/root/.cache, /root/.npm, /root/.cargo/registry, /root/go/pkg/mod
/home/*/.cache, /home/*/.npm, /home/*/.cargo/registry, /home/*/go/pkg/mod
```
On macOS they are:
@@ -584,11 +590,15 @@ walk practical on large or busy storage pools.
```
/dev, /private/tmp, /private/var/tmp, /private/var/vm
/System/Volumes/VM, /System/Volumes/Data
/private/var/folders, /Library/Caches
/Users/*/Library/Caches, /Users/*/.cache, /Users/*/.npm
/Users/*/.cargo/registry, /Users/*/go/pkg/mod
```
A walk of `/` on macOS reaches everything in `/System/Volumes/Data` already,
through firmlinks. Firmlinks are the links macOS uses to show the data
volume inside the system volume. Walking `/System/Volumes/Data` as well
`/private/var/folders` holds each user's temporary files and caches on
macOS. A walk of `/` on macOS reaches everything in `/System/Volumes/Data`
already, through firmlinks. Firmlinks are the links macOS uses to show the
data volume inside the system volume. Walking `/System/Volumes/Data` as well
would record each of those files twice. Any other system has no default
excludes.