git: 887114a9e1ae - stable/14 - du: Print progress information to stderr
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 12 Aug 2026 19:41:42 UTC
The branch stable/14 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=887114a9e1aec877a44ddb7ce1eb4319ee1b19bf
commit 887114a9e1aec877a44ddb7ce1eb4319ee1b19bf
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-08-08 00:10:23 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-08-12 19:20:22 +0000
du: Print progress information to stderr
* On SIGINFO, print the current path to stderr rather than stdout.
* Do so immediately, instead of the next time we finish a directory.
* Document this behavior in the manual page.
PR: 296861
MFC after: 1 week
Fixes: d1588599c024 ("Report the next directory being scanned ...")
Reviewed by: wollman
Differential Revision: https://reviews.freebsd.org/D58702
(cherry picked from commit fd79bf63442eefd2c3bfb695a377dbd705f5cc6d)
---
usr.bin/du/du.1 | 12 +++++++++++-
usr.bin/du/du.c | 8 ++++----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/usr.bin/du/du.1 b/usr.bin/du/du.1
index ea28ed30d032..1c5590d06086 100644
--- a/usr.bin/du/du.1
+++ b/usr.bin/du/du.1
@@ -27,7 +27,7 @@
.\"
.\" @(#)du.1 8.2 (Berkeley) 4/1/94
.\"
-.Dd August 1, 2019
+.Dd August 7, 2026
.Dt DU 1
.Os
.Sh NAME
@@ -176,6 +176,16 @@ and
.Fl Fl si
options all override each other; the last one specified determines
the block counts used.
+.Pp
+If
+.Nm
+receives a
+.Dv SIGINFO
+(see the
+.Cm status
+argument for
+.Xr stty 1 )
+signal, the current file will be written to the standard error output.
.Sh ENVIRONMENT
.Bl -tag -width BLOCKSIZE
.It Ev BLOCKSIZE
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index 90b95b3d86e9..efbf638628f8 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -267,6 +267,10 @@ main(int argc, char *argv[])
err(1, "fts_open");
while (errno = 0, (p = fts_read(fts)) != NULL) {
+ if (info) {
+ info = 0;
+ (void)fprintf(stderr, "\t%s\n", p->fts_path);
+ }
switch (p->fts_info) {
case FTS_D: /* Ignore. */
if (ignorep(p))
@@ -295,10 +299,6 @@ main(int argc, char *argv[])
p->fts_path);
}
}
- if (info) {
- info = 0;
- (void)printf("\t%s\n", p->fts_path);
- }
break;
case FTS_DC: /* Ignore. */
break;