Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 08 Aug 2026 00:10:59 +0000
From:      Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: fd79bf63442e - main - du: Print progress information to stderr
Message-ID:  <6a767413.3d26e.33a62ceb@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=fd79bf63442eefd2c3bfb695a377dbd705f5cc6d

commit fd79bf63442eefd2c3bfb695a377dbd705f5cc6d
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-08 00:10:46 +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
---
 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 db77fb276fe2..fb2b9adafdaa 100644
--- a/usr.bin/du/du.1
+++ b/usr.bin/du/du.1
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd June 9, 2026
+.Dd August 7, 2026
 .Dt DU 1
 .Os
 .Sh NAME
@@ -195,6 +195,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 bf138b1b5e36..47ed3c840d5a 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -270,6 +270,10 @@ main(int argc, char *argv[])
 	xo_open_container("disk-usage-information");
 	xo_open_list("paths");
 	for (errno = 0; (p = fts_read(fts)) != NULL; errno = 0) {
+		if (info) {
+			info = 0;
+			(void)fprintf(stderr, "\t%s\n", p->fts_path);
+		}
 		switch (p->fts_info) {
 		case FTS_D:			/* Ignore. */
 			if (ignorep(p))
@@ -284,10 +288,6 @@ main(int argc, char *argv[])
 			if (p->fts_level <= depth && check_threshold(p))
 				print_file_size(p);
 
-			if (info) {
-				info = 0;
-				(void)printf("\t%s\n", p->fts_path);
-			}
 			break;
 		case FTS_DC:			/* Ignore. */
 			break;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a767413.3d26e.33a62ceb>