[comp.emacs] bug in substitute-in-file-name

sasdjb@sas.UUCP (David Biesack) (11/16/89)

substitute-in-file-name does not work properly on
Apollo Domain/OS GNU Emacs. The problem seems to occur when
an environment variable contains a pathname which begins
with //hostname, as shown in a log below:

(emacs-version)
"GNU Emacs 18.54.2 of Mon Jun 12 1989 on sdcapol2 (Domain/OS)"

(getenv "JJ")
"-idir //javelin/udr2/sasdjb/h -idir /usr/include"

(getenv "KK")
"-idir /udr2/sasdjb/h -idir /usr/include"

(setq compile-command "/com/cc foo.c -b ../obj/foo.bin $JJ")
"/com/cc foo.c -b ../obj/foo.bin $JJ"

(substitute-in-file-name compile-command)
"/javelin/udr2/sasdjb/h -idir /usr/include"

(setq compile-command "/com/cc foo.c -b ../obj/foo.bin $KK")
"/com/cc foo.c -b ../obj/foo.bin $KK"

(substitute-in-file-name compile-command)
"/com/cc foo.c -b ../obj/foo.bin -idir /udr2/sasdjb/h -idir /usr/include"

The substitution of $JJ causes a loss of the string up to the
//javelin in the environment variable! The second substitute,
with env var KK works properly.

I copied this from an emacs session run as:
% emacs -q

from a /bin/csh with SYSTYPE="bsd4.2", running Domain 9.7

Thanks,
  djb

-- 

David J. Biesack	SAS Institute, Inc.   
rti!sas!sasdjb 		SAS Circle, Box 8000  
(919) 467-8000 		Cary, NC 27512-8000   

jbw@bucsf.UUCP (Joe Wells) (11/19/89)

In article <1319@sas.UUCP> sasdjb@sas.UUCP (David Biesack) writes:

   substitute-in-file-name does not work properly on
   Apollo Domain/OS GNU Emacs. The problem seems to occur when
   an environment variable contains a pathname which begins
   with //hostname, as shown in a log below:

   [stuff deleted]

   The substitution of $JJ causes a loss of the string up to the
   //javelin in the environment variable! The second substitute,
   with env var KK works properly.

This is explained by the following comment taken from the source for
substitute-in-file-name in src/fileio.c:

  /* If /~ or // appears, discard everything through first slash. */

Presumably, this is desirable behavior.  I think the problem is that it is
not well documented that substitute-in-file-name is intended to work on
file names, not on strings in general.

Congratulations on the first properly done bug report I've seen in a long
time!

--
Joe Wells <jbw@bucsf.bu.edu>
jbw%bucsf.bu.edu@bu-it.bu.edu
...!harvard!bu-cs!bucsf!jbw

jbw@bucsf.bu.edu (Joe Wells) (11/19/89)

In article <1319@sas.UUCP> sasdjb@sas.UUCP (David Biesack) writes:

   substitute-in-file-name does not work properly on
   Apollo Domain/OS GNU Emacs. The problem seems to occur when
   an environment variable contains a pathname which begins
   with //hostname, as shown in a log below:

   [stuff deleted]

   The substitution of $JJ causes a loss of the string up to the
   //javelin in the environment variable! The second substitute,
   with env var KK works properly.

This is explained by the following comment taken from the source for
substitute-in-file-name in src/fileio.c:

  /* If /~ or // appears, discard everything through first slash. */

Presumably, this is desirable behavior.  I think the problem is that it is
not well documented that substitute-in-file-name is intended to work on
file names, not on strings in general.

Congratulations on the first properly done bug report I've seen in a long
time!

-- 
Joe Wells <jbw@bucsf.bu.edu>
jbw%bucsf.bu.edu@bu-it.bu.edu
...!harvard!bu-cs!bucsf!jbw