Fixes the issue highlighted in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265200.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 53289 Build 50180: arc lint + arc unit
Event Timeline
Comment Actions
Before patch:
% du -aht 20000000 /bin 8.5K /bin/ln 8.5K /bin/chflags 8.5K /bin/rm 8.5K /bin/test 8.5K /bin/timeout 21K /bin/dd 13K /bin/cp 69K /bin/pax 4.5K /bin/freebsd-version 8.5K /bin/cat 4.5K /bin/mkdir 13K /bin/pkill 13K /bin/expr 305K /bin/csh 37K /bin/ed 45K /bin/rmail 25K /bin/ls 13K /bin/date 13K /bin/setfacl 8.5K /bin/getfacl 4.5K /bin/rmdir 125K /bin/sh 4.5K /bin/domainname 4.5K /bin/pwd 8.5K /bin/uuidgen 8.5K /bin/nproc 21K /bin/stty 8.5K /bin/kenv 33K /bin/ps 4.5K /bin/echo 4.5K /bin/realpath 4.5K /bin/hostname 8.5K /bin/sleep 13K /bin/mv 8.5K /bin/chmod 4.5K /bin/sync 8.5K /bin/pwait 13K /bin/df 8.5K /bin/kill 13K /bin/chio
After patch:
# /usr/obj/usr/src/amd64.amd64/usr.bin/du/du -aht 20000000 /bin #
usr.bin/du/du.c | ||
---|---|---|
323–326 | DU(1) says -t threshold Display only entries for which size exceeds threshold. % du -ah | sort -n 4.0K ./Makefile 4.0K ./Makefile.depend 4.0K ./tests/Makefile 4.0K ./tests/Makefile.depend 8.0K ./du.1 8.0K ./tests/du_test.sh 16K ./du.c 20K ./tests 56K . % du -ah -t 4k | sort -n 4.0K ./Makefile 4.0K ./Makefile.depend 4.0K ./tests/Makefile 4.0K ./tests/Makefile.depend 8.0K ./du.1 8.0K ./tests/du_test.sh 16K ./du.c 20K ./tests 56K . % du -ah -t 5k | sort -n 8.0K ./du.1 8.0K ./tests/du_test.sh 16K ./du.c 20K ./tests 56K . Since the manpage says only files with a size *exceeding* the threshold will be displayed, shouldn't the 4K files be excluded with -t 4k? DU(1) from coreutils 9.3 says, -t, --threshold=SIZE exclude entries smaller than SIZE which implies that files with a size equal to the threshold will be displayed. This is indeed the case. % du -ab /etc/X11 | sort -n 0 /etc/X11/xorg.conf.d 318 /etc/X11/xinit/xinitrc.d/40-libcanberra-gtk-module.sh 538 /etc/X11/xinit/xinitrc.d/50-systemd-user.sh 856 /etc/X11 856 /etc/X11/xinit 856 /etc/X11/xinit/xinitrc.d % % du -ab /etc/X11 -t 856 | sort -n 856 /etc/X11 856 /etc/X11/xinit 856 /etc/X11/xinit/xinitrc.d % % du -ab /etc/X11 -t 857 | sort -n % (The -b flag in coreutils du says it's "equivalent to '--apparent-size --block-size=1'". We require a minimum block size of 512, so we can't do the same comparison.) I think the best thing to do is update our man page to say something like this. -t threshold Exclude entries smaller than threshold. |
Comment Actions
Made requested changes, and updated base revision.
- use -h for consistent test output
- update man page to correctly reflect -t behavior
- fix typo in test
- Merge branch 'main' into du-at