NetBSD Problem Report #43154

From mark@ecs.vuw.ac.nz  Mon Apr 12 20:30:04 2010
Return-Path: <mark@ecs.vuw.ac.nz>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id ED36263B873
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 12 Apr 2010 20:30:03 +0000 (UTC)
Message-Id: <201004122030.o3CKU16B024173@turakirae.ecs.vuw.ac.nz>
Date: Tue, 13 Apr 2010 08:30:01 +1200 (NZST)
From: mark@ecs.vuw.ac.nz
Reply-To: mark@ecs.vuw.ac.nz
To: gnats-bugs@gnats.NetBSD.org
Subject: wrong errno from open( , O_NOFOLLOW, )
X-Send-Pr-Version: 3.95

>Number:         43154
>Category:       standards
>Synopsis:       wrong errno from open( , O_NOFOLLOW, )
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    dholland
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 12 20:35:00 +0000 2010
>Closed-Date:    Mon Oct 25 02:23:35 +0000 2010
>Last-Modified:  Mon Oct 25 02:23:35 +0000 2010
>Originator:     Mark Davies
>Release:        NetBSD 5.0_STABLE
>Organization:
Dept. of Comp. Sci., Victoria Uni. of Wellington, New Zealand.
>Environment:


System: NetBSD turakirae.ecs.vuw.ac.nz 5.0_STABLE NetBSD 5.0_STABLE (ECS_WORKSTATION) #7: Sun Feb 28 09:13:18 NZDT 2010 mark@turakirae.ecs.vuw.ac.nz:/local/SAVE/build.obj/src/work/5/src/sys/arch/i386/compile/ECS_WORKSTATION i386
Architecture: i386
Machine: i386
>Description:
	open ("symlink", O_NOFOLLOW, ) returns an errno of EMLINK.
	POSIX1.2008 says it should return ELOOP
	(http://www.opengroup.org/onlinepubs/9699919799/)

	Also the open manual page says that O_NOFOLLOW is a non-standard extension,
	seems that it is a standard now.
>How-To-Repeat:
	Build and run the netatalk 2.1 beta release or try the following test program.

#include <errno.h>
#include <fcntl.h>

main ()
{
int i = open("foo", O_NOFOLLOW, 0 );
printf ("error %d", errno);
}


>Fix:


>Release-Note:

>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: standards/43154: wrong errno from open( , O_NOFOLLOW, )
Date: Wed, 14 Apr 2010 15:51:30 +0000

 On Mon, Apr 12, 2010 at 08:35:00PM +0000, mark@ecs.vuw.ac.nz wrote:
  > 	open ("symlink", O_NOFOLLOW, ) returns an errno of EMLINK.
  > 	POSIX1.2008 says it should return ELOOP
  > 	(http://www.opengroup.org/onlinepubs/9699919799/)

 EMLINK would be quite wrong here, since EMLINK normally means "too
 many hard links to this object".

 The problem is, I can't find any instances of EMLINK in the kernel
 that could be generating this. What fs are you seeing it on?

 -- 
 David A. Holland
 dholland@netbsd.org

From: Mark Davies <mark@ecs.vuw.ac.nz>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: standards/43154: wrong errno from open( , O_NOFOLLOW, )
Date: Sat, 17 Apr 2010 11:14:53 +1200

 On Thursday 15 April 2010 03:55:01 you wrote:
 >  On Mon, Apr 12, 2010 at 08:35:00PM +0000, mark@ecs.vuw.ac.nz wrote:
 >   > 	open ("symlink", O_NOFOLLOW, ) returns an errno of EMLINK.
 >   > 	POSIX1.2008 says it should return ELOOP
 >   > 	(http://www.opengroup.org/onlinepubs/9699919799/)
 > 
 >  EMLINK would be quite wrong here, since EMLINK normally means "too
 >  many hard links to this object".
 > 
 >  The problem is, I can't find any instances of EMLINK in the kernel
 >  that could be generating this. What fs are you seeing it on?

 Whoops, sorry EMLINK is the incorrect value that FreeBSD apparently returns 
 for this.  EFTYPE is what NetBSD returns in this case - which is still not 
 ELOOP.

 http://marc.info/?l=netatalk-devel&m=127114602331214&w=2

 cheers
 mark

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: standards-manager@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org, mark@ecs.vuw.ac.nz
Subject: Re: standards/43154: wrong errno from open( , O_NOFOLLOW, )
Date: Mon, 19 Apr 2010 04:41:35 +0000

 On Fri, Apr 16, 2010 at 11:20:06PM +0000, Mark Davies wrote:
  >>> 	open ("symlink", O_NOFOLLOW, ) returns an errno of EMLINK.
  >>> 	POSIX1.2008 says it should return ELOOP
  >>> 	(http://www.opengroup.org/onlinepubs/9699919799/)
  >> 
  >>  EMLINK would be quite wrong here, since EMLINK normally means "too
  >>  many hard links to this object".
  >> 
  >>  The problem is, I can't find any instances of EMLINK in the kernel
  >>  that could be generating this. What fs are you seeing it on?
  >  
  > Whoops, sorry EMLINK is the incorrect value that FreeBSD apparently
  > returns for this. EFTYPE is what NetBSD returns in this case -
  > which is still not ELOOP.
  >  
  >  http://marc.info/?l=netatalk-devel&m=127114602331214&w=2

 Ok, I see... EFTYPE at least makes sense, but so does ELOOP I guess
 and EFTYPE isn't standard.

 -- 
 David A. Holland
 dholland@netbsd.org

Responsible-Changed-From-To: standards-manager->dholland
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Mon, 19 Apr 2010 04:48:05 +0000
Responsible-Changed-Why:
namei-related


From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: standards/43154: wrong errno from open( , O_NOFOLLOW, )
Date: Wed, 8 Sep 2010 00:24:31 +0200

 The errno value of EFTYPE is now documented. I think it is better than
 the POSIX value because POSIX doesn't allow to distinguish between
 symlink loops in intermediate components of the path and the last
 component being a symlink.

 Joerg

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 25 Oct 2010 02:23:35 +0000
State-Changed-Why:
The conclusion is that we like precision (EFTYPE) better than strict
conformance when strict conformance is misguided (ELOOP). Several people
I've talked to (including but not limited to Joerg) have been in favor
and nobody's disagreed. However, it hasn't been hashed out in full glory
on tech-kern; if anyone (whether the original submitter or someone coming
across this later) cares deeply please bring it up there.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.