The split/filter.sh test would fail like this:

  $ make check TESTS=tests/split/filter.sh VERBOSE=yes SUBDIRS=.
  + truncate -s9223372036854775807 zero.in
  + timeout 10 sh -c 'split --filter="head -c1 >/dev/null" -n 1 zero.in'
  split: zero.in: cannot determine file size: Value too large for
defined data type

That value is 2^63-1 (nearly 8 exabytes), and split.c
explicitly handles a file of that size, because that is
the size reported for /dev/zero on GNU/Hurd systems,
according to the comment.

This fixes the test not to trigger that work-around:
[I'll update the commit log with the issue URL as soon as it's assigned]
From 889415ab359c943ee4c358f8c5fb07bca95a4ead Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Sun, 6 Mar 2016 16:38:01 -0800
Subject: [PATCH] tests: avoid false-failure of split/filter.sh on XFS

* tests/split/filter.sh: Use OFF_T_MAX-1 rather than OFF_T_MAX
as the size of a test file, to avoid false failure on an XFS file
system (or any file system permitting a file of size OFF_T_MAX).
---
 tests/split/filter.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/split/filter.sh b/tests/split/filter.sh
index a93008b..bd2f210 100755
--- a/tests/split/filter.sh
+++ b/tests/split/filter.sh
@@ -52,9 +52,13 @@ returns_ 1 split -n 1/2 --filter='true' /dev/null 2>&1 || fail=1
 # where they would result in a non zero exit from split.
 yes | head -n200K | split -b1G --filter='head -c1 >/dev/null' || fail=1

+# Do not use a size of OFF_T_MAX, since split.c applies a GNU/Hurd
+# /dev/zero workaround for files of that size.  Use one less:
+N=$(expr $OFF_T_MAX - 1)
+
 # Ensure that "endless" input is ignored when all filters finish
 timeout 10 sh -c 'yes | split --filter="head -c1 >/dev/null" -n r/1' || fail=1
-if truncate -s$OFF_T_MAX zero.in; then
+if truncate -s$N zero.in; then
   timeout 10 sh -c 'split --filter="head -c1 >/dev/null" -n 1 zero.in' || fail=1
 fi

-- 
2.7.2

Reply via email to