bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: [Fwd: Extrange behavior]]


From: Jordi Prats
Subject: [Fwd: [Fwd: Extrange behavior]]
Date: Tue, 16 Jan 2007 22:41:50 +0100
User-agent: Thunderbird 1.5.0.4 (X11/20060710)

Hi all!
I've done a simple patch for this unexpected behavior.

I don't know if the previous message has arribed to the list because I
wasn't subcribed.

I hope this will be useful :)
-- 
......................................................................
        __
       / /          Jordi Prats Català
 C E / S / C A      Departament de Sistemes
     /_/            Centre de Supercomputació de Catalunya

 Gran Capità, 2-4 (Edifici Nexus) · 08034 Barcelona
 T. 93 205 6464 · F.  93 205 6979 · jprats@cesca.es
......................................................................
pgp:0x5D0D1321
......................................................................
diff -Naur old/builtins/cd.def new/builtins/cd.def
--- old/builtins/cd.def 2006-07-28 03:35:36.000000000 +0200
+++ new/builtins/cd.def 2007-01-16 22:33:10.000000000 +0100
@@ -418,7 +418,12 @@
      (nolinks != 0). */
   tdir = nolinks ? sh_physpath (t, 0)
                 : sh_canonpath (t, PATH_CHECKDOTDOT|PATH_CHECKEXISTS);
-
+  
+  if ((strlen(tdir)==2)&&(*tdir=='/')&&(*(tdir+1)=='/'))
+    {
+      *(tdir+1)=(char)0;
+    }  
+      
   ndlen = strlen (newdir);
   dlen = strlen (t);
 
--- Begin Message --- Subject: [Fwd: Extrange behavior] Date: Tue, 16 Jan 2007 20:16:09 +0100 User-agent: Thunderbird 1.5.0.4 (X11/20060710)
Sorry, I didn't include the configuration information:

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib   -march=k8 -pipe -O2
uname output: Linux a64 2.6.13-gentoo-r5 #2 Wed Feb 8 14:02:44 CET 2006
x86_64 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 3.0
Patch Level: 16
Release Status: release

This is one bash, do you need all of them?

-- 
......................................................................
        __
       / /          Jordi Prats Català
 C E / S / C A      Departament de Sistemes
     /_/            Centre de Supercomputació de Catalunya

 Gran Capità, 2-4 (Edifici Nexus) · 08034 Barcelona
 T. 93 205 6464 · F.  93 205 6979 · jprats@cesca.es
......................................................................
pgp:0x5D0D1321
......................................................................
--- Begin Message --- Subject: Extrange behavior Date: Tue, 16 Jan 2007 20:10:32 +0100 User-agent: Thunderbird 1.5.0.4 (X11/20060710)
Hi all,
I found a extrange behavior on bash in several machines:

rut@a64 ~ $
rut@a64 ~ $ cd //
rut@a64 // $ pwd
//
rut@a64 // $ echo $PWD
//
rut@a64 // $ /bin/pwd
/
rut@a64 // $ bash --version
GNU bash, version 3.00.16(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.

This also happens on a 3.00.15, 3.1.14, 2.05b.0 on Linux and on 2.05b.0
on MacOSX.

I supose pwd it's a builtin command (as it's cd), so it just prints
$PWD. Is this a bug or a feature? I just found this because of a
misstyping, I'm asking this just for curiosity.

Thank you!
-- 
......................................................................
        __
       / /          Jordi Prats Català
 C E / S / C A      Systems Department
     /_/            Centre de Supercomputació de Catalunya

 Gran Capità, 2-4 (Edifici Nexus) · 08034 Barcelona
 T. 93 205 6464 · F.  93 205 6979 · jprats@cesca.es
......................................................................
pgp:0x5D0D1321
......................................................................


--- End Message ---

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]