From owner-freebsd-standards@FreeBSD.ORG Wed Sep 12 16:00:12 2012 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 74D601065673 for ; Wed, 12 Sep 2012 16:00:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3C0FC8FC0C for ; Wed, 12 Sep 2012 16:00:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q8CG09SE050827 for ; Wed, 12 Sep 2012 16:00:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q8CG09Zl050812; Wed, 12 Sep 2012 16:00:09 GMT (envelope-from gnats) Resent-Date: Wed, 12 Sep 2012 16:00:09 GMT Resent-Message-Id: <201209121600.q8CG09Zl050812@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-standards@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ed Maste Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 44D4F1065675 for ; Wed, 12 Sep 2012 15:54:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 275988FC1D for ; Wed, 12 Sep 2012 15:54:43 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q8CFshgv030403 for ; Wed, 12 Sep 2012 15:54:43 GMT (envelope-from emaste@freefall.freebsd.org) Received: (from emaste@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q8CFsgL4030388; Wed, 12 Sep 2012 15:54:43 GMT (envelope-from emaste) Message-Id: <201209121554.q8CFsgL4030388@freefall.freebsd.org> Date: Wed, 12 Sep 2012 15:54:43 GMT From: Ed Maste To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: standards/171577: realpath(3) returns ENOTDIR instead of ENOENT X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Ed Maste List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Sep 2012 16:00:12 -0000 >Number: 171577 >Category: standards >Synopsis: realpath(3) returns ENOTDIR instead of ENOENT >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Sep 12 16:00:08 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Ed Maste >Release: FreeBSD 9.1-PRERELEASE amd64 >Organization: FreeBSD >Environment: FreeBSD feynman 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #1 r240164M: Thu Sep 6 10:40:42 EDT 2012 emaste@feynman:/data2/emaste/obj/home/emaste/src/9/sys/TEST amd64 >Description: When passed a path with a component that does not exist realpath() sets errno to ENOTDIR instead of ENOENT. See kern/128933 for the change that introduced this behaviour. I believe it is incorrect. ENOTDIR is 20 ENOTDIR Not a directory. A component of the specified pathname existed, but it was not a directory, when a directory was expected. >How-To-Repeat: feynman% realpath /does-not-exist/foo realpath: /does-not-exist/foo: Not a directory >Fix: Index: realpath.c =================================================================== --- realpath.c (revision 240400) +++ realpath.c (working copy) @@ -181,8 +181,6 @@ return (NULL); } if (lstat(resolved, &sb) != 0) { - if (errno != ENOENT || p != NULL) - errno = ENOTDIR; if (m) free(resolved); return (NULL); >Release-Note: >Audit-Trail: >Unformatted: