[Top][All Lists]

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

Re: coreutils-5.92:du not AIX largefile safe --

From: Paul Townsend
Subject: Re: coreutils-5.92:du not AIX largefile safe --
Date: Wed, 09 Nov 2005 04:08:50 -0500

On Tue, 08 Nov 2005 09:30:31 +0100, Jim Meyering wrote:
>Paul Townsend <address@hidden> wrote:
>> 1) On line 15, "'expensive'" should be "'very expensive'"?
>When I wrote the comment, it wasn't intended to refer to a script name.
>I've changed it.
>> 2) Script writes "big" relative to current directory.  Unfortunately,
>>    not all filesystems have that much free space so I added a TMPDIR
>>    variable that can point at a filesystem that has sufficient space.  I
>>    don't know how it should be set though (../very-expensive maybe??).
>That was deliberate.
>I didn't think it was worth the complication to try any partition
>other than the current one, especially for a test that few will
>want or be able to run.  Even I don't run this test all the time.
>I figured that those who really want to run it, can build and run
>`make check' on a partition where there's enough space.  But that's
>not a good attitude :-)
>So, if you're interested in pursuing it, it would be better to provide a
>more user-friendly method.  You might want to use an approach like that
>used in misc/tac-continue.  It does something similar, since it needs
>a partition that is full (data-wise), but that still has free inodes.
>If you have such a partition, you can tell that test about it by setting
>the FULL_PARTITION_TMPDIR envvar, e.g.,
>  FULL_PARTITION_TMPDIR=/full make check
>Don't use $TMPDIR, because it's not uncommon to have it
>pointing to a memory-backed file system -- not the place you'd
>want to create a 2GB temporary file, even if it'd fit.

Okay, I'm a person who's never learned to leave a piece of code alone.
Below is a patch to the script that you sent with the "expensive" part
pre-modified.  I ran the old/new tests like I ran yesterday.

>> 3) Wouldn't `cmp -s' be better?  Without the "-s", you see the `cmp'
>>    message about differences at "char 1, line 1".
>No, since some versions of cmp don't support the -s option.
>Actually, diff would be better, but cmp is more portable.
>> Below I have delineated the mods I made.

Part of this mod is a rewrite of the check code.  I think everything in
it is globally supported.

FWIW, the `seq' executable doesn't exist on the Solaris boxes (at least
I couldn't find it).  I replaced it with an `expr' invocation.  It could
also be replaced with something like

  for i in `perl -e '$,=" "; print 1..100'` ; do

--    Paul

--- coreutils-5.92/tests/du/2g.orig     2005-11-09 03:12:19.181920000 -0500
+++ coreutils-5.92/tests/du/2g  2005-11-09 03:59:42.274770000 -0500
@@ -14,7 +14,23 @@
 . $srcdir/../very-expensive
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
+# Build the path of the directory that will contain the two(2) gigabyte
+# test file.
+# By default, the file will be written relative to the current
+# directory.  However, if the current filesystem doesn't have at least
+# 3 GB of free space, this test will be ignored.  The user may cause the
+# file to be written on another filesystem with sufficient space by
+# assigning the absolute path of a directory in that filesystem to the
+# envariable MULTI_GIGABYTE_TMPDIR, e.g.,
+#  MULTI_GIGABYTE_TMPDIR=/bigfilesystemdirpath make check
+t0=`echo "$0"|sed 's,.*/,,'`.tmp
 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
 trap '(exit $?); exit $?' 1 2 13 15
@@ -52,25 +68,29 @@
 rm -f $big
-test -t 1 || printf 'creating a 2GB file...\n'
-for i in `seq 100`; do
+test -t 1 || printf 'Creating a 2GB file...\n'
+while test $i -le 100 ; do
   # Note: 2147483648 == 2^31. Print floor(2^31/100) per iteration.
   printf %21474836s x >> $big || fail=1
   # On the final iteration, append the remaining 48 bytes.
-  test $i = 100 && { printf %48s x >> $big || fail=1; }
-  test -t 1 && printf 'creating a 2GB file: %d%% complete\r' $i
+  test $i -eq 100 && { printf %48s x >> $big || fail=1; }
+  test -t 1 && printf 'Creating a 2GB file: %d%% complete\r' $i
+  i=`expr $i + 1`
-du -k $big > out1 || fail=1
+out1=`du -k $big 2>&1` || fail=1
 rm -f $big
-sed 's/^2[0-9][0-9][0-9][0-9][0-9][0-9]        '$big'$/~2M/' out1 > out
-cat <<\EOF > exp || fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+  echo "$out1" |
+    grep "^2[0-9][0-9][0-9][0-9][0-9][0-9]     $big$" >/dev/null
+} || fail=1
+if test $fail = 1 ; then
+  echo "Expected \"^2[0-9][0-9][0-9][0-9][0-9][0-9\\\\t$big\$\""
+  echo "Got      \"$out1\""
+  echo "$out1"
 (exit $fail); exit $fail

reply via email to

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