Hi.

[ OpenBSD/i386-current as of a couple of days ago ]
Is there a good reason why "md5 -c" should say "FAILED" when the digest in
the checklist file and the digest calculated by md5 differ only in letter
case?  I can't think of any.

e.g.:
------------------------------------------------------------------------------

% ls -l Tortoise*
-rw-r--r--  1 clamat  clamat       78 Nov  9 16:43 
TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.md5
-rw-r--r--  1 clamat  clamat  9134080 Nov  9 16:26 
TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi
% cat TortoiseSVN*.md5
916C103C14664B784A54692CF5E00CA2  TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi
% md5 -c TortoiseSVN*.msi
MD5 (TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi) = 
916c103c14664b784a54692cf5e00ca2
% md5 -c TortoiseSVN*.md5
(MD5) TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi: FAILED

------------------------------------------------------------------------------

If not, here's a trivial patch:

Index: bin/md5/md5.c
===================================================================
RCS file: /cvs/src/bin/md5/md5.c,v
retrieving revision 1.35
diff -u -r1.35 md5.c
--- bin/md5/md5.c       15 Mar 2006 03:15:07 -0000      1.35
+++ bin/md5/md5.c       10 Nov 2006 00:42:43 -0000
@@ -486,7 +486,7 @@
                close(fd);
                (void)hf->end(&context, digest);
 
-               if (strcmp(checksum, digest) == 0)
+               if (strcasecmp(checksum, digest) == 0)
                        (void)printf("(%s) %s: OK\n", algorithm, filename);
                else {
                        (void)printf("(%s) %s: FAILED\n", algorithm, filename);

Matt.
-- 
"With your own code to haunt you, who needs users?"
                                -- Maarten Wiltink

Reply via email to