----------------------
WARNING TO ALL:
Please DO NOT EXPERIMENT in attempting to duplicate what happened
to me unless you are willing to have every file in your main Arachne
directory deleted and reinstallation required!!! If you use the
information included in this post to do so, don't blame anyone other
than yourself.
----------------------
To all other than Bernie,
Please feel free to read on if you are interested in how batch files
operate and more detail about 'variables' going to/coming from batch
programs, or if you are on a development team and would like to figure
out what went wrong to make Arachne self-destruct. Otherwise, please
feel free to skip this message entirely. :)
Bernie,
Poor question, bad guess, but I'll respond.
On Thu, 18 Jan 2001 08:12:27 +0100, Bernie <[EMAIL PROTECTED]> wrote:
> Have you checked to see what clr.bat does? If you send incorrect data to it
> it might do something like this.
1. Yes, I had checked to see what clr.bat does. I had hoped something
could be done there, but no such luck. That's why I tried experimenting
somewhere else.
2. Since you're not familiar with clr.bat, we can go over it step by
step. But first, some basics:
a. Batch files can work using variables
b. Normally this is limited to 9 unless you decide to "step"; if
you feed in more than 9 variables without "stepping," they
will replace earlier variables from the front. [i.e. #10
becomes #1 and all the other variables are incremented up by
the value of one]
c. A batch file doesn't do anything you don't tell it to do
[i.e. you can feed it 9 variables and it will only work with
the ones specified in the batch program]
d. A variable fed into a batch file must make "DOS sense" for the
batch program to use it. [i.e. if I have a batch file that is
supposed to delete a file or remove a directory, the variable
must be a valid file name or directory; if I feed in the
variable "Bernie" nothing will happen if I don't have a file
named "Bernie" for the batch program to do something to.]
e. What is a variable? How does a batch file recognize one?
I. A variable is value you could type in at the command
line, or -- as in the case of clr.bat -- pass from another
program; variables can be names of files and/or path
statements, numeric values, words, or single letters.
Within a batch program itself, a variable is designated as
%[number] or %%[environmental variable]%%
II. Variables are deliniated by spaces. I have a batch
file that allows me to write a memo or read a memo. At
the prompt I type "memo w name" without the quotes, and it
first calls memo.bat, then recognizes "w" as variable #1
and "name" as variable #2. Within the program variable #1
is compared and if it is not "w" or "r" I have the program
generate an error messages with 'how to' instructions. If
variable #1 is acceptable, then the program will check to
see if it's OK to write a file called "name," and if so it
then calls up an editor to allow "name" to be written. If
only one valid variable is fed into the program, I have
additonal "error messages" the program will generate when
the second variable isn't found, and I even have it
present a listing of the memos available to read.
If I should type in "memo w name 1234 bernie look at me"
it would have no affect on the how the program runs, since
-- although DOS recognizes the additional variables -- the
program uses only two, and anything else will simply be
ignored.
f. A batch program runs in the directory where it is invoked. If
you want it to do something somewhere else, you have to give the
specific paths to do that. i.e. if you want to delete all the
files in /CACHE you must have /CACHE fully pathed. The full path
can be via "hardwiring" in the batch program, via variables fed to
the batch program, or via a combination thereof. [As you will
see, three of the possible ways are used in CLR.BAT]
3. On to CLR.BAT [I've removed the "built-in" explanation to avoid
any confusion]
a. When you look at CLR.BAT you can see that it works with three
variables that have been fed to it: %1 , %2 , and %3
if exist %1 del %1
if exist %3$roura$.BAT copy %3$roura$.BAT bat.tmp>NUL
for %%f in (%2*.*) do del %%f
for %%f in (%2headers\*.*) do del %%f
for %%f in (%3*.*) do del %%%f
if exist bat.tmp copy bat.tmp %3$roura$.BAT>NUL
if exist bat.tmp del bat.tmp
[Note: Those "if" statments are essential to running the program,
because if you tell it to do something and it's impossible, the
program abends at that point. Thus, instead of "del %1" you say
"Hey, if %1 is there get rid of it," and the program is quite
happy of %1 doesn't exist.]
b. Where does CLR.BAT get the variables?? From CORE.EXE
[or possibly from INSIGHT.EXE, but I understand that control for
anything except mail management is transferred out of Insight]
I. When the user decides to give the 'clear cache'
command, CORE.EXE is programmed to look for a dgi
[i.e. a script designed to do the job].
II. CORE.EXE finds the path to the script in MIME.CFG:
file/clearcache.dgi |call $esystem\\dgi\\clr.bat $c $a $t
and the variables are those defined within MIME.CFG:
; $c ... full name of Cache index
; $a ... patch to cache
; $t ... path for Temporary files
d. In the case of my system setup, the batch file which functions
as 'clear cache' script would be invoked like this [from the main
Arachne directory]:
call t:\arachne\system\dgi\clr.bat cache.idx V:\cache\ v:\temp\arachne.tmp\
e. Now let's go step by step as to what CLR.BAT will do given
those variables:
if exist %1 del %1
IF CACHE.IDX EXISTS IN THIS MAIN ARACHNE DIRECTORY, DELETE IT
if exist %3$roura$.BAT copy %3$roura$.BAT bat.tmp>NUL
IF V:\TEMP\ARACHNE.TMP\$ROURA$.BAT EXISTS, COPY IT TO A FILE
NAMED BAT.TMP IN THE DIRECTORY WHERE THIS BATCH FILE IS BEING
RUN [main Arachne directory] AND PUT THE SCREEN WRITE INTO BIT
BUCKET SO IT DOESN'T INTERFER WITH ANYTHING ELSE
for %%f in (%2*.*) do del %%f
FOR FILES IN V:\CACHE\*.* DO DELETE V:\CACHE\*.*
[This approach makes the clumbsy "echo|y del *.*>NUL" unnecessary]
for %%f in (%2headers\*.*) do del %%f
FOR FILES IN V:\CACHE\HEADERS\*.* DO DELETE V:\CACHE\HEADERS\*.*
for %%f in (%3*.*) do del %%%f
FOR FILES IN V:\TEMP\ARACHNE.TMP\*.* DO DELETE V:\TEMP\ARACHNE.TMP\*.*
[Note: The %%%f on the end may be a typo; I couldn't find any
instance where three 'definers' were used in DOS batch files;
the only time I could think of %%% being valid would be if an
environmental variable were named "%value" and that variable
was used in a batch file like this: if exist %%%value%% ...]
if exist bat.tmp copy bat.tmp %3$roura$.BAT>NUL
IF [main arachne directory] BAT.TMP EXISTS, COPY BAT.TMP
V:\TEMP\ARACHNE.TMP\$ROURA%.BAT AND REDIRECT SCREEN WRITE
if exist bat.tmp del bat.tmp
IF [main arachne directory] BAT.TMP EXISTS DELETE IT
[return control to calling program]
And that is what CLR.BAT does.
Any parameters fed into it would have to make sense for the batch
program to use [or misuse] them.
Let's suppose that this line
file/clearcache.dgi |call $esystem\\dgi\\clr.bat $c $a $t
was modified to this:
file/clearcache.dgi |call $esystem\\dgi\\clr.bat $c $a $t\n
Only two results should be possible --
a. Arachne accepts \n to mean CR/ENTER and the call to CLR.BAT is
made with the three variables as stored in program records OR
b. Arachne calls CLR.BAT and passes variables as
#1 $c full name of Cache index CACHE.IDX
#2 $a path to cache V:\CACHE\
#3 $t\n nonexistant path V:\TEMP\ARACHNE.TMP\\N
In the first case, everything should work as it is supposed to.
In the second case, file CACHE.IDX should be deleted, and the cache &
headers directories should be cleared of all files. Files in
Arachne.Tmp should be left alone [including the copying back & forth
of $roura$.bat file].
If that line in MIME.CFG were modified as follows ...
file/clearcache.dgi
|call $esystem\\dgi\\clr.bat $c $a $t\n20992 Load_images Ins
... once again only two results should be possible:
First the \n is seen as "ENTER" and nothing past that point gets
passed to CLR.BAT
OR
#3 variable is passed as "V:\TEMP\ARACHNE.TMP\\N" [invalid]
[or "V:\TEMP\ARACHNE.TMP\\N20992"]
#4 variable is passed as "20992"
[or "Load_images"]
#5 variable is passed as "Load_images"
[or "Ins"]
#6 variable is passed as "Ins"
[or no #6 variable is passed]
Since the batch file only uses the first three variables, and since
the number of variables passed would not exceed nine [9] total and
thus would not change the values of any variables, the batch program
*SHOULD* run with just the #1 and #2 variables.
That leaves only one last way for all the files to have been deleted
from the main arachne directory:
1. The batch file is passed with 3 correct variables,
2. the \n is seen as [ENTER] and start of second command
3. batch file runs and then returns to allow Arachne to complete
the second command which would be seen as "20992 Load_images Ins"
4. Something in Arachne then reads the keycode of "20992" as a
destructive "delete everything you can find in main Arachne
directory"
OR
ignores 20992 and reads "Load_images" as a destructive "delete
everything you can find in main Arachne directory"
OR
ignores 20992 and Load_images and reads "Ins" as a destructive
"delete everything you can find in main Arachne directory"
OR
recognizes some combination of those three variables as being a
destructive "delete everything you can find in main Arachne
directory."
In your message you stated:
> This syntax is *only* legal in this file. You can not use 20992, Ins,
> Load_images or anything else in mime.cfg and hope that it will have the
> desired efect. You *will* have undesired side-effects. I admit the one you
> had is strange (and that was why I asked about any ins.bat file) but no
> matter how rude I am the fault is still yours.
What you mean by "this file" is unclear; I am having to assume you
mean TOOLBAR.TB ...
However, as I detailed above very carefully, there should be NO
undesired side-effects from running CLR.BAT, other than the
possibility of not clearing the ARACHNE.TMP directory of files.
Therefore, it appears that the problem must be within the program
initially passing the variables to the DGI, and then running the
balance of the variables as some sort of flag for its own actions.
Although I was, in actuality, running INSIGHT.EXE at the time I
selected F-8 for 'clear cache' ... it is my understanding that
control would have passed back to CORE.EXE before the DGI was run.
Arachne only accepts a limited number of switches
-- Arachne.bat handles the switches "-u" and "-r" as input variables;
it used to also accept -c, but that choice is no longer in Arachne.bat,
but may be passed to CORE.EXE as a variable. In addition, the variables
must be lowercase, must have no space between the dash and the letter
and the dash must be used.
-- CORE.EXE supposedly accepts first variable switch [%1 passed from
Arachne.bat?] or -s [hardwired into arachne.bat code], and the batch
program indicates the CORE.EXE will accept a second variable as a
switch, but I can't find where that variable would originate from.
[Point of fact: If %1 = -u, core.exe is never accessed; instead
control leaves arachne.bat and termin.com hangs up the phone. Only
the %1 variable with value -r is passed to core.exe
So I am still at a loss to understand what could have possibly caused
anything within the Arachne package to delete every single file in the
main Arachne directory.
l.d.