bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: read-file on HP NonStop


From: Schmitz, Joachim
Subject: RE: read-file on HP NonStop
Date: Mon, 4 Oct 2010 05:54:00 +0000

Hi Bruno

Hmm, 
$ cat /etc/resolv.conf|wc -c
          68

So it reads all 68 chars.

OK, stepping thru...
$ run -debug -inspect=on ./test-read-file

TNS/E Native Inspect gdb Debugger [T1237 - 04-Jan-2010 10:26]
Copyright 1998 Free Software Foundation, Inc.
Copyright 2003-2008 Hewlett-Packard Development Company, L.P.

Native Inspect (based on GDB) is covered by the GNU General Public License.
Type "show copying" for conditions for changing and/or distributing copies.
Type "show warranty" for warranty/support information.

Working directory \HPITUG.$DATA01.JOJO.
Symbols read in for program loadfile 
/usr/local/Floss/acltestdir2/gltests/test-read-file.
Added process (3,1152).
Switching process (3,1152) to eInspect from DMON
Breakpoint 1 at 0x70000f10:2: file 
/usr/local/Floss/acltestdir2/gltests/test-read-file.c, line 37.
main () at /usr/local/Floss/acltestdir2/gltests/test-read-file.c:37
*   37        int err = 0;
(eInspect 3,1152):step
*   41        if (stat (FILE1, &statbuf) >= 0)
(eInspect 3,1152):
*   44            char *out = read_file (FILE1, &len);
(eInspect 3,1152):p statbuf
$1 = {
  st_dev = 479962595334,
  st_ino = 697624556,
  st_mode = 33261,
  st_nlink = 1,
  st_acl = 0,
  __filler_1 = 0,
  st_uid = 65535,
  st_gid = 255,
  st_rdev = 0,
  st_size = 2144, <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< but here we get 2144 rather 
than 68
  st_atime = 1286169118,
  st_mtime = 1255974436,
  st_ctime = 1255974436,
  st_basemode = 0,
  st_reserved = {0, 0, 0}
}
(eInspect 3,1152):


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

/etc/resolv.conf does not always exist here (even if it should), but if so, it 
most likely points to that Guardian file.
Similar for /etc/hosts, /etc/networks, /etc/protocols, /etc/services. This 
should ensure that both personalities use the same setup. Guardian EDIT files 
are only readable from OSS (when using POSIX APIs), not writable.

So we'd need to make sure that in this test we use a file (or symlink to a 
file) in the OSS namespace. One file that always exists here would be e.g. 
/etc/profile.sample, so I'd use:

#ifdef __TANDEM
#define FILE1 "/etc/profile.sample"
#else
#define FILE1 "/etc/resolv.conf"
#endif
#define FILE2 "/dev/null"

Or do you have a better idea?

Bye, Jojo

-----Original Message-----
From: Bruno Haible [mailto:address@hidden 
Sent: Monday, October 04, 2010 2:01 AM
To: Schmitz, Joachim
Cc: 'Paolo Bonzini'; 'bug-gnulib'
Subject: Re: read-file on HP NonStop

Joachim Schmitz wrote:
> Read 68 from /etc/resolv.conf...
> FAIL: test-read-file
> 
> Now hunting that failed check... ah, /etc/resolv.conf is a symlink here,
> apparently the test doesn't like this.

That should work too. When on Linux I change FILE1 to "/tmp/symlink" which is
a symlink to a regular file, then test-read-file passes. Since it's not the
same for you, it's worth investigating. It might be some incompatibility
in stat() or fstat(), that is, something pretty fundamental.

Just compile this program with debug information and single-step it.

Bruno

reply via email to

[Prev in Thread] Current Thread [Next in Thread]