🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1113

Patch bug

#1113
From: Larry Jones
Date: Thu, 19 Nov 1992 07:55
40 lines
2130 bytes
Patch has a problem patching a read-only file with a 14
character name on a file system that only supports 14 character
names.  Since the file is read-only, patch tries to find an RCS
or SCCS file to check out.  Unfortunately, the generated RCS
file name, when truncated to 14 characters, is the same as the
original file name so patch thinks it has found an RCS file and
tries to do RCS stuff which then fails.  The following diff
(against the 12u8 version) fixes this problem by checking that
the RCS file is not the same as the original file before trying
to process it.

*** inp.c.old	Thu Nov 19 12:04:18 1992
--- inp.c	Thu Nov 19 12:06:02 1992
***************
*** 109,117 ****
  	strncpy(s, filename, pathlen);
  
  #define try(f, a1, a2) (Sprintf(s + pathlen, f, a1, a2), stat(s, &cstat) == 0)
! 	if (   try("RCS/%s%s", filebase, RCSSUFFIX)
! 	    || try("RCS/%s"  , filebase,         0)
! 	    || try(    "%s%s", filebase, RCSSUFFIX)) {
  	    Sprintf(buf, CHECKOUT, filename);
  	    Sprintf(lbuf, RCSDIFF, filename);
  	    cs = "RCS";
--- 109,119 ----
  	strncpy(s, filename, pathlen);
  
  #define try(f, a1, a2) (Sprintf(s + pathlen, f, a1, a2), stat(s, &cstat) == 0)
! 	if ((   try("RCS/%s%s", filebase, RCSSUFFIX)
! 	     || try("RCS/%s"  , filebase,         0)
! 	     || try(    "%s%s", filebase, RCSSUFFIX)) &&
! 	    (   filestat.st_dev != cstat.st_dev
! 	     || filestat.st_ino != cstat.st_ino)) {
  	    Sprintf(buf, CHECKOUT, filename);
  	    Sprintf(lbuf, RCSDIFF, filename);
  	    cs = "RCS";
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
larry.jones@sdrc.com  or  ...uunet!sdrc!larry.jones
Hmm... That might not be politic. -- Calvin
Technical Details
Message-ID: <9211191755.AA03518@thor.sdrc.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!thor.sdrc.com!scjones

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!thor.sdrc.com!scjones
From: scjones@thor.sdrc.com (Larry Jones)
Subject: Patch bug
Message-ID: <9211191755.AA03518@thor.sdrc.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 19 Nov 1992 07:55:25 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 41