www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/03/11/21:19:00

From: wgue AT berlin DOT snafu DOT de (Wolfgang Guelcker)
Subject: rcs problems in B19 (patch) : bug in API function readlink()
11 Mar 1998 21:19:00 -0800 :
Message-ID: <3514df62.5658566.cygnus.gnu-win32@berlin.snafu.de>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com
Cc: achermann AT inf DOT ethz DOT ch, ian AT visage DOT demon DOT co DOT uk

Erwin Achermann and Ian Lowrey reported problems with rcs when 
built under B19. 

The problems arise due to a bug in the B19 cygwin API function
"readlink()".

readlink() is called in rcsedit.c to check the file in question.
The correct behaviour is:
    if readlink() succeeds the file is a symbolic link
    if readlink() fails and errno is EINVAL the file is a regular file
    if readlink() fails and errno is ENOENT the file does not exist

The bug is, that readlink() in B19 sets errno to EINVAL if the file is

a regular file AND if the file does not exist. In B18 errno was OK.

That means if a file does NOT exist, RCS in B19 thinks it does exists
in this context.
 
The RCS patch below adds a check for file existance after the call to
readlink(). The patches from the "Package status report" are included.

This error shows only if the you work with an rcs extension like ",v".
The test script "rcsedit" works without one (RSCINIT=-x).

I changed the test script "rcstest" to work with an extension.

I reported the readlink() problem on Mar 7, but it didn't show up.
This mail was sent on Mar 11 19:00 GMT.

Wolfgang


diff -c -r rcs-5.7.ori/src/Makefile.in rcs-5.7/src/Makefile.in
*** rcs-5.7.ori/src/Makefile.in	Fri Jun 16 08:19:24 1995
--- rcs-5.7/src/Makefile.in	Tue Mar 10 21:34:56 1998
***************
*** 87,93 ****
   o = .o
  #o = .s# Minix/PC with ACK cc
  
!  x =
  
  #)
  # On non-Unix hosts you must manually create and edit conf.h from conf.heg.
--- 87,93 ----
   o = .o
  #o = .s# Minix/PC with ACK cc
  
!  x = .exe
  
  #)
  # On non-Unix hosts you must manually create and edit conf.h from conf.heg.
diff -c -r rcs-5.7.ori/src/conf.sh rcs-5.7/src/conf.sh
*** rcs-5.7.ori/src/conf.sh	Fri Jun 16 08:19:24 1995
--- rcs-5.7/src/conf.sh	Tue Mar 10 20:42:44 1998
***************
*** 1036,1042 ****
  		then
  			case `ls -t a.c a.d` in
  			a.d*)
! 				has_mmap=1
  				rm -f a.ous
  				mv $aout a.ous
  				$PREPARE_CC || exit
--- 1036,1042 ----
  		then
  			case `ls -t a.c a.d` in
  			a.d*)
! 				has_mmap=0
  				rm -f a.ous
  				mv $aout a.ous
  				$PREPARE_CC || exit
diff -c -r rcs-5.7.ori/src/rcsedit.c rcs-5.7/src/rcsedit.c
*** rcs-5.7.ori/src/rcsedit.c	Fri Jun 16 08:19:24 1995
--- rcs-5.7/src/rcsedit.c	Tue Mar 10 21:51:09 1998
***************
*** 1279,1286 ****
  	bufautoend(&bigbuf);
  	errno = e;
  	switch (e) {
! 	    case readlink_isreg_errno: return 1;
! 	    case ENOENT: return 0;
  	    default: return -1;
  	}
  }
--- 1279,1292 ----
  	bufautoend(&bigbuf);
  	errno = e;
  	switch (e) {
! 	    case readlink_isreg_errno: {
!                 /* B19 readlink does return readlink_isreg_errno = EINVAL  */
!                 /* if file does not exist instead of ENOENT                */
! 		struct stat st;
! 		if ( stat(L->string, &st) == 0 )
!                     return 1;   /* File exists, but no symlink */
!             }
! 	    case ENOENT: return 0;  /* Nothing exists */
  	    default: return -1;
  	}
  }
diff -c -r rcs-5.7.ori/src/rcstest rcs-5.7/src/rcstest
*** rcs-5.7.ori/src/rcstest	Fri Jun 16 08:19:24 1995
--- rcs-5.7/src/rcstest	Tue Mar 10 21:53:13 1998
***************
*** 50,62 ****
  
  CL="$CC $ALL_CFLAGS $LDFLAGS -o a.out"
  L=$LIBS
! 
! RCSINIT=-x
  export RCSINIT
  
  SLASH=/
! RCSfile=RCS${SLASH}a.c
! RCS_alt=RCS${SLASH}a.d
  lockfile=RCS${SLASH}a._
  
  case $1 in
--- 50,63 ----
  
  CL="$CC $ALL_CFLAGS $LDFLAGS -o a.out"
  L=$LIBS
!  
! RCSext=,v
! RCSINIT=-x$RCSext
  export RCSINIT
  
  SLASH=/
! RCSfile=RCS${SLASH}a.c$RCSext
! RCS_alt=RCS${SLASH}a.d$RCSext
  lockfile=RCS${SLASH}a._
  
  case $1 in
***************
*** 195,208 ****
  @Author: w @
  @Date: $date @
  @Header: $PWD$SLASH$RCSfile 2.1 $date w s @
! @Id: a.c 2.1 $date w s @
  @Locker:  @
!  * @Log: a.c @
   * Revision 2.1  $date  w
   * m
   *
  @Name: Oz @
! @RCSfile: a.c @
  @Revision: 2.1 @
  @Source: $PWD$SLASH$RCSfile @
  @State: s @
--- 196,209 ----
  @Author: w @
  @Date: $date @
  @Header: $PWD$SLASH$RCSfile 2.1 $date w s @
! @Id: a.c$RCSext 2.1 $date w s @
  @Locker:  @
!  * @Log: a.c$RCSext @
   * Revision 2.1  $date  w
   * m
   *
  @Name: Oz @
! @RCSfile: a.c$RCSext @
  @Revision: 2.1 @
  @Source: $PWD$SLASH$RCSfile @
  @State: s @
-- 
Wolfgang Guelcker                wgue AT berlin DOT snafu DOT de
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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