On 02/10/2016 01:57 PM, Nelson H. F. Beebe wrote:
SKIP: tests/split/line-bytes.sh
Timeout, server 192.168.122.66 not responding.
I presume the test that crashes your system is tests/split/l-chunk.sh,
which invokes commands like 'split -n l/10 /dev/null' and 'split -n 1/2
/dev/zero'.
This sounds like <http://bugs.gnu.org/11424>, which was reported for
GNU/Hurd. Most likely GNU/Hurd is reporting an st_size of OFF_T_MAX for
/dev/zero, and this is messing up 'split'. I will look into fixing this;
I expect that the bottom line is that split should not trust st_size for
special files like /dev/zero.
#define _FILE_OFFSET_BITS 64
#include <fcntl.h>
#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
static int
report (char const *file)
{
struct stat st;
off_t cur_offset;
off_t end_offset;
int fd = open ("/dev/zero", O_RDONLY);
printf ("file=%s\n", file);
if (fd < 0)
return perror ("open"), 1;
if (fstat (fd, &st) != 0)
return perror ("fstat"), 1;
if (S_ISREG (st.st_mode))
printf ("ISREG\n");
else if (S_ISLNK (st.st_mode))
printf ("ISLNK\n");
#ifdef S_TYPEISSHM
else if (S_TYPEISSHM (&st))
printf ("TYPEISSHM\n");
#endif
#ifdef S_TYPEISTMO
else if (S_TYPEISTMO (&st))
printf ("TYPEISTMO\n");
#endif
else if (S_ISBLK (st.st_mode))
printf ("BLK\n");
else if (S_ISCHR (st.st_mode))
printf ("CHR\n");
else
printf ("unknown mode 0%lo\n", (unsigned long) st.st_mode);
cur_offset = lseek (fd, 0, SEEK_CUR);
if (cur_offset < 0)
return perror ("lseek CUR"), 1;
end_offset = lseek (fd, 0, SEEK_END);
if (end_offset < 0)
return perror ("lseek END"), 1;
printf ("st_size=%lld\n", (long long) st.st_size);
printf ("st_blksize=%lld\n", (long long) st.st_blksize);
printf ("st_blocks=%lld\n", (long long) st.st_blocks);
printf ("cur_offset=%lld\n", (long long) cur_offset);
printf ("end_offset=%lld\n", (long long) end_offset);
printf ("pagesize=%lld\n", (long long) getpagesize ());
printf ("\n");
if (lseek (fd, cur_offset, SEEK_SET) < 0)
return perror ("lseek SET"), 1;
if (close (fd) != 0)
return perror ("close"), 1;
return 0;
}
int
main (int argc, char **argv)
{
static char dev_zero[] = "/dev/zero";
static char dev_null[] = "/dev/zero";
static char *dev_zero_argv[] = { dev_zero, dev_null, 0 };
char **av = argc == 1 ? dev_zero_argv : argv + 1;
while (*av)
if (report (*av++) != 0)
return 1;
return 0;
}