Troubleshooting
Outcome: the five surprises this guide's lab actually met, each with its cause and its check. If your surprise is not here, it is probably a chapter 13 limit wearing a costume.
"Duf shows nothing for a path that exists"
./duf / ; echo $?
# (silence) 0
The path exists; the answer is
empty; the exit code says success.
Cause: the filesystem the path
lives on was removed by the default
view's filter (chapter 2) — on the
lab machine this was the root
filesystem itself, and /home/hatch
alone went the same way, because
that volume is mounted at several
places and the path-asking code
met the filtered list first. Check:
add --all —
./duf --all /
— and the row appears. Rule of
thumb: silence from duf means
"filtered", never "missing", and
any conclusion about a disk's
absence needs an --all or --json
run behind it. (The lab also notes,
for completeness, that with --all
the path-mode row for its home
volume carried numbers from the
right filesystem but type labels
from the root overlay's — on
multiply-mounted systems, trust
path mode's numbers before its
labels.)
"Duf says the path does not exist — it does"
./duf /no/such/place
# lstat /no: no such file or directory (exit code 1)
Duf stats the path before
answering, and reports the first
component it cannot find — /no,
not the whole path you typed. On a
long path, work backwards from the
named component; the typo is
usually in it.
"My script reads null / crashes on a missing key"
./duf --json | jq '.[0].size'
# null
The JSON field is total, not
size; the available figure is
free, not avail (chapter 9 has
the full field list). jq answers
null for a field that is not
there instead of failing, and
Python raises KeyError — the
lab's checker did both, in that
order, before its fields were
fixed. When a duf script produces
nonsense, print one whole object
first and read the real names off
it.
"An option cost me a page of usage text"
./duf --bogus
# flag provided but not defined: -bogus
# Usage of ./duf: ... (the full list) (exit code 2)
Duf's flags are Go-style: one dash
or two, no abbreviations. A name it
does not know is a hard error with
the whole usage page attached.
Related, and kinder: an unknown
value for a known flag gets a
sentence instead — unknown device
group: bogus from --only, and
unknown column: bogus (valid:
...) from --sort.
"Duf's count of my disks disagrees with df's / the kernel's"
All three counts can be right.
The kernel's mount list is the
ceiling (76 on the lab machine);
--all and --json match it.
The default table shows the
filtered list (53 there). Df
applies its own, different
collapsing (11 rows there). Before
reporting a discrepancy, say which
of the three lists each number
came from — chapter 4 and chapter
7 between them cover every case
the lab produced.