From 460ebb078ed7bf249af745d8725d6c37e7f15b57 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Thu, 20 Nov 2008 10:28:31 +0000 Subject: dd: Better handle user specified offsets that are too big Following are the before and after operations for seekable files, for the various erroneous offsets handled by this patch: skip beyond end of file before: immediately exit(0); after : immediately printf("cannot skip to specified offset"); exit(0); skip > max file size before: read whole file and exit(0); after : immediately printf("cannot skip: Invalid argument"); exit(1); seek > max file size before: immediately printf("truncate error: EFBIG"); exit(1); after : immediately printf("truncate error: EFBIG"); exit(1); skip > OFF_T_MAX before: read whole device/file and exit(0); after : immediately printf("cannot skip:"); exit(1); seek > OFF_T_MAX before: immediately printf("truncate error: offset too large"); exit(1); after : immediately printf("truncate error: offset too large"); exit(1); skip > device size before: read whole device and exit(0); after : immediately printf("cannot skip: Invalid argument"); exit(1); seek > device size before: read whole device and printf("write error: ENOSPC"); exit(1); after : immediately printf("cannot seek: Invalid argument"); exit(1); * NEWS: Summarize this change in behavior. * src/dd.c (skip): Add error checking for large seek/skip offsets on seekable files, rather than deferring to using read() to advance offset. (dd_copy): Print a warning if skip past EOF, as per FIXME comment. * test/Makefile.am: Add 2 new tests. * tests/dd/seek-skip-past-file: Add tests for first 3 cases above. * tests/dd/seek-skip-past-dev: Add root only test for last case above. --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'NEWS') diff --git a/NEWS b/NEWS index 83b8ed9a1..99fc182f8 100644 --- a/NEWS +++ b/NEWS @@ -38,6 +38,10 @@ GNU coreutils NEWS -*- outline -*- cp and mv: the --reply={yes,no,query} option has been removed. Using it has elicited a warning for the last three years. + dd: user specified offsets that are too big are handled better. + Previously, erroneous parameters to skip and seek could result + in redundant reading of the file with no warnings or errors. + du: -H (initially equivalent to --si) is now equivalent to --dereference-args, and thus works as POSIX requires -- cgit v1.2.3-54-g00ecf