diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-05-09 23:53:16 -0700 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-05-10 11:02:42 +0200 |
commit | 9d308df13271a852aee7d46c65432fa84145ea31 (patch) | |
tree | 4973d91ba1d10e86875e8c2be8079dca131dad85 /tests | |
parent | 2c436decf8bc57a9173c940a26c80358d499e1b6 (diff) | |
download | coreutils-9d308df13271a852aee7d46c65432fa84145ea31.tar.xz |
maint: handle file sizes more reliably
Problem reported by Samuel Thibault in <http://bugs.gnu.org/11424>.
* NEWS: Document this.
* src/dd.c (skip): Handle skipping past EOF on shared or typed
memory objects the same way as with regular files.
(dd_copy): It's OK to truncate shared memory objects.
* src/du.c (duinfo_add): Check for overflow.
(print_only_size): Report overflow.
(process_file): Ignore negative file sizes in the --apparent-size case.
* src/od.c (skip): Fix comment about st_size.
* src/split.c (main):
* src/truncate.c (do_ftruncate, main):
On files where st_size is not portable, fall back on using lseek
with SEEK_END to determine the size. Although strictly speaking
POSIX says the behavior is implementation-defined, in practice
if lseek returns a nonnegative value it's a reasonable one to
use for the file size.
* src/system.h (usable_st_size): Symlinks have reliable st_size too.
* tests/misc/truncate-dir-fail: Don't assume that getting the size
of a dir is not allowed, as it's now allowed on many platforms,
e.g., GNU/Linux.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/misc/truncate-dir-fail | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/tests/misc/truncate-dir-fail b/tests/misc/truncate-dir-fail index 116735208..54a31479f 100755 --- a/tests/misc/truncate-dir-fail +++ b/tests/misc/truncate-dir-fail @@ -22,7 +22,4 @@ print_ver_ truncate # truncate on dir not allowed truncate -s+0 . && fail=1 -# getting the size of a dir is not allowed -truncate -r. file && fail=1 - Exit $fail |