delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/18/11:46:05

From: muller AT janus DOT u-strasbg DOT fr (Pierre Muller)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: utod with LFN=Y bug ?
Date: 18 May 1998 15:40:33 GMT
Organization: Institut Charles Sadron
Lines: 60
Message-ID: <6jpkph$92b@news.u-strasbg.fr>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 980518155852 DOT 18465A-100000 AT is>
NNTP-Posting-Host: laocoon.u-strasbg.fr
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <Pine DOT SUN DOT 3 DOT 91 DOT 980518155852 DOT 18465A-100000 AT is>, eliz AT is DOT elta DOT co DOT il 
says...
>
>
>On 18 May 1998, Pierre Muller wrote:
>
>>    Using utod with LFN=Y in djgpp.env
>> does not work for me (DJGPP v2.01 in Windows 95 box)
>
>utod works for me, with and without LFN=y.  What exactly do you mean by 
>``does not work''?  What happends when you run it on a file?
>
>>   the dtou.exe leaves the dtou.tm$ file and apparently
>> the rename call fails !
>
  utod test.c
   will perform the conversion but the problem lies in the rename function

  it calls rename('utod.tm$','test.c')
which in turn return _rename with the same args

  (I recompiled utod.exe with -g and _rename.c also 
to be able to debug _rename

   And there I discovered a bug :
   sizeof(try_char) returned 36
   but this is not correct
    because
    static char try_char[] = "abcdefghijklmnopqrstuvwxyz012345789";
    is only 35 bytes long (notice the missing 6 in the digits !!)

    so the statement 

    do
    {
      if (idx <= 0)
	     return -1;
      *pbase = try_char[--idx];
      /* bug sizeof(try_char) returns 36 instead of 35)
      so the first is 0 !! */
      if (*pbase == 0)
       *pbase = try_char[--idx];
    } while (_chmod(tempfile, 0) != -1);

   Morality : we should not use sizeof here
because it round up to 4 bytes but strlen I suppose
(of course if 6 would not be missing the code would have worked
but I still think that it is not really proper coding way !!)

  
   Adding the extra check worked for me
   replacing sizeof by strlen worked also
   reinserting the 6 digit would also work ... 
>There's something strange in your system setup, or in the files that you 
>are trying to convert.  Please post the exact command you used to convert 
>the files, and also the shortest file that can be used to reproduce your 
>problem, including its file name.
>
>Please also post the output of "dir dtou.exe".

- Raw text -


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