🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #768

Re: name globbing bug

#768
From: Joe Ramey
Date: Wed, 22 Nov 1989 23:30
46 lines
1916 bytes
In article <THEWALT.89Nov21083156@RITZ.ce.cmu.edu> thewalt@RITZ.ce.cmu.edu (Chris Thewalt) writes:

   I seem to have found a file name globbing bug, whenever the string
   to be expanded starts with a / the / seems to be dissappearing in
   the attempted expansion.  For example, if I am in directory /bin
   and do

   ls /t*

   I get tar tee test time tp true (in the current dir)

   instead of
      tmp tp	(in /)

   [bash 1.04 on MicroVAX II running Ultrix 2.2]

   Chris --

I came up with this fix for the problem.  Note that even with this fix
bash still behaves differently than sh and csh.  Try

	echo /tm* //tm* ///tm*
and notice that one / is removed from the last two examples.

*** glob.c.ORIG	Fri Sep 22 23:35:45 1989
--- glob.c	Tue Nov 14 10:17:14 1989
***************
*** 415,421 ****
      }
    else
      {
!       directory_len = filename - pathname;
        directory_name = (char *) alloca (directory_len + 1);
        bcopy (pathname, directory_name, directory_len);
        directory_name[directory_len] = '\0';
--- 415,424 ----
      }
    else
      {
!       if (filename == pathname)
! 	directory_len = 1;
!       else
! 	directory_len = filename - pathname;
        directory_name = (char *) alloca (directory_len + 1);
        bcopy (pathname, directory_name, directory_len);
        directory_name[directory_len] = '\0';
Technical Details
Message-ID: <RAMEY.89Nov22173056@jello.csc.ti.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!cs.utexas.edu!ti-csl!m2!ramey
References: <THEWALT.89Nov21083156@RITZ.ce.cmu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!cs.utexas.edu!ti-csl!m2!ramey
From: ramey@jello.csc.ti.com (Joe Ramey)
Newsgroups: gnu.bash.bug
Subject: Re: name globbing bug
Message-ID: <RAMEY.89Nov22173056@jello.csc.ti.com>
Date: 22 Nov 89 23:30:56 GMT
References: <THEWALT.89Nov21083156@RITZ.ce.cmu.edu>
Sender: news@ti-csl.csc.ti.com
Distribution: gnu
Organization: TI Computer Science Center, Dallas
Lines: 46
In-reply-to: thewalt@RITZ.ce.cmu.edu's message of 21 Nov 89 13:31:56 GMT