🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #98729

directory-file-name doesn't de-slash one-letter names

#98729
From: Hugh Secker-Walker
Date: Wed, 20 Mar 1991 21:59
38 lines
1990 bytes
"GNU Emacs 18.55.5 of Wed Oct 10 1990 on ear (berkeley-unix)"
DECstation 3100, Ultrix V4.0 (Rev. 163)

One letter names ending in a slash are not de-slashed by directory-file-name.

(directory-file-name "a/")
	=> "a/"

The bug is in the function directory_file_name in fileio.c.
We are running 18.55, but this function is identical in 18.57.

The fix is simple; site/emacs-18.57/src/fileio.c is the fixed version.
(Note the assignment to (poorly named :-) slen near the top of the function,
    slen = strlen (src) - 1; )

*** site/emacs-18.57/src/fileio.c	Wed Mar 20 16:42:42 1991
--- dist/emacs-18.57/src/fileio.c	Thu Jan 10 12:29:46 1991
***************
*** 388,394 ****
    /* Process as Unix format: just remove any final slash.
       But leave "/" unchanged; do not change it to "".  */
    strcpy (dst, src);
!   if (dst[slen] == '/' && slen > 0)
      dst[slen] = 0;
    return 1;
  }
--- 388,394 ----
    /* Process as Unix format: just remove any final slash.
       But leave "/" unchanged; do not change it to "".  */
    strcpy (dst, src);
!   if (dst[slen] == '/' && slen > 1)
      dst[slen] = 0;
    return 1;
  }

--
Hugh Secker-Walker                    INTERNET:  hugh@ear-ache.mit.edu
MIT, Research Lab of Electronics      UUCP:      mit-eddie!mit-athena!hugh
Technical Details
Message-ID: <9103202159.AA24145@ear.MIT.EDU>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!tut.cis.ohio-state.edu!unreplyable!garbage

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,a1e86bd520ff8873,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1991-03-20 13:59:45 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!tut.cis.ohio-state.edu!unreplyable!garbage
From: hugh@EAR.MIT.EDU (Hugh Secker-Walker)
Newsgroups: gnu.emacs.bug
Subject: directory-file-name doesn't de-slash one-letter names
Message-ID: <9103202159.AA24145@ear.MIT.EDU>
Date: 20 Mar 91 21:59:45 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 38
Approved: bug-gnu-emacs@prep.ai.mit.edu