diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-17 19:19:56 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-17 19:19:56 +0200 |
| commit | 3e0177f613a6b04f957d0b4a426a940a9e68092a (patch) | |
| tree | 445e7cfa95d10577726bbe31b14ba24a92c1f6cc /bin | |
| parent | a906a204a8b9b6d8b46a938915737f6dc587e334 (diff) | |
| download | conky-theme-udt-3e0177f613a6b04f957d0b4a426a940a9e68092a.tar.gz conky-theme-udt-3e0177f613a6b04f957d0b4a426a940a9e68092a.zip | |
docs: correct the claim about counting a symlinked directory
GNU ls follows a symlink to a directory with or without a trailing slash, so
both forms count the packages correctly. Only -d lists the link itself.
The original claim came from a count taken where the path did not resolve at
all, and it reached the spec, the plan and two commit messages. The count was
always right; the reason given for it was not, and a comment that teaches the
next reader something false is worse than no comment.
Records the real trap in its place: ls aliased to a long format counts its
"total" header as a package.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/slackware-sample.sh | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bin/slackware-sample.sh b/bin/slackware-sample.sh index 3eb4818..066c520 100755 --- a/bin/slackware-sample.sh +++ b/bin/slackware-sample.sh @@ -18,10 +18,15 @@ trap 'rm -f "$TMP"' EXIT VERSION=$(cat /etc/slackware-version 2>/dev/null || echo unknown) -# The TRAILING SLASH is load-bearing. /var/log/packages is a symlink to -# /var/lib/pkgtools/packages, and `ls -1 /var/log/packages` lists the link -# itself: one entry. With the slash it lists the target's contents, which on -# this machine is some 2800 packages. Do not remove it as cosmetic. +# /var/log/packages is a symlink to /var/lib/pkgtools/packages. GNU ls follows +# it either way, so the trailing slash is belt and braces rather than the load +# bearing part; what would break this is adding -d, which lists the link itself +# and reports one package. +# +# The real trap is `ls` being aliased: the user's shell aliases it to `ls -lh`, +# and a long-format listing counts a "total" header line as a package. This +# script is not interactive so aliases do not apply, but do not move this +# counting into anything that is. PACKAGES=$(ls -1 /var/log/packages/ 2>/dev/null | wc -l) # Epochs, never formatted dates. The shell function this replaces rebuilds a |
