From owner-freebsd-emulation Wed Mar 13 7:19:53 2002 Delivered-To: freebsd-emulation@freebsd.org Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by hub.freebsd.org (Postfix) with ESMTP id E3B4537B404 for ; Wed, 13 Mar 2002 07:19:50 -0800 (PST) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.9.3/8.9.3) with ESMTP id KAA23121; Wed, 13 Mar 2002 10:19:50 -0500 (EST) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.11.6/8.9.1) id g2DFJKv31690; Wed, 13 Mar 2002 10:19:20 -0500 (EST) (envelope-from gallatin@cs.duke.edu) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15503.28152.181832.704801@grasshopper.cs.duke.edu> Date: Wed, 13 Mar 2002 10:19:20 -0500 (EST) To: Sean Harding Cc: freebsd-emulation@freebsd.org Subject: Re: Possible bug with mkdir() in linux emulation? In-Reply-To: <20020311192804.GE7788@dogcow.org> References: <20020311192804.GE7788@dogcow.org> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Sean Harding writes: > What this seems to boil down to is that in Linux binaries on FreeBSD, > mkdir() on an existing directory to whose parent I don't have write > permission, errno is set to EACCES (13) instead of EEXIST (17). When the > same binary is run on a real Linux system, errno is set to EEXIST. And > when the same code is compiled natively on FreeBSD, it does the same. Here's what's actually happening (from ktrace/linux_kdump): 31680 mkdir.linux NAMI "/compat/linux" 31680 mkdir.linux NAMI "/compat/linux/home" 31680 mkdir.linux RET getppid -1 errno -13 Unknown error: -13 The key is that the linux abi prepends the default location of the linux environment to all filename accesses. This is primarily done so as to be able to find linux shared libs & config files. So your program is trying to make /compat/linux/home, which doesn't exist & which you do not have permission to create. Cheers, Drew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message