Subject: port-sparc/8406: lstat of "/" fails in SunOS emulation environment
To: None <>
From: None <>
List: netbsd-bugs
Date: 09/14/1999 04:46:51
>Number:         8406
>Category:       port-sparc
>Synopsis:       lstat of "/" fails in SunOS emulation environment
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-sparc-maintainer (NetBSD/sparc Portmaster)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 14 03:35:00 1999
>Originator:     Jarle Greipsland
>Release:        NetBSD-1.4.1
System: NetBSD 1.4.1 NetBSD 1.4.1 (UGLE) #0: Sun Sep 12 02:28:36 MEST 1999 sparc

On one of our NetBSD/sparc sytems we use a commercial backup application,
and this application for whatever reason does an lstat on the root directory.
This lstat system call fails under NetBSD-1.4.1, but worked fine under

Compile the following code on a SunOS system, and then run it under
NetBSD-1.4.1 with a properly configured SunOS emulation environment:

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>

#include <errno.h>

extern int sys_nerr;
extern char *sys_errlist[];
extern int errno;

main(int argc, char **argv)
        struct stat sb;
        int c;

        if (argc != 2) {
                fprintf(stderr, "Wrong number of arguments\n");
        c = lstat(argv[1], &sb);
        if (c != 0) {
                fprintf(stderr, "errno = %d, %s\n", errno, sys_errlist[errno]);
        } else {
                fprintf(stderr, "OK\n");

On the SunOS system:
% ./a.out /

On the NetBSD-1.4.1 system:
% ./a.out /
errno = 21, Is a directory

AFAICT this only happens when the parameter to lstat is "/".  Other
combinations such as "/." or "/./" seems to work fine.  Other directories 
work fine as well.

Unknown to me.