From: dk%"karsten@tfl.dk" 11-JAN-1991 02:46:44.60 To: ipmdf@YMIR.BITNET CC: Subj: RE: Problem applying patches with PATCH Received: From YMIR(POSTMAST) by NYUACF7 with Jnet id 4911 for TIHOR@NYUACF; Fri, 11 Jan 91 02:46 EST Return-path: newsmgr@mccall.uucp Received: from KSUVM.KSU.EDU (MAILER@KSUVM) by YMIR.CLAREMONT.EDU with PMDF#10000; Thu, 10 Jan 1991 20:56 PST Received: from KSUVM by KSUVM.KSU.EDU (Mailer R2.07) with BSMTP id 8578; Thu, 10 Jan 91 22:53:16 CST Received: from deimos.cis.ksu.edu by KSUVM.KSU.EDU (IBM VM SMTP R1.2.2MX) with TCP; Thu, 10 Jan 91 22:53:00 CST Received: by deimos.cis.ksu.edu (5.58a-3B15/SWH-2.03); id AA28721; Thu, 10 Jan 91 23:42:36 EST Resent-date: Thu, 10 Jan 1991 20:58 PST Date: 10 Jan 91 14:35:56 GMT From: karsten@tfl.dk Subject: RE: Problem applying patches with PATCH To: ipmdf@YMIR.BITNET Errors-to: postmast@YMIR.BITNET Message-id: <1991Jan10.153556.130@tfl.dk> X-Envelope-to: TIHOR@NYUACF.BITNET X-VMS-To: ipmdf@YMIR.CLAREMONT.EDU Organization: TFL, A Danish Telecommunication Research Laboratory In article , netmgr@finfun.bitnet (PEKKA KYTOLAAKSO VTKK/TLP) writes: > Atleast the version I have of PATCH has a problem with copying files. > I made PATCH work by defining SYS$SCRATCH to be on the same disk as PMDF: > > > $define sys$scratch pmdf_root:[src] > $patch I have corrected the bug that SYS$SCRATCH needed to point to the same device as the where the patched file was to go. There are two patches in the following following text: 1) If the file names in the diff files contained directory information, then PATCH generated erroneous file names. You need that patch to patch ANU-NEWS. 2) The patch correcting the SYS$SCRATCH problem. Karsten Nyblad TFL, A Danish Telecommunication Research Laboratory E-mail: karsten@tfl.dk $! ................... Cut between dotted lines and save. ................... $!........................................................................... $! VAX/VMS archive file created by VMS_SHARE V06.10 7-FEB-1989. $! $! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from $! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au). $! $! To unpack, simply save, concatinate all parts into one file and $! execute (@) that file. $! $! This archive was created by user KARSTEN $! on 30-DEC-1989 14:36:02.57. $! $! It contains the following 2 files: $! PATCH.DIFF $! PATCH2.DIFF $! $!============================================================================ $ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL ) $ VERSION = F$GETSYI( "VERSION" ) $ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK $ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", - "VMS_SHARE V06.10 7-FEB-1989 requires VMS V4.4 or higher." $ EXIT 44 ! SS$_ABORT $VERSION_OK: $ GOTO START $! $UNPACK_FILE: $ WRITE SYS$OUTPUT "Creating ''FILE_IS'" $ DEFINE/USER_MODE SYS$OUTPUT NL: $ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION - VMS_SHARE_DUMMY.DUMMY b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) ) ; s_file_spec := GET_INFO( COMMAND_LINE, "output_file" ); SET( OUTPUT_FILE , b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" ); i_errors := 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN & "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; POSITION ( BEGINNING_OF( b_part ) ); LOOP EXITIF SEARCH( SPAN( ' ' )@r_trail & LINE_END, FORWARD) = 0; POSITION( r_trail ); ERASE( r_trail ); ENDLOOP ; POSITION( BEGINNING_OF( b_part ) ); i_append_line := 0; LOOP EXITIF MARK ( NONE ) = END_OF( b_part ); s_x := ERASE_CHARACTER( 1 ) ; IF s_x = '+' THEN r_skip := SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip <> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF ; ENDIF; IF s_x = '-' THEN r_skip := SEARCH( pat_end, FORWARD, EXACT ) ; IF r_skip <> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip := MARK( NONE ); r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip <> 0 THEN POSITION( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET ) ; MOVE_VERTICAL( 1 ); MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part ) ); ENDIF; ERASE( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF ; IF s_x = 'V' THEN s_x := ''; IF i_append_line <> 0 THEN APPEND_LINE ; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF; i_append_line := 1 ; MOVE_VERTICAL( 1 ); ENDIF; IF s_x = 'X' THEN s_x := ''; IF i_append_line <> 0 THEN APPEND_LINE; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF ; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> '' THEN i_errors := i_errors + 1; s_text := CURRENT_LINE; POSITION( b_errors ); COPY_TEXT ( "The following line could not be unpacked properly:" ); SPLIT_LINE ; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ); MOVE_VERTICAL ( 1 ); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH ( "`", FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ); ERASE_CHARACTER( 1 ); COPY_TEXT( ASCII( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDLOOP ; IF i_errors = 0 THEN SET( NO_WRITE, b_errors, ON ); ELSE POSITION ( BEGINNING_OF( b_errors ) ); COPY_TEXT( FAO ( "The following !UL errors were detected while unpacking !AS", i_errors , s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors, "SYS$COMMAND" ) ; ENDIF; EXIT; $ DELETE VMS_SHARE_DUMMY.DUMMY;* $ CHECKSUM 'FILE_IS $ WRITE SYS$OUTPUT " CHECKSUM ", - F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!!,passed." ) $ RETURN $! $START: $ FILE_IS = "PATCH.DIFF" $ CHECKSUM_IS = 494013192 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X*** util.c X--- util.c;-1 X************** X*** 33,40 X `032 X `035ifdef VMS V /* This is not robust -- we just rename the file, hoping for the best. X */ V! if (*to == '/' `124`124 *to == '<' `124`124 *to == '`091' `124`124 strc Xhr(to,':') != 0) X! Strcpy(bakname, to); X else `123 X `009Strcpy(bakname, "./"); X `009Strcat(bakname, to); X--- 33,39 ----- X `032 X `035ifdef VMS V /* This is not robust -- we just rename the file, hoping for the best. X */ X! if (*to == '/') Strcpy(bakname, to); X else `123 X `009Strcpy(bakname, "./"); X `009Strcat(bakname, to); $ GOSUB UNPACK_FILE $ FILE_IS = "PATCH2.DIFF" $ CHECKSUM_IS = 1579820730 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X*** util.c X--- util.c;2 X************** X*** 9,17 X move`095file(from,to) X char *from, *to; X `123 X- `035ifdef VMS X- char toname`091512`093; X- `035else X char bakname`091512`093; X `035endif X Reg1 char *s; X--- 9,14 ----- X move`095file(from,to) X char *from, *to; X `123 X char bakname`091512`093; X Reg1 char *s; X Reg2 int i; X************** X*** 13,19 X char toname`091512`093; X `035else X char bakname`091512`093; X- `035endif X Reg1 char *s; X Reg2 int i; X Reg3 int fromfd; X--- 10,15 ----- X char *from, *to; X `123 X char bakname`091512`093; X Reg1 char *s; X Reg2 int i; X Reg3 int fromfd; X************** X*** 36,41 X `125 X `032 X `035ifdef VMS V if (*to == '/' `124`124 *to == '<' `124`124 *to == '`091' `124`124 strc Xhr(to,':') != 0) X Strcpy(toname, to); X else `123 X--- 32,38 ----- X `125 X `032 X `035ifdef VMS V+ /* This is not robust -- we just rename the file, hoping for the best. X */ V if (*to == '/' `124`124 *to == '<' `124`124 *to == '`091' `124`124 strc Xhr(to,':') != 0) X Strcpy(bakname, to); X else `123 X************** X*** 37,43 X `032 X `035ifdef VMS V if (*to == '/' `124`124 *to == '<' `124`124 *to == '`091' `124`124 strc Xhr(to,':') != 0) X! Strcpy(toname, to); X else `123 X `009Strcpy(toname, "./"); X `009Strcat(toname, to); X--- 34,40 ----- X `035ifdef VMS V /* This is not robust -- we just rename the file, hoping for the best. X */ V if (*to == '/' `124`124 *to == '<' `124`124 *to == '`091' `124`124 strc Xhr(to,':') != 0) X! Strcpy(bakname, to); X else `123 X `009Strcpy(bakname, "./"); X `009Strcat(bakname, to); X************** X*** 39,46 V if (*to == '/' `124`124 *to == '<' `124`124 *to == '`091' `124`124 strc Xhr(to,':') != 0) X Strcpy(toname, to); X else `123 X! `009Strcpy(toname, "./"); X! `009Strcat(toname, to); X `125 X i=rename (from, toname); X if (i) `123 X--- 36,43 ----- V if (*to == '/' `124`124 *to == '<' `124`124 *to == '`091' `124`124 strc Xhr(to,':') != 0) X Strcpy(bakname, to); X else `123 X! `009Strcpy(bakname, "./"); X! `009Strcat(bakname, to); X `125 X i=rename (from, bakname); V /* printf ("Attempted to rename `037s to `037s; status `037d`092n", from, X bakname, i); */ X************** X*** 42,53 X `009Strcpy(toname, "./"); X `009Strcat(toname, to); X `125 X! i=rename (from, toname); X! if (i) `123 X! say3("Could not rename from `037s to `037s,`092n", from, toname); X! say1("We try copying and deleting the file instead`092n"); X! `125 X! if (i) `123 /* Using two conditions to make syntax of program fit */ X `035else X Strcpy(bakname, to); X Strcat(bakname, origext?origext:ORIGEXT); X--- 39,46 ----- X `009Strcpy(bakname, "./"); X `009Strcat(bakname, to); X `125 X! i=rename (from, bakname); V! /* printf ("Attempted to rename `037s to `037s; status `037d`092n", from, X bakname, i); */ X `035else X Strcpy(bakname, to); X Strcat(bakname, origext?origext:ORIGEXT); X************** X*** 86,92 X `009say3("Moving `037s to `037s.`092n", from, to); X `035endif X if (link(from, to) < 0) `123`009`009/* different file system? */ X- `035endif /* VMS */ X `009Reg4 int tofd; X `009tofd = creat(to, 0666); X `009if (tofd < 0) `123 X--- 79,84 ----- X `009say3("Moving `037s to `037s.`092n", from, to); X `035endif X if (link(from, to) < 0) `123`009`009/* different file system? */ X `009Reg4 int tofd; X `009 X `009tofd = creat(to, 0666); X************** X*** 88,93 X if (link(from, to) < 0) `123`009`009/* different file system? */ X `035endif /* VMS */ X `009Reg4 int tofd; X `009tofd = creat(to, 0666); X `009if (tofd < 0) `123 X `009 say3("patch: can't create `037s, output is in `037s.`092n", X--- 80,86 ----- X `035endif X if (link(from, to) < 0) `123`009`009/* different file system? */ X `009Reg4 int tofd; X+ `009 X `009tofd = creat(to, 0666); X `009if (tofd < 0) `123 X `009 say3("patch: can't create `037s, output is in `037s.`092n", X************** X*** 104,109 X `009Close(tofd); X `125 X Unlink(from); X return 0; X `125 X `032 X--- 97,103 ----- X `009Close(tofd); X `125 X Unlink(from); X+ `035endif /* VMS */ X return 0; X `125 $ GOSUB UNPACK_FILE $ EXIT