Paul Eggert wrote: > On 05/08/2012 01:39 AM, Jim Meyering wrote: >> I went ahead and pushed the less-invasive fix. > > Hmm, I don't see this on Savannah; is this part > of the problem where usable_st_size got pushed?
Ahh... I think I know what happened. I had both the usable_st_size and split-hang-fix patches on a temporary branch and ran git rebase -i HEAD~2 intending to delete the usable_st_size change set just before pushing. Obviously I removed the other instead. I've just pushed the split-hang-fix patch, along with a gnulib-updating patch that also pulls in the latest init.sh and bootstrap scripts. >> Your behavior-changing one is more than welcome, too. > > I came up with a better idea, and propose this patch > instead. The idea is to fall back on lseek if > st_size is not reliable. This allows the programs > to work in more cases, including the case in question. > One test case needs to be removed because it assumes > a command must fail, where it now typically works. Thanks! I'll look at it this evening. ... > Subject: [PATCH] maint: handle file sizes more reliably > > Problem reported by Samuel Thibault in <http://debbugs.gnu.org/11424>. > * NEWS: Document this. > * src/dd.c (skip): > * 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/dd.c (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/stat.c (print_stat): Don't report negative sizes as huge > positive ones. > * 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.
