...RMVFIL]000READ.ME
--------------------
RMVFIL - remove a file left open by INSTALL REPLACE bug

; VMS versions:	Problem verified for V5.1-1 and V5.3.  This program
;		worked under both these versions.
;
; Disclaimer:	There are absolutely *no* guarantees whatsoever about the
;		applicability or reliability of this code under *any*
;		conditions.  *USE AT YOUR OWN RISK*
;
; Description:
;	The INSTALL utility under VMS V5.1-1 and VMS V5.3 (at least) has
;	a problem with the replace command.  If a version number is specified
;	as the replacement target, and the original file is installed /open,
;	it will be replaced, but the original file will still be held open.
;	A further problem develops if you try to dismount the volume in that
;	the volume will enter a dismount pending state, and become unusable.
;	This program may be used to forcibly close the open file even in the
;	case that a dismount is pending.
;	Note that this routine is coded to avoid shadowsets and volumesets.
;	If you've gotten into this problem with a volumeset or a shadowset
;	then *you* get to modify this code to access the target FCB correctly!
;
; Usage:
;	First rule: Don't use INSTALL REPLACE and specify a version number.
;	Second rule: Reboot your system to fix the problem if possible.
;	Make *SURE* that all INSTALL'ed files on the volume are removed!!!!
;	*DO NOT* use this program to harrass INDEXF.SYS, or QUOTA.SYS!!!
;	Get all users off the drive, and off the system if possible.
;	Type: $ SET COMMAND RMVFIL, and $ RMVFIL <file.ext;v>.
;
; RMVFIL.CLD: (remove ';<tab>' from these lines for RMVFIL.CLD)
;	define verb rmvfil
;		image		sys$disk:[]rmvfil.exe
;		parameter	p1,		label=file,
;						prompt="File",
;						value(required,type=$FILE)
; Assembly & linking:
;	$ MACRO rmvfil
;	$ LINK rmvfil
;
;--

A file called INSPATCH_V51-1.COM has been provided for use with the INSTALL.EXE
from VMS V5.1-1 with the following version information ($ ANALYZE/IMAGE -
SYS$SYSTEM:INSTALL.EXE):
	Image Identification Information
		image name: "INSTALL"
		image file identification: "X-5"
		link date/time:  8-APR-1988 05:25:40.02
		linker identification: "04-92"
	Patch Information
		DEC eco levels   1- 96: %X'00000001', %X'00000000', %X'00000000'
		user eco levels 97-128: %X'00000000'
		read/write patch area address: %X'00006A40', length: 448
		read-only patch area address:  %X'00000000', length: 0
		patch command text VBN: 55
		last patch date/time: 25-SEP-1990 11:56:24.52

A file called INSPATCH_V53-1.COM has been provided for use with the INSTALL.EXE
from VMS V5.3-1 with the following version information ($ ANALYZE/IMAGE -
SYS$SYSTEM:INSTALL.EXE):
	Image Identification Information
		image name: "INSTALL"
		image file identification: "X-10"
		link date/time: 12-OCT-1989 00:43:31.66
		linker identification: "05-05"
	Patch Information
		There are no patches at this time.

These patch procedures verify the image link date and time, but this is still
not an absolute guarantee of rejecting wrong images for patching.  Also, no
ECO levels are checked.  Even if your ECO levels are different, there is a
possiblity that this patch might still work, but you'd be taking a big chance!
Therefore, if your version of INSTALL.EXE does not exactly match the info
listed for your version of VMS, *DO NOT USE INSTALL_PATCH.COM* !!!

If it does, then the INSPATCH_V5x-1.COM file may be used to create an alternate
version of INSTALL.EXE which does not have the REPLACE w/version bug.  The
patch works by simply forcing the removal of any specified versions prior to
allowing INSTALL to $OPEN the image.  This means that INSTALL/REPLACE F.EXE;-1
will now no longer install the previous version of F, but neither will it
leave the original F.EXE hanging open.

If you wish to apply this patch to any other version of INSTALL, then you will
need to understand exactly what the patch is doing, and find the identical
target location in the particular version of INSTALL you are trying to patch.
In summary, this patch is inserted at the CALLS #1,@#SYS$OPEN in INSTALL where
INSTALL is first attempting to OPEN the user-specified image for replacement.
The patch code finds the text string being used for the filename, then searches
the text string for either ';' or a second '.' specifying the version number.
If such a character is found, then the FAB$B_FNS field value is truncated to
the length of the string prior to the version specification character.  This
makes INSTALL act as if the user never specified the version.  The bug occurs
because during this SYS$OPEN call, INSTALL is trying to do a 'known file open'
through RMS.  Since the version was specified, RMS will *not* find a KFE for
the file.  INSTALL does its own KFE search and finds a KFE... now INSTALL is
reeallly confused.  It will remove & replace the KFE, but since RMS did not
find the KFE, the associated FCB is not correctly removed.

*ALWAYS* make a safe copy of any image you are going to patch *PRIOR* to
executing the patch procedure!!!  I cannot stress this enough!!!  Put the
backup copy somewhere safe, and under a different name than INSTALL.EXE before
you run this procedure!  Also, this procedure will try to make a backup copy
for you, and if you run the procedure more than once, the backup copy may be
the 'last patched' copy.

Following is the dialog from INSPATCH_V5x-1.COM (note that BUG:[SCR] is used
as the translation for 'SYS$SCRATCH'):
$ @inspatch_v51-1
SYS$COMMON:[SYSEXE]INSTALL.EXE;2 copied to BUG:[SCR]INSTALL.EXE;2 (55 blocks)
   :
   < bunch of PATCH output omitted here >
   :
Updating image file BUG:[SCR]INSTALL.EXE;3
Create backup of original SYS$???:[SYSEXE]INSTALL.EXE...
******************************************************************
****ASK FOR CONFIMATION TO MAKE BACKUP OF ORIGINAL INSTALL.EXE****
******************************************************************
COPY SYS$COMMON:[SYSEXE]INSTALL.EXE;2 to SYS$COMMON:[SYSEXE]INSTALL.ORIGINAL_EXE
;2 ? [N]: Y
SYS$COMMON:[SYSEXE]INSTALL.EXE;2 copied to SYS$COMMON:[SYSEXE]INSTALL.ORIGINAL_
EXE;2 (55 blocks)
Load patched INSTALL.EXE to SYS$SPECIFIC:[SYSEXE]INSTALL.EXE;...
**********************************************************************
****ASK FOR CONFIMATION TO PUT PATCHED INSTALL.EXE IN SYS$SPECIFIC****
**********************************************************************
COPY BUG:[SCR]INSTALL.EXE;3 to SYS$SPECIFIC:[SYSEXE]INSTALL.EXE; ? [N]: Y
BUG:[SCR]INSTALL.EXE;3 copied to SYS$SPECIFIC:[SYSEXE]INSTALL.EXE;1 (55 blocks)
Using logical name to insert new INSTALL image...
*************************************************************
****ASK FOR CONFIMATION TO DEFINE INSTALL in SYSTEM TABLE****
*************************************************************
_Define new install to system table: <Y> 
$ define/system/exec install sys$specific:[sysexe]install.exe
