A bug in the expand-file-name function

From: Giorgio Cesana <cesana_at_venus.sgs-thomson.it>
Date: Wed, 23 Aug 1995 15:57:17 +0200

Dear all,

I have discovered a bug in the expand-file-name function (thanks to our crazy
system administrator and his theory about file names).

Trying to expand the file name "test." (with a final dot, that is legal for unix)
I obtain:

STk> (expand-file-name "test.")

without the final dot.

A temporary work-around could be:

(define stk:expand-file-name expand-file-name)
(define (expand-file-name filename)
        (let ((bn (basename filename)))
                (if (and (> (string-length bn) 1)
                        (char=? (string-ref bn (- (string-length bn) 1)) #\.)
                        (not (string=? bn "..")))
                        (string-append (stk:expand-file-name filename) ".")
                        (stk:expand-file-name filename))))

that returns:
STk> (expand-file-name "test.")
STk> (expand-file-name "..")




Giorgio Cesana | SGS-THOMSON Microelectronics
phone +39/39/603.6006 | Central R&D - DAIS
fax +39/39/603.5820 | via C. Olivetti, 2
e-mail giorgio_cesana.sgs-thomson.it | 20041 Agrate B.za (MI) - ITALY
Received on Wed Aug 23 1995 - 16:00:41 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST