Subject: Re: bug#11424: coreutils: split tests hang on /dev/zero on GNU/Hurd

From: Jim Meyering <[email-masked]>
Date: Thu, 10 May 2012 09:47:31 +0200

Paul Eggert wrote:
> On 05/09/2012 11:36 PM, Jim Meyering wrote:
>> I see you pushed it.
>> Thanks for adding that line to NEWS:
>
> You're welcome.  I shook free some time to adjust the st_size patch,
> and here's a new version that I think incorporates all the comments
> so far:
>
> From 0c9661af1b29e2999030cb93003d98673faabf83 Mon Sep 17 00:00:00 2001
> From: Paul Eggert <[email-masked]>
> Date: Wed, 9 May 2012 23:53:16 -0700
> Subject: [PATCH] maint: handle file sizes more reliably
...

Thanks for sending that.
Unfortunately, I am unable to apply it because
something has mangled the patch.  Note how blank lines of
context have been omitted and lead to a space being inserted
before the "+" or "-" on the following line:

> diff --git a/NEWS b/NEWS
> index 7ef2f54..e56f8fa 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -27,6 +27,9 @@ GNU coreutils NEWS                                    -*- outline -*-
>
>  ** New features

Omitted blank line of context.

>  +  split and truncate now allow any seekable files in situations where
> +  the file size is needed, instead of insisting on regular files.
> +
>    fmt now accepts the --goal=WIDTH (-g) option.
>  ** Changes in behavior
> diff --git a/src/dd.c b/src/dd.c
> index 4626de2..163d514 100644
> --- a/src/dd.c
> +++ b/src/dd.c
> @@ -1544,7 +1544,7 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize,
>             struct stat st;
>             if (fstat (STDIN_FILENO, &st) != 0)
>               error (EXIT_FAILURE, errno, _("cannot fstat %s"), quote (file));
> -           if (S_ISREG (st.st_mode) && st.st_size < (input_offset + offset))
> +           if (usable_st_size (&st) && st.st_size < input_offset + offset)
>               {
>                 /* When skipping past EOF, return the number of _full_ blocks
>                  * that are not skipped, and set offset to EOF, so the caller
> @@ -2104,8 +2104,8 @@ dd_copy (void)
>          }
>      }

There should be a blank line of context here.

>  -  /* If the last write was converted to a seek, then for a regular file,
> -     ftruncate to extend the size.  */
> +  /* If the last write was converted to a seek, then for a regular file
> +     or shared memory object, ftruncate to extend the size.  */

Normally I can apply mangled change sets using patch, but not this time.
Every single hunk is rejected.