From owner-freebsd-bugs Wed May 22 19:20:27 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 24B2037B41F for ; Wed, 22 May 2002 19:20:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g4N2K2l83280; Wed, 22 May 2002 19:20:02 -0700 (PDT) (envelope-from gnats) Received: from viola.sinor.ru (viola.sinor.ru [217.70.106.9]) by hub.freebsd.org (Postfix) with ESMTP id 6F80837B40B for ; Wed, 22 May 2002 19:10:42 -0700 (PDT) Received: from be9.home.ru (p144.bass7.sinor.ru [217.70.109.144]) by viola.sinor.ru (8.9.3/8.9.3) with ESMTP id JAA13614 for ; Thu, 23 May 2002 09:10:38 +0700 Received: from unknown (localhost [127.0.0.1]) by be9.home.ru (8.12.3/8.12.3) with SMTP id g4N2EWcT000670 for ; Thu, 23 May 2002 09:14:34 +0700 (NOVST) (envelope-from be9@be9.ru) Message-Id: <20020523091432.5aa8640b.be9@be9.ru> Date: Thu, 23 May 2002 09:14:32 +0700 From: oleg dashevskii To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/38442: possible bug in /bin/sh: inconsistency between manpage and real program behaviour Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 38442 >Category: bin >Synopsis: possible bug in /bin/sh: inconsistency between manpage and real program behaviour >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed May 22 19:20:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: oleg dashevskii >Release: FreeBSD 4.6-PRERELEASE i386 >Organization: NSU >Environment: System: FreeBSD be9.home.ru 4.6-PRERELEASE FreeBSD 4.6-PRERELEASE #1: Wed May 15 10:22:20 NOVST 2002 od@be9.home.ru:/usr/obj/usr/src/sys/BECHO i386 >Description: Quoting from `man sh`: === q === If directory is not found as a subdirectory of the current directory (and does not begin with ``/'', ``./'', or ``../''), then the directories listed in the CDPATH variable will be searched for the specified directory. === end q === Now let us check that: running /bin/sh: $ cd $ pwd /home/od $ export CDPATH=/ $ echo $CDPATH / $ mkdir 9999 $ cd 9999 cd: can't cd to 9999 $ cd ./9999 cd: can't cd to ./9999 $ cd ../od/9999 cd: can't cd to ../od/9999 $ cd .. / <---- and here must be /home, not "/" !!! $ pwd / $ cd /home/od/9999 $ pwd /home/od/9999 <---- works with full path $ export CDPATH= $ cd $ cd 9999 $ pwd /home/od/9999 So, as we can see, CDPATH is preferred over subdirectories in current directory, as opposed to the words from the manpage. Even '..' was substituted as '/..' which is certainly just '/'! >How-To-Repeat: See above. >Fix: /usr/src/bin/sh/cd.c should be fixed, I guess. Possible workaround is to add "." to the CDPATH, that's what I've done. If noone is willing to fix that bug in the code, then the manpage should be changed to reflect this "bug-o-feature" behavior. By the way, zsh doesn't suffer from such a problem. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message