bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dd test failure: skip-seek-past-file


From: Jim Meyering
Subject: Re: dd test failure: skip-seek-past-file
Date: Fri, 06 Feb 2009 07:58:18 +0100

Pádraig Brady <address@hidden> wrote:
> Jim Meyering wrote:
>> I've just tested the latest coreutils from git
>> on sparc-Solaris 10 and got one failure:
>>
>>     + compare err_ok err
>>     + diff -u err_ok err
>>     --- err_ok      2009-02-05 14:04:40.340945300 -0700
>>     +++ err 2009-02-05 14:04:40.340267500 -0700
>>     @@ -1,3 +1,3 @@
>>     -dd: `standard input': cannot skip: Invalid argument
>>     +dd: `standard input': cannot skip to specified offset
>
> The attached patch should fix it.

Thanks!
It does, indeed.
a couple comments...

>>From 3c1cdfcb85502f582832a90f8c8b2bda63b2a396 Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?P=C3=A1draig=20Brady?= <address@hidden>
> Date: Fri, 6 Feb 2009 02:01:43 +0000
> Subject: [PATCH] tests: fix dd skip=greater_max_file_size test on Solaris 10
>
> * tests/dd/skip-seek-past-file: I had previously commented that
> on some systems lseek(> max file size) may succeed, but left
> the possibility of failure in that case, so that I could determine
> specific systems to put in the comments for both failure modes.
> ---
>  tests/dd/skip-seek-past-file |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/tests/dd/skip-seek-past-file b/tests/dd/skip-seek-past-file
> index 9c055bd..6d288f9 100755
> --- a/tests/dd/skip-seek-past-file
> +++ b/tests/dd/skip-seek-past-file
> @@ -75,17 +75,21 @@ echo "dd: \`standard input': cannot skip: Value too large 
> for defined data type
>  compare err_ok err || fail=1
>
>  # skipping > max file size should fail immediately
> -# Note I'm guessing there is a small chance that an lseek() could actually 
> work
> -# and only a write() would fail (with EFBIG) when offset > max file size.
> -# So this test will both test for that, and ensure that dd
> -# exits immediately with an appropriate error when lseek() does error.
>  if ! truncate --size=$OFF_T_MAX in 2>/dev/null; then
>    # truncate is to ensure file system doesn't actually support OFF_T_MAX 
> files
> -  dd bs=1 skip=$OFF_T_MAX count=0 status=noxfer < file 2> err && fail=1
> +  dd bs=1 skip=$OFF_T_MAX count=0 status=noxfer < file 2> err && lseek_ok=1
>    echo "dd: \`standard input': cannot skip: Invalid argument
>  0+0 records in
>  0+0 records out" > err_ok || framework_failure
> -  compare err_ok err || fail=1
> +
> +  if [ "$lseek_ok" ]; then

I prefer to use "test" and not [...]; less syntax.
We have to set lseek_ok also upon failure, in case
it was set in the environment.
Once we always set the variable to some non-empty value,
we can drop the double quotes around $lseek_ok, too.
Finally, I prefer printf over echo, for portability in general,
and in this case so that we can indent the continuation lines.

...
So I've amended that commit with the following and pushed it.

diff --git a/tests/dd/skip-seek-past-file b/tests/dd/skip-seek-past-file
index 6d288f9..fd8bdc6 100755
--- a/tests/dd/skip-seek-past-file
+++ b/tests/dd/skip-seek-past-file
@@ -77,12 +77,13 @@ compare err_ok err || fail=1
 # skipping > max file size should fail immediately
 if ! truncate --size=$OFF_T_MAX in 2>/dev/null; then
   # truncate is to ensure file system doesn't actually support OFF_T_MAX files
-  dd bs=1 skip=$OFF_T_MAX count=0 status=noxfer < file 2> err && lseek_ok=1
-  echo "dd: \`standard input': cannot skip: Invalid argument
-0+0 records in
-0+0 records out" > err_ok || framework_failure
+  dd bs=1 skip=$OFF_T_MAX count=0 status=noxfer < file 2> err \
+    && lseek_ok=yes \
+    || lseek_ok=no
+  printf '%s\n' "dd: \`standard input': cannot skip: Invalid argument" \
+    '0+0 records in' '0+0 records out' > err_ok || framework_failure

-  if [ "$lseek_ok" ]; then
+  if test $lseek_ok = yes; then
     # On Solaris 10 at least, lseek(>max file size) succeeds,
     # so just check for the skip warning.
     compare skip_err err || fail=1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]