Bug 229615 - [patch] bin/dd: add status=progress support
Summary: [patch] bin/dd: add status=progress support
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Kyle Evans
URL:
Keywords: needs-qa, patch
Depends on:
Blocks:
 
Reported: 2018-07-08 21:08 UTC by Thomas Hurst
Modified: 2018-08-29 02:21 UTC (History)
2 users (show)

See Also:
kevans: mfc-stable11+
kevans: mfc-stable10-


Attachments
Patch against CURRENT (4.03 KB, patch)
2018-07-08 21:08 UTC, Thomas Hurst
no flags Details | Diff
Patch against STABLE (4.09 KB, patch)
2018-07-08 21:08 UTC, Thomas Hurst
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Hurst 2018-07-08 21:08:23 UTC
Created attachment 194964 [details]
Patch against CURRENT

This adds a simple single-line per-second progress report to dd, mirroring similar functionality in GNU dd:

-% ./dd status=progress if=/dev/zero of=/dev/null
4506408960 bytes transferred in 6 secs (750235686 bytes/sec)
load: 0.72  cmd: dd 91308 [running] 6.90r 0.86u 5.95s 52% 1772k
10116733+0 records in
10116733+0 records out
5179767296 bytes transferred in 6.904121 secs (750242848 bytes/sec)
9006898688 bytes transferred in 12 secs (750133815 bytes/sec)^C
19004509+0 records in
19004508+0 records out
9730308096 bytes transferred in 12.972017 secs (750099839 bytes/sec)

I hit ^T at 6.9 seconds, to demonstrate it behaves well with the SIGINFO handler.

Included are patches against 11-STABLE, and an untested patch against CURRENT (doesn't build on my 11.1 machine due to missing capsicum header).
Comment 1 Thomas Hurst 2018-07-08 21:08:54 UTC
Created attachment 194965 [details]
Patch against STABLE
Comment 2 Thomas Hurst 2018-08-04 03:33:21 UTC
This got 13 likes and 7 retweets on Twitter, that's enough for a review and commit, right? :P
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-08-08 21:37:40 UTC
A commit references this bug:

Author: kevans
Date: Wed Aug  8 21:37:03 UTC 2018
New revision: 337505
URL: https://svnweb.freebsd.org/changeset/base/337505

Log:
  dd: add status=progress support

  This reports the current status on a single line every second, mirroring
  similar functionality in GNU dd, and carefully interacts with SIGINFO.

  PR:		229615
  Submitted by:	Thomas Hurst <tom@hur.st> (modified for style(9) nits by me)
  MFC after:	1 week

Changes:
  head/bin/dd/args.c
  head/bin/dd/dd.1
  head/bin/dd/dd.c
  head/bin/dd/dd.h
  head/bin/dd/extern.h
  head/bin/dd/misc.c
Comment 4 Kyle Evans freebsd_committer freebsd_triage 2018-08-08 21:38:26 UTC
Committed, thanks!
Comment 5 commit-hook freebsd_committer freebsd_triage 2018-08-29 02:18:48 UTC
A commit references this bug:

Author: kevans
Date: Wed Aug 29 02:18:15 UTC 2018
New revision: 338364
URL: https://svnweb.freebsd.org/changeset/base/338364

Log:
  MFC r337505, r337865, r337869: dd status=progress

  r337505:
  dd: add status=progress support

  This reports the current status on a single line every second, mirroring
  similar functionality in GNU dd, and carefully interacts with SIGINFO.

  PR:		229615

  r337865:
  dd: Incorporate some changes from imp for status=progress

  Notable changes from what landed in r337505:
  - sigalarm handler isn't setup unless we're actually using it
  - Humanized versions of the amount of data transferred in the progress
    update

  r337869:
  dd(1): Kill off duplicate progress definition following r337865

Changes:
_U  stable/11/
  stable/11/bin/dd/Makefile
  stable/11/bin/dd/args.c
  stable/11/bin/dd/dd.1
  stable/11/bin/dd/dd.c
  stable/11/bin/dd/dd.h
  stable/11/bin/dd/extern.h
  stable/11/bin/dd/misc.c
  stable/11/bin/dd/position.c