From owner-freebsd-emulation@FreeBSD.ORG Tue May 1 20:11:51 2007 Return-Path: X-Original-To: emulation@freebsd.org Delivered-To: freebsd-emulation@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E423C16A401 for ; Tue, 1 May 2007 20:11:50 +0000 (UTC) (envelope-from jhein@timing.com) Received: from Daffy.timing.com (mx2.timing.com [206.168.13.218]) by mx1.freebsd.org (Postfix) with ESMTP id A2C5513C4E9 for ; Tue, 1 May 2007 20:11:50 +0000 (UTC) (envelope-from jhein@timing.com) Received: from gromit.timing.com (gromit.timing.com [206.168.13.209]) by Daffy.timing.com (8.13.1/8.13.1) with ESMTP id l41KBmUm029805; Tue, 1 May 2007 14:11:48 -0600 (MDT) (envelope-from jhein@timing.com) Received: from gromit.timing.com (localhost [127.0.0.1]) by gromit.timing.com (8.13.8/8.13.8) with ESMTP id l41KBkWb042729; Tue, 1 May 2007 14:11:46 -0600 (MDT) (envelope-from jhein@gromit.timing.com) Received: (from jhein@localhost) by gromit.timing.com (8.13.8/8.13.8/Submit) id l41KBkBv042726; Tue, 1 May 2007 14:11:46 -0600 (MDT) (envelope-from jhein) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17975.40706.810495.148190@gromit.timing.com> Date: Tue, 1 May 2007 14:11:46 -0600 From: John E Hein To: Eric Anderson In-Reply-To: <46379A72.2080406@freebsd.org> References: <17975.37939.743304.357841@gromit.timing.com> <46379A72.2080406@freebsd.org> X-Mailer: VM 7.19 under Emacs 22.0.99.1 X-Virus-Scanned: ClamAV version 0.90, clamav-milter version devel-120207 on Daffy.timing.com X-Virus-Status: Clean X-Spam-Status: No, score=0.2 required=5.0 tests=AWL,BAYES_40, DK_POLICY_SIGNSOME autolearn=disabled version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on Daffy.timing.com Cc: emulation@freebsd.org Subject: Re: sym links to absolute pathnames in /compat/linux X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 May 2007 20:11:51 -0000 Eric Anderson wrote at 14:52 -0500 on May 1, 2007: > On 05/01/07 14:25, John E Hein wrote: > > Are sym links to absolute pathnames supposed to try to look > > in /compat/linux first? > > > > /compat/linux/usr/bin/foo -> /bin/foo > > > > I thought I recalled that Alexander said recently they _were_ supposed > > to look in /compat/linux first. But I don't seem to have that > > behavior on the 6-stable box I'm using at the moment. > > > > # ln -s /bin/foo /compat/linux/usr/bin/foo > > # ls -l /compat/linux/usr/bin/foo > > lrwxr-xr-x 1 root wheel 8 May 1 19:17 /compat/linux/usr/bin/foo -> /bin/foo > > # cp -p /compat/linux/bin/ls /compat/linux/bin/foo > > # cp -p /bin/ls /bin/foo > > # /compat/linux/usr/bin/foo --version > > foo: illegal option -- - > > usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx1] [file ...] > > # /compat/linux/bin/foo --version > > ls (coreutils) 5.2.1 > > Written by Richard Stallman and David MacKenzie. > > Is all that taking place inside a linux shell? No - sorry, bad example. But I still see the same behavior running the linux shell as you suggest (below). And I actually started investigating this because I was running an emulated linux app which tried to follow an absolute sym link (and it was not looking in /compat/linux first for the target of the link). > If not, then the symlink resolution is happening *before* the linux > emulator takes over. Agreed. > Try this instead: > > # /compat/linux/bin/sh > # /compat/linux/usr/bin/foo --version > # /compat/linux/bin/foo --version > # /bin/foo --version # /compat/linux/bin/sh sh-3.00# /compat/linux/usr/bin/foo --version foo: illegal option -- - usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx1] [file ...] sh-3.00# /compat/linux/bin/foo --version ls (coreutils) 5.2.1 Written by Richard Stallman and David MacKenzie. Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. sh-3.00# /bin/foo --version ls (coreutils) 5.2.1 Written by Richard Stallman and David MacKenzie. Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. And, for good measure... sh-3.00# /usr/bin/foo --version foo: illegal option -- - usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx1] [file ...] So it doesn't seem to behave as I was expecting from the linux sh either. And ls (freebsd & linux) reports... sh-3.00# ls -alF /compat/linux/usr/bin/foo /usr/bin/foo /bin/foo /compat/linux/bin/foo -rwxr-xr-x 1 root wheel 89456 Apr 25 18:10 /bin/foo* -rwxr-xr-x 1 root wheel 89456 Apr 25 18:10 /compat/linux/bin/foo* lrwxr-xr-x 1 root wheel 8 May 1 20:04 /compat/linux/usr/bin/foo -> /bin/foo* lrwxr-xr-x 1 root wheel 8 May 1 20:04 /usr/bin/foo -> /bin/foo* sh-3.00# ls -L -alF /compat/linux/usr/bin/foo /usr/bin/foo /bin/foo /compat/linux/bin/foo -rwxr-xr-x 1 root wheel 89456 Apr 25 18:10 /bin/foo* -rwxr-xr-x 1 root wheel 89456 Apr 25 18:10 /compat/linux/bin/foo* -r-xr-xr-x 1 root wheel 23444 Nov 17 02:23 /compat/linux/usr/bin/foo* -r-xr-xr-x 1 root wheel 23444 Nov 17 02:23 /usr/bin/foo* sh-3.00# exit # ls -alF /compat/linux/usr/bin/foo /usr/bin/foo /bin/foo /compat/linux/bin/foo ls: /usr/bin/foo: No such file or directory -r-xr-xr-x 1 root wheel 23444 Nov 17 02:23 /bin/foo* -rwxr-xr-x 1 root wheel 89456 Apr 25 18:10 /compat/linux/bin/foo* lrwxr-xr-x 1 root wheel 8 May 1 20:04 /compat/linux/usr/bin/foo@ -> /bin/foo # ls -L -alF /compat/linux/usr/bin/foo /usr/bin/foo /bin/foo /compat/linux/bin/foo ls: /usr/bin/foo: No such file or directory -r-xr-xr-x 1 root wheel 23444 Nov 17 02:23 /bin/foo* -rwxr-xr-x 1 root wheel 89456 Apr 25 18:10 /compat/linux/bin/foo* -r-xr-xr-x 1 root wheel 23444 Nov 17 02:23 /compat/linux/usr/bin/foo*