Joachim Schmitz wrote:
> So this is why it errors here:
> if (len != statbuf.st_size)
> {
> fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len,
> FILE1);
> err = 1;
> }
>
>
> The problem is, that here /etc/resolv.conf is a symbolic link to a structured
> EDIT file in the Guardian namespace, /G/system/ztcpip/resconf (which in
> Guardian is $SYSTEM.ZTCPIP.RESCONF). These EDIT files in Guardian have a
> structure that is very much different from 'flat' files in UNIX (or OSS, for
> this matter).
>
> $ ls -l /etc/resolv.conf
> lrwxrwxrwx 1 SUPER.SUPER SUPER 24 Jan 9 2010
> /etc/resolv.conf -> /G/system/ztcpip/resconf
> $ ls -l /G/system/ztcpip/resconf
> -rwxr-xr-x 1 SUPER.SUPER SUPER 2144 Oct 19 2009
> /G/system/ztcpip/resconf
Thanks for the analysis. The bug is in the test; I'm fixing it through the
appended patch.
Paolo suggested:
> Creating the file within the test?
That would be too easy; it would always be a regular file. With /etc/resolv.conf
we can test whether S_ISREG is implemented correctly.
2010-10-04 Bruno Haible <[email protected]>
read-file tests: Avoid a test failure on NonStop Kernel.
* tests/test-read-file.c (main): Don't assume that /etc/resolv.conf is
a regular file.
Reported by Joachim Schmitz <[email protected]>.
*** tests/test-read-file.c.orig Mon Oct 4 21:31:10 2010
--- tests/test-read-file.c Mon Oct 4 21:28:33 2010
***************
*** 52,62 ****
err = 1;
}
! /* Assume FILE1 is a regular file or a symlink to a regular file.
*/
! if (len != statbuf.st_size)
{
! fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len,
FILE1);
! err = 1;
}
free (out);
}
--- 52,74 ----
err = 1;
}
! if (S_ISREG (statbuf.st_mode))
{
! /* FILE1 is a regular file or a symlink to a regular file. */
! if (len != statbuf.st_size)
! {
! fprintf (stderr, "Read %ld from %s...\n", (unsigned long)
len, FILE1);
! err = 1;
! }
! }
! else
! {
! /* Assume FILE1 is not empty. */
! if (len == 0)
! {
! fprintf (stderr, "Read nothing from %s\n", FILE1);
! err = 1;
! }
}
free (out);
}