delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/11/13/12:59:45

Date: Wed, 13 Nov 1996 19:35:45 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: djgpp-workers AT delorie DOT com
Cc: Charles Sandmann <sandmann AT clio DOT rice DOT edu>, DJ Delorie <dj AT delorie DOT com>
Subject: Cannot symlink when basename is 8 chars
Message-Id: <Pine.SUN.3.91.961113192549.5516G-100000@is>
Mime-Version: 1.0

It seems there is a bug in the stub: when the basename of the symlink in 
the stubinfo structure has exactly 8 characters, the stub won't run it.  
To reproduce:

	cp gcc.exe x2345678.exe
	ln -s x2345678.exe xlink.exe
	xlink
or
	xcopy gcc.exe x2345678.exe
	stubify -g xlink.exe
	stubedit xlink.exe runfile=x2345678
	xlink

This should produce "x2345678.EXE: Cannot open" error message.

I think the problem is in the following fragment from stub.asm:

;-----------------------------------------------------------------------------
;  Replace the stub's file name with the link's name after the directory

        mov     cx, 8                   ; max length of basename
        mov     di, stubinfo_basename   ; pointer to new basename
@b1:
        mov     al, [di]                ; get next character
        inc     di
        or      al, al                  ; end of basename?
        je      @f1
        mov     [bx], al                ; store character
        inc     bx
        loop    @b1                     ; eight characters?
@f1:
        movd    [bx+0], 0x4558452e      ; append ".EXE"
        add     bx, 4
        mov     [bx], al                ; al = 0
        mov     [loadname_nul], bx      ; remember nul so we can change 


There: it assumes that AL holds a zero, but in the case that there are 
exactly 8 characters, it doesn't (it holds the last character of the 
basename instead).

I don't want to suggest a fix, since I don't know how to do it in a way 
that uses the least number of bytes.

If I'm right, this problem is IMHO serious enough to justify another 
update of djdev.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019