Uh, please don't use BCC to send to the list, it makes replying a tad
impossible.

On Thu, 17 May 2001, Jamie Norwood wrote:

> On Thu, May 17, 2001 at 07:43:27AM -0500, Stephen Montgomery-Smith wrote:
> > 
> > That seems a little dangerous - perhaps some of the files will have
> > md5 appearing in other lines for other reasons, and that would mess
> > up this simple grep.  Perhaps a more complicated tag in the file would
> > be more appropriate.
> 
> Not to mention that, AFAIK, once you add the checksum to the file, the 
> checksum would be different because the file is no longer the same, ne?
> I am not aware of a way to include a checksum in the file being checked.

There was a method in the message you quoted:

-----
# Some config file
# $FreeBSD: blah$
# $MD5-Checksum: abcdefg8273912$
# Foo

a=1
b=2
-----

# (this is a Perl regexp, but it's possible with grep, somehow, I'm sure.
CHECKSUM=`grep -v \$MD5-Checksum(: [0-9a-fA-F]*)?\$$ | md5`

and it's easy enough to use sed to replace $MD5-Checksum$ lines with
CHECKSUM, and also compare the two...

CVS could even be setup to automagically insert the checksum, as it does
with the $FreeBSD$ lines currently.. (Doing so whilst observing the various
weird -ki flags to disable $$ expansions would be more difficult, however).

-- 
David Taylor
[EMAIL PROTECTED]

PGP signature

Reply via email to