Subject: kern/13425: pathconf(_PC_PATH_MAX) doesn't work on NFS
To: None <gnats-bugs@gnats.netbsd.org>
From: None <M.Drochner@fz-juelich.de>
List: netbsd-bugs
Date: 07/10/2001 16:10:00
>Number: 13425
>Category: kern
>Synopsis: pathconf(_PC_PATH_MAX) doesn't work on NFS
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jul 10 07:07:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: M.Drochner
>Release: NetBSD 1.5.1
>Organization:
>Environment:
NetBSD-1.5.1, should be present on -current too
System: NetBSD zelz26 1.5.1 NetBSD 1.5.1 (CSC) #15: Mon Jun 18 12:29:43 MEST 2001 drochner@zelz26:/home/drochner/netbsd-1.5/sys/arch/i386/compile/CSC i386
>Description:
pathconf(<path>, _PC_PATH_MAX) fails with EINVAL if <path> is NFS
mounted. Inspection of sys/nfs/nfs_vnops.c:nfs_pathconf() shows that the
_PC_PATH_MAX case isn't handled.
Applications relying on this to allocate temporary storage fail horribly.
>How-To-Repeat:
Try the following on a diskless machine or with an NFS mounted
directory given as command line argument:
#include <stdio.h>
#include <unistd.h>
#include <err.h>
int
main(int argc, char **argv)
{
char *p;
int pm;
if (argc > 1)
p = argv[1];
else
p = "/";
pm = pathconf (p, _PC_PATH_MAX);
if (pm < 0)
err(1, "pm");
printf("pm=%d\n", pm);
return (0);
}
>Fix:
Don't know. Does NFSv3 have this? If not, perhaps use _PC_NAME_MAX
which should not be smaller at least...
>Release-Note:
>Audit-Trail:
>Unformatted: