History log of /freebsd-current/bin/dd/tests/dd2_test.sh
Revision Date Author Comments
# 5807f35c 05-May-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

dd: Fix SIGINT handling.

Currently, we handle SIGINT by calling summary() and _exit() directly from the signal handler, which we install after setup(). There are several issues with this:

* summary() is not signal safe;
* the parent is not informed about the signal;
* setup() can block on open(), and catching SIGINT at that stage will produce the correct exit status but will not print anything to stderr as POSIX demands.

Fix this by making SIGINT non-restartable, changing our signal handler to only set a flag, installing it before setup(), and checking the termination flag before and after every blocking operation, i.e. open(), read(), write().

Also add two test cases, one for catching SIGINT while opening the input and one for catching it while reading. I couldn't think of an easy way to test catching SIGINT while writing (it's certainly feasible, but perhaps not from a shell script).

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: cracauer, ngie, imp
Differential Revision: https://reviews.freebsd.org/D39641


# dabef981 05-May-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

dd: Tidy up the tests.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D39711


# 07c19c27 03-Jun-2017 Alan Somers <asomers@FreeBSD.org>

Fix bin/dd/dd2_tests:seek_overflow on UFS and TMPFS

Split the postive and negative parts into separate test cases. The positive
test case can only run on ZFS, because only ZFS supports files that large.

PR: 219757
Reported by: ngie
MFC after: 18 days
X-MFC-with: 319339


# 141173eb 03-Jun-2017 Enji Cooper <ngie@FreeBSD.org>

Mark :seek_overflow as an expected failure

MFC after: 18 days
MFC with: r319339
PR: 219757
Sponsored by: Dell EMC Isilon


# 5f0aff89 03-Jun-2017 Enji Cooper <ngie@FreeBSD.org>

Stylistic tweaks

Move opening braces of functions from the last column to column 0.

MFC after: 18 days
MFC with: r319339
Sponsored by: Dell EMC Isilon


# af2b6af3 31-May-2017 Alan Somers <asomers@FreeBSD.org>

Fix integer overflow detection in dd

dd(1) tried to detect whether the seek offset would overflow, but it failed
to account for the case where the provided argument was negative and the
file was a regular file (negative seeks are allowed for character devices).
I fixed it, and added a regression test.

Reported by: Coverity
CID: 1368659
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp