NetBSD-Bugs archive

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

lib/43310: dirent(5) standard compliance

>Number:         43310
>Category:       lib
>Synopsis:       dirent(5) standard compliance
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 15 08:55:00 +0000 2010
>Originator:     Jukka Ruohonen
>Release:        NetBSD 5.0_STABLE


The POSIX specification is stringent about the size of the "d_name" field in
the struct dirent, defined in NetBSD as:

struct dirent {
        ino_t d_fileno;                 /* file number of entry */
        uint16_t d_reclen;              /* length of this record */
        uint16_t d_namlen;              /* length of string in d_name */
        uint8_t  d_type;                /* file type, see below */
#if defined(_NETBSD_SOURCE)
#define MAXNAMLEN       511
        char    d_name[MAXNAMLEN + 1];  /* name must be no longer than this
        char    d_name[511 + 1];        /* name must be no longer than this

Which conflicts with the specification that says:

  "The character array d_name is of unspecified size, but the number
   of bytes preceding the terminating null byte shall not exceed {NAME_MAX}."

given that MAXNAMLEN > NAME_MAX.

The size of d_name was doubled (due padding?) in:

revision 1.19
date: 2005/08/19 02:04:04;  author: christos;  state: Exp;  lines: +54 -17
64 bit inode changes.



man dirent
$EDITOR src/sys/sys/dirent.h


Change the size, if there is no compelling reason not to; otherwise close
the bug report.

Home | Main Index | Thread Index | Old Index