www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/01/04:15:41

Date: Wed, 1 Apr 1998 12:12:56 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: DJ Delorie <dj AT delorie DOT com>
cc: gerlach AT netcom16 DOT netcom DOT com, "Matthew H. Gerlach" <gerlach AT netcom DOT com>,
djgpp-workers AT delorie DOT com, djgpp AT delorie DOT com
Subject: Re: [gerlach AT netcom DOT com: Even more RCS with network drives.]
In-Reply-To: <199804010245.VAA24878@delorie.com>
Message-ID: <Pine.SUN.3.91.980401115602.2919X-100000-100000@is>
MIME-Version: 1.0

On Tue, 31 Mar 1998, Matthew H. Gerlach wrote:

> My first change, should probably be part of the official libc.a, whereby
> if the file doesn't exist, just exit and set errno to ENOENT.  This change
> fixes initializing rcs files on network drives.

Agreed.  This patch should definitely be applied.  If a file doesn't 
exist, we shouldn't worry about removing it.

> God only knows why a printf after the _chmod making the file 
> writeable makes a difference, but it does.  In particular having the \n 
> in the printf string is critical.  Without the \n in the printf the
> function would return erroneously and set errno to EACCES, which the rcs
> code did not like.

I think using `printf' *introduces* another bug which just happens to 
undo the damage of the original problem (which I still don't understand).  
The code clearly says it relies on the file name to stay in the transfer 
buffer.  `printf' with a newline flushes the stdout buffer, which uses 
the transfer buffer, and thus overwrites the file name there.  Then when 
you call `_chmod' it uses whatever `printf' printed as the file name!

Try adding a call to `putpath' after `printf' to put the file name into 
the transfer buffer, and I believe the bug will be resurrected.

> #ifdef MAKES_IT_WORK
>     printf("remove(%s) failed errno = %d\n", fn, errno);
>     if (errno == EACCES)
>         errno = ENOENT;
> #endif

This I don't like.  IMHO we should only replace EACCES by ENOENT of we 
know for sure the file doresn't exist.  In this case, it does exist, but 
cannot be removed due to access rights, so it seems to be one of the few 
cases where EACCES is *exactly* right.

- Raw text -


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