Re: Easy DCL question PURGE vs. DELETE
- From: AEF <spamsink2001@xxxxxxxxx>
- Date: Sat, 04 Aug 2007 06:50:22 -0700
On Aug 3, 5:49 pm, Doug Phillips <dphil...@xxxxxxxxxxxx> wrote:
On Aug 3, 3:46 pm, AEF <spamsink2...@xxxxxxxxx> wrote:
On Aug 3, 3:58 pm, Doug Phillips <dphil...@xxxxxxxxxxxx> wrote:
On Aug 3, 2:18 pm, AEF <spamsink2...@xxxxxxxxx> wrote:
On Aug 3, 3:02 pm, Doug Phillips <dphil...@xxxxxxxxxxxx> wrote:
On Aug 3, 12:34 pm, AEF <spamsink2...@xxxxxxxxx> wrote:
(My PURG and DEL symbols include /LOG, of course.)
There was a discussion about PURGE's inconsistencies in ITRC not too
long ago.
<http://forums1.itrc.hp.com/service/forums/questionanswer.do?
threadId=1093051>
Don't know if they've been addressed yet or not.
I'll have to read that thread more carefully later. The fonts are not
very readable for the DCL output.
No comprende. You seem to be using:
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
and the page is:
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
It looks fine in my Firefox, even when I use IE Tab to switch the view
to Internet Exposer. How are is the font displaying for you?
I don't think there's a bug. It's always worked as I have described.
It's always (afaik) worked wrong (imo & that of a few notable others.)
It "displays" correctly, but it's a hard-to-read font. All the DCL
output has almost zero whitespace. I really prefer fixed-width font
for DCL output. Proportional makes my head spin.
How is it a bug?
$ DIR/WID=FILE=15/NOSIZE
Directory SYS$SYSDEVICE:[TEST]
BLAH.TMP;9 3-AUG-2007 16:37:08.15
BLAH.TMP;8 3-AUG-2007 16:37:07.53
BLAH.TMP;7 3-AUG-2007 16:37:06.78
BLAH.TMP;6 3-AUG-2007 16:37:06.07
BLAH.TMP;5 3-AUG-2007 16:37:05.33
BLAH.TMP;4 3-AUG-2007 16:37:04.50
BLAH.TMP;3 3-AUG-2007 16:37:03.68
BLAH.TMP;2 3-AUG-2007 16:37:02.80
BLAH.TMP;1 3-AUG-2007 16:37:01.68
Total of 9 files.
$
What would you expect for
A $ PURGE BLAH.TMP /BEFORE=16:37:06
B $ PURGE BLAH.TMP /BEFORE=16:37:06 /KEEP=1
C $ PURGE BLAH.TMP /BEFORE=16:37:06 /KEEP=2
D $ PURGE BLAH.TMP /BEFORE=16:37:06 /KEEP=3
For each of those, I would expect that if I did
$ DIR/BEFORE=16:37:06
I would see the same files that PURGE would select for consideration;
BLAH.TMP;5 3-AUG-2007 16:37:05.33
BLAH.TMP;4 3-AUG-2007 16:37:04.50
BLAH.TMP;3 3-AUG-2007 16:37:03.68
BLAH.TMP;2 3-AUG-2007 16:37:02.80
BLAH.TMP;1 3-AUG-2007 16:37:01.68
For your example A & B, I would expect to end up with:
BLAH.TMP;9 3-AUG-2007 16:37:08.15
BLAH.TMP;8 3-AUG-2007 16:37:07.53
BLAH.TMP;7 3-AUG-2007 16:37:06.78
BLAH.TMP;6 3-AUG-2007 16:37:06.07
BLAH.TMP;5 3-AUG-2007 16:37:05.33
Hmmm. Since ;5 is before the time given to /BEFORE, and since it is
not the highest version, I'd expect it to be deleted. Why would you
expect ;5 to remain?
Already we're in disagreement. OK.
Definition: A file is an "old version" if it is not the current (or
highest-numbered) version. In my example versions 1 through 8 would be
all the "old versions" with 9 being the current version. I'm just
trying to be sufficiently precise here.
There are various ways to mix /KEEP and /BEFORE. One could apply /
KEEP=n first, mark those n files as keepers, and then delete any
others that are timestamped before the specified time t0. That's one
way to do it -- method 1. OK. Method 2: The way you appear to favor is
that we look at the files that are timestamped as being before time
t0, and apply /KEEP=n solely within those. The third way is what VMS
does -- method 3.
There is the following disadvantage with your way: Suppose I want to
delete all _old versions_ older than t0. How would I do it with your
method? You'd have to specify PURGE/BEFORE=t0/KEEP=0. Now just what
would /KEEP=0 mean without a time-based qualifier? Explicitly, what
would PURGE/KEEP=0 mean? You'd have to special-case it and give a fun
error message such as "0 invalid for /KEEP without /BEFORE". So you
either lose the ability to do this or you have to special-case it and
display an "interesting" error message. Also, your way amounts to two
different definitions of "/KEEP=n": One meaning applying to all
versions and the other applying only to _old versions_. And I would
find it somewhat disconcerting to see /KEEP=0 in a command that by its
very raison d'etre is supposed to always keep at least one version!
The VMS way is the following: PURGE/BEFORE=t0 means to delete all _old
versions_ that are before t0. Isn't that the most straightforward
interpretation of that? Since /KEEP=1 is the default, the command
PURGE/BEFORE=t0 is then equivalent to the command PURGE/BEFORE=t0/
KEEP=1. That makes sense, right? Then higher values for /KEEP simply
keep that many more versions. No inconsistent definitions of /KEEP=n,
no special-casing /KEEP=0, no disconcerting variations such as PURGE/
KEEP=0, and you can easily delete all _old versions_ older than t0
without even having to _know_ about /KEEP.
Another way to look at it: The current version is always exempt from
deletion by the PURGE command. Right? So it can delete only _old
versions_. Since /KEEP=1 is the default, this means that PURGE and
PURGE/KEEP=1 are equivalent. Now we can add /BEFORE=t0 to qualify
which of the _old versions_ we wish to delete and /KEEP=1 is already
busy saving the current version, so if t0 is recent enough, all the
_old versions_ will be deleted. That makes sense, right? Now, what to
do with /KEEP=n? Well, keep n-1 more versions than we would with /
KEEP=1.
Yet another way to look at it: /KEEP=n means to keep the n-1 most
current versions from the set of files that would be deleted
otherwise. There: Very simple and concise!
OK, you may not like it. But that is the algorithm VMS uses and it has
its own logic and some advantages (as I described above).
For C, I would expect to still have those, plus BLAH.TMP;4
For D, I would expect to also still have BLAH.TMP;3
I would expect that files ;8 and ;7 would be ignored because they are
"AFTER" the date qualification.
That's what the documentation says, and that's what help says, but
that's not how it works.
I comment on the documentation below.
Since the default is /KEEP=1, I'd expect B to be the same as A
For C, since 2 is one more than 1, I'd expect PURGE to keep one more
file. This is in fact what happens:
$ PURGE/LOG BLAH.TMP /BEFORE=16:37:06 /KEEP=3
%PURGE-I-FILPURG, SYS$SYSDEVICE:[TEST]BLAH.TMP;3 deleted (0 blocks)
%PURGE-I-FILPURG, SYS$SYSDEVICE:[TEST]BLAH.TMP;2 deleted (0 blocks)
%PURGE-I-FILPURG, SYS$SYSDEVICE:[TEST]BLAH.TMP;1 deleted (0 blocks)
%PURGE-I-TOTAL, 3 files deleted (0 blocks)
It should *not* have deleted BLAH.TMP;3 You told it to keep 3 files
dated before 16:37:06 but it only kept 2.
Actually, it kept 6. There were 9 files originally, and 3 were
deleted. So that leaves 6.
$ PURGE/LOG BLAH.TMP /BEFORE=16:37:06 /KEEP=2
%PURGE-I-FILPURG, SYS$SYSDEVICE:[TEST]BLAH.TMP;4 deleted (0 blocks)
$ PURGE/LOG BLAH.TMP /BEFORE=16:37:06 /KEEP=1
%PURGE-I-FILPURG, SYS$SYSDEVICE:[TEST]BLAH.TMP;5 deleted (0 blocks)
$ PURGE/LOG BLAH.TMP /BEFORE=16:37:06
%PURGE-I-NOFILPURG, no files purged
$
How is this a bug?
It didn't keep the number of files you asked it to. How is this *not*
a bug?
Actually, it kept more. See above.
It's also consistent with the VMS philosophy of erring on the side of
It does not work according to it's documentation, nor is it consistent
with any other command's /before /since usage.
OK. Let's look at the documentation:
/KEEP=number-of-versions
Specifies the maximum number of versions of the specified files to be
retained in the directory. If you do not include the /KEEP qualifier,
all but the highest numbered version of the specified files are
deleted from the directory.
What the hell is this supposed to mean? It doesn't make any sense! It
is ambiguous at best. Suppose I told you to bring me a maximum of 3
apples. You could bring any number from 0 to 3 and you've done as I've
asked. So the documentation is messed up. Also, if you have 9 versions
of a file, and you specify something like PURGE/KEEP=3/BEFORE=20-
NOV-1858, PURGE is going to keep all 9 versions, right? Now nine is
more than three, right? And if 3 is the maximum number of versions to
keep, it kept more than three, right? Thus a contradiction even with
your method! It is the doc's description of /KEEP that is definitely a
"bug".
Please notice that missing file-spec fields are not consistent in
their behavior from one command to another. In some commands a
particular missing field is a wildcard; in others, not. Sticky
defaults are also inconsistent from one command to another. So you
should be upset about these, too.
More from the doc:
Description
The PURGE command deletes earlier versions of files. The PURGE
command never deletes all versions of any file. By default, the PURGE
command keeps only the highest version of a file. If you do not
include a file specification with the PURGE command, all files in the
current directory are affected by the purge.
[Even this lacks the required precision. Earlier versions of a file? I
could have the highest-numbered version older than the lower versions,
right? So earlier has to be interpreted as "not current".]
/BEFORE[=time]
Selects only those files dated prior to the specified time. You can
specify time as absolute time, as a combination of absolute and delta
times, or as one of the following keywords: BOOT, LOGIN, TODAY
(default), TOMORROW, or YESTERDAY. Specify one of the following
qualifiers with the /BEFORE qualifier to indicate the time attribute
to be used as the basis for selection: /BACKUP, /CREATED (default), /
EXPIRED, or /MODIFIED.
OK, so if I do PURGE/BEFORE=t0, then I'd expect all files dated before
t0 to be deleted, except that the highest version is never deleted.
Where from this does it say that the highest version of the versions
dated before t0 will be kept? This is why I don't understand why you
think BLAH.TMP;5 should be kept in case A. Method 3 is a natural
generalization of this, or at least one possible generalization.
As I quoted in the ITRC thread;
Help /keep says: "Specifies the maximum number of versions of the
__specified_ _files__ to be retained in the directory."
(_emphasis mine)
This is ambiguous at best. It is not specific enough to determine what
to do. It needs to be rewritten from scratch. Even "specified files"
is ambiguous. You can have 'file' meaning as it would in saying there
are many versions of a 'file' (note, file is singular here) or you
could have it mean that each version of the 'file' is a 'file'. I
favor the former because the PURGE command deletes old versions of a
file. It doesn't delete old versions of old versions. You specify the
files to be purged in the parameter. Note that you can't include a
version number in the parameter. [I'd continue here but this is
degenerating into semantics hell.]
Actually, upon rereading the /KEEP description I think the former
makes more sense. You can't have more than one version of a version!
Each version is its own version! So if you insist on it meaning the
latter, you get "Specifies the maximum number of versions of the
specified versions to be retained in the directory". Well, I suppose
you can draw the following parallel: Specifies the maximum number of
apples of the specified apples to be retained in the basket. Yeah, I
suppose it makes sense that way, too. But my main point is that it is
ambiguous.
Help /before says:
"Selects only those files dated prior to the specified time."
And so it does. Can you show me an example where PURGE/BEFORE=t0
deletes files that are dated before t0? And wouldn't this mean to
delete BLAH.TMP;5 in case A (as long as it is not the highest version
number, of course)?
Note also that the /BEFORE qualifier doesn't specify, it selects! (If
you're going to point out specifies and selects, than I can say this.)
Note that you PURGE a file meaning a name.typ !. You DELETE a version,
meaning a name.typ;n.
The /before does not modify the /keep, it qualifies the files being
selected; i.e. it defines the _specified_files_.
That's one possible interpretation, but not the only one. VMS
interprets /KEEP=n as to keep the most current n-1 more files that
wouldn't have been deleted otherwise. Suppose you do /KEEP=n/BEFORE=t0
instead of /BEFORE=t0/KEEP=n? In this case, /KEEP comes before /
BEFORE. My point here is that I don't see why you insist that one
possible order is the only or "right" way. Of course the order of the
qualifiers here doesn't matter to VMS, which only further supports my
point.
not deleting data. The proposed alternatives would often delete more
files. For someone used to the current algorithm, that would be a
surprise!
Oops. I was wrong here. ... Never mind.
The surprise is that this command is broken and has been for so long.
It depends on which algorithm you prefer. If you were writing the
code, would you add /KEEP=0 and how would you special-case it for
when /BEFORE is not specified? When you actually write the code it can
give you more insight into the problem because it forces you to fully
think through the problem. So I usually start, at least, by assuming
the code is correct, unless there's some blatant flaw. (OK, you may
think this is an obvious flaw, so it's subjective. But if I run
DIRECTORY and it deletes files -- that's what I'm talking about for a
blatant flaw.)
You can gripe about _something_ with all 3 methods. But with method 3
(VMS), you can easily do a particular task that you cannot do with
method 2 (yours). And you can simply add 1 to the number you give to /
KEEP to do what you want. So the VMS method is the most versatile and
doesn't require knowing about /KEEP to use /BEFORE.
So, in summary, the VMS developers chose PURG/BEFORE=t0 to delete all
_old versions_ of file whose time stamp is before t0. Then they
decided that /KEEP=1 is the default /KEEP behavior, and that /KEEP=n
would keep n-1 more files than that, always choosing the highest-
version numbers to keep.
Note that if the files are not always in descending chronological
order! If they are in reverse order, this entire discussion applies
to /SINCE instead of /BEFORE. If they are in mixed order, then PURGE/
BEFORE or PURGE/SINCE will delete all _old versions_ meeting its spec
and adding /KEEP=n to that will cause it to keep n-1 more highest
versions.
This has been discussed in ITRC and I don't know why your browser is
displaying the fonts wrong.
Well, I think the correct text is displayed. But there isn't enough
whitespace in the DCL output examples and none of it is in fixed-width
fonts. I mean I can read it, but it is a struggle compared to what it
should be. It's a little like trying to read SHUTDOWN.COM,
AUTOGEN.COM, or VMSINSTAL.COM. It's as if it had been run through
DCL_DIET, but not quite as bad. Everything is there correctly, but
it's much harder to read than it should be. Moreover, computer output
should be in fixed-width fonts, period.
And NO, I am not going to go through fix-the-font hell in either IE or
Firefox. Both suck in this respect, at least when I tried a few years
ago, mostly to fix how Google Groups displayed posts and to improve
the appearance of www.wundergound.com on Firefox. And Firefox was
worse! It's still bizarre. Look at it! What a mess! Trying to fix
fonts in a either of these browsers is a super PITA!!!
NO! I won't do it. I'm passing on fix-the-font hell. You're welcome to
stop by and fix it for me, however. :-)
AEF
.
- Follow-Ups:
- Re: Easy DCL question PURGE vs. DELETE
- From: Doug Phillips
- Re: Easy DCL question PURGE vs. DELETE
- References:
- Easy DCL question PURGE vs. DELETE
- From: norm . raphael
- Re: Easy DCL question PURGE vs. DELETE
- From: JF Mezei
- Re: Easy DCL question PURGE vs. DELETE
- From: briggs
- Re: Easy DCL question PURGE vs. DELETE
- From: AEF
- Re: Easy DCL question PURGE vs. DELETE
- From: Doug Phillips
- Re: Easy DCL question PURGE vs. DELETE
- From: AEF
- Re: Easy DCL question PURGE vs. DELETE
- From: Doug Phillips
- Re: Easy DCL question PURGE vs. DELETE
- From: AEF
- Re: Easy DCL question PURGE vs. DELETE
- From: Doug Phillips
- Easy DCL question PURGE vs. DELETE
- Prev by Date: Re: Duplicate posts (was: Is VMSONE.COM off the air permanently?)
- Next by Date: Re: Duplicate posts
- Previous by thread: Re: Easy DCL question PURGE vs. DELETE
- Next by thread: Re: Easy DCL question PURGE vs. DELETE
- Index(es):
Relevant Pages
|