From owner-freebsd-questions@FreeBSD.ORG Thu Sep 13 05:52:24 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 46121106564A for ; Thu, 13 Sep 2012 05:52:24 +0000 (UTC) (envelope-from gobble.wa@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id B95348FC0C for ; Thu, 13 Sep 2012 05:52:23 +0000 (UTC) Received: by weyx56 with SMTP id x56so1716816wey.13 for ; Wed, 12 Sep 2012 22:52:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7ZppNb57U/EtP+JkBq0y+06RulgsxvkK441poy/cEGI=; b=LQc+pNJ+DRwJxZld3enQVG0xZIGn3rYQUgr+8hPW2WWFl65cx32GBBTM+uZ1Omgi/6 VEDQFbeojNI6rcKTbWYO9GADcejHCb+K9OJ9I/IFvlK/ahv3DYESopYJkgJ0iDMq7ysJ 4SDQk+GRGTibMqQTb0/UKaoyxLhFUOeNW3DJI3lmRlS7yoVc/wxHBF4D/T/ygHqJdjB+ iEiXTx9+Fl6JkJhAUjMsWcTShEzGGKkXsMVrYzt2iTn9FYxxGhT0M3IUtA3nwv5ZqLRh 7HXI5Vodgi6pDxrVh56ZQAOtqdYe4IP+nFfOsSwCPxXF+pmclNGYZncf68DF0dSLWduI h5PQ== MIME-Version: 1.0 Received: by 10.216.241.198 with SMTP id g48mr569026wer.153.1347515542415; Wed, 12 Sep 2012 22:52:22 -0700 (PDT) Received: by 10.216.183.2 with HTTP; Wed, 12 Sep 2012 22:52:22 -0700 (PDT) In-Reply-To: <20120913030846.GA20812@ethic.thought.org> References: <20120911213804.GA9817@ethic.thought.org> <20120912011443.5df17cf2.freebsd@edvax.de> <50502C51.5020601@FreeBSD.org> <20120912174625.GA17551@ethic.thought.org> <20120912143116.1f8f8309@europa> <20120912222228.GD19460@ethic.thought.org> <20120913003235.GA19837@ethic.thought.org> <20120913030846.GA20812@ethic.thought.org> Date: Wed, 12 Sep 2012 22:52:22 -0700 Message-ID: From: Waitman Gobble To: Gary Kline Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-questions@freebsd.org Subject: Re: cksum entire dir?? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Sep 2012 05:52:24 -0000 On Wed, Sep 12, 2012 at 8:08 PM, Gary Kline wrote: > On Wed, Sep 12, 2012 at 05:42:43PM -0700, Waitman Gobble wrote: > > On Wed, Sep 12, 2012 at 5:32 PM, Gary Kline wrote: > > > > > On Wed, Sep 12, 2012 at 03:58:00PM -0700, Waitman Gobble wrote: > > > > On Wed, Sep 12, 2012 at 3:22 PM, Gary Kline > wrote: > > > > > > > > > On Wed, Sep 12, 2012 at 02:31:16PM -0400, Mike Jeays wrote: > > > > > > On Wed, 12 Sep 2012 10:55:57 -0700 > > > > > > Waitman Gobble wrote: > > > > > > > > > > > > > On Wed, Sep 12, 2012 at 10:46 AM, Gary Kline < > kline@thought.org> > > > > > wrote: > > > > > > > > > > > > [[ ...]] > > > > > > > > > > > > My Linux system has both md5sum and md5deep. They give the same > > > result, > > > > > except that md5sum quotes the file name in the current directory, > and > > > > > md5deep gives the fully-qualified name. I have been using md5deep > - I > > > > > didn't know md5sum existed. > > > > > > > > > > I did a yum install md5* and got deep! :_) > > > > > > > > > > t.y > > > > > > > > > > > _______________________________________________ > > > > > > freebsd-questions@freebsd.org mailing list > > > > > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > > > > > > To unsubscribe, send any mail to " > > > > > freebsd-questions-unsubscribe@freebsd.org" > > > > > _______________________________________________ > > > > > freebsd-questions@freebsd.org mailing list > > > > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > > > > > To unsubscribe, send any mail to " > > > > > freebsd-questions-unsubscribe@freebsd.org" > > > > > > > > > > > > > > > > > > > > > also "maybe???" of interest.. it's pretty quick & easy to hack the > 'find' > > > > function in /usr/src/usr.bin/find/ with md5 capability.. > > > > not sure if it's helpful.. > > > > > > > > > > > > copy /usr/src/usr.bin/find/ somewhere, then edit function.c, > > > > > > > > #include > > > > > > > > int > > > > f_print(PLAN *plan __unused, FTSENT *entry) > > > > { > > > > char * md5sum[32]; > > > > (void)printf("%s ",MD5File(entry->fts_accpath,md5sum)); > > > > (void)puts(entry->fts_path); > > > > return 1; > > > > } > > > > > > > > > > > > and edit Makefile (change exec name, > > > > > > > > PROG= md5find > > > > LDADD+= -lmd > > > > > > > > then "make".. > > > > > > > > run it: > > > > > > > > ./md5find . > > > > 224df9d178aa35cb532664ea37875791 . > > > > bfe464b3ac942e85d8b818a9441e2286 ./find.o > > > > 0fc28847bb344166ff0f7f4c12d6e4ed ./Makefile > > > > beb4c49ba914f62da0b57b16778c1772 ./extern.h > > > > 8895f62adaa15b194dec6f15e4c5956b ./find.1 > > > > 8d3986a5e8747ae89b3c5f82f22bc402 ./find.c > > > > 99fade54bb9baf0d3b4d8822d53800b3 ./find.h > > > > 23f43527a2bdc3abf1e8eaa1aca68f26 ./function.c > > > > 1d25eb09d42261b28cc783a6b48e39ac ./getdate.y > > > > fce6f5ec314eaea09170b79a0711d07e ./ls.c > > > > 75d64926376a5440b7e23b295417a6cc ./main.c > > > > 2599f1f22d557b076ff1cde9b17cff55 ./misc.c > > > > 2c4e3bb00a37b839d9ac0dc0e12a88bc ./operator.c > > > > 3157efe1ed3821e96fec71f1ca4b2306 ./option.c > > > > 7ea8adb4cb549b118b903238f43afd37 ./function.o > > > > 12f6a75a82f817e1306c323fdddbff59 ./ls.o > > > > e97d015d2e5fbeb3fdff4fa22b76f0e2 ./main.o > > > > 2a5100f2c5ed4c9408ab51d6e2a848cc ./misc.o > > > > 6360e963e0f285fe3dc170309a2ae219 ./operator.o > > > > 68c47f622cb1d4d8f58ff7b2ef2c8312 ./option.o > > > > 47a8978565c6cb8b0280c231679847ba ./getdate.c > > > > 7eb3a4e4984e4696347501eeba2e0566 ./getdate.o > > > > e406e4422cf29f3b42484596524b71c1 ./find > > > > e3ea95347aa5efd7030103536c23a8d3 ./find.1.gz > > > > 4b1fd4eb69577f53bd97d8cd2159c8eb ./md5find > > > > 03d161fcb84fb38aad6ccd8ce0cafeaf ./testdir > > > > 8d3986a5e8747ae89b3c5f82f22bc402 ./testdir/find.c > > > > > > > > > > > > ....etc > > > > > > > > Waitman Gobble > > > > San Jose California > > > > _______________________________________________ > > > > freebsd-questions@freebsd.org mailing list > > > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > > > > To unsubscribe, send any mail to " > > > freebsd-questions-unsubscribe@freebsd.org" > > > o > > > where, Sir, is the header?! > > > > > > which header? > > > > this example I just copied /usr/src/usr.bin/find/ (entire directory > > contents) to my home directory then "added". > > > > #include to the top of function.c (with the other includes, order > > /may/ matter.. i did after the sys/ includes but before the others) > > > > md5.h is in /usr/include, it's basically a wrapper around > > /usr/include/sys/md5.h > > > sounds reasonable. if you have this compiler on fedsora, I'd like > to > see it for myself. I think I have gcc* installed. > > so, whenever you have time... . > > I'm not sure it's a good use of time (?) considering, as someone mentioned previously, mtree is already working. In the case of doing the find/md5 tinkering project on Fedora or other GNU/Linux distributions, it would likely IMHO be best to use non-BSD, ie Liinux 'find' and 'md5' sources. I do think mtree (already mentioned) is the best way to go.... You dump the checksum, etc into a file and use the file to verify the other path. example: $ mtree -K sha256digest,uname,gname -c -p . > structure.mtree $ cat structure.mtree # user: waitman # machine: hunny.waitman.net # tree: /usr/home/waitman/find/find # date: Wed Sep 12 22:44:38 2012 # . /set type=file uname=root uid=0 gname=wheel gid=0 mode=0644 nlink=1 flags=none . type=dir mode=0755 nlink=3 size=512 \ time=1347515078.000000000 Makefile size=246 time=1347489991.000000000 \ sha256digest=76ad379ec19abe85a2b0b102a97a629cee4a7002526243893785d4d7223e6cd4 extern.h size=3432 time=1344701404.000000000 \ sha256digest=ef2c12d8a8d9c6e1be8bfc368d4b3c359820d98e31710471469303f17fda0d29 find mode=0755 size=61285 time=1347489971.000000000 \ sha256digest=f9a0e343bdca72839d025fe364c008cc77c0f3ef195bcc748327e623fd4b1211 Verify / Compare # mtree -p . < structure.mtree . changed modification time expected Wed Sep 12 22:44:38 2012 found Wed Sep 12 22:44:57 2012 structure.mtree changed size expected 0 found 3023 SHA-256 expected e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 found ad52a8d8c35dbdfd75bed88a6590bf75fadf55113f5288fa0acca9e11c8bdba1 ./structure.txt missing Was there a reason not to use mtree? Waitman Gobble San Jose California > > > > > > then changed the function int f_print, added two lines > > char * md5sum[32]; > > (void)printf("%s ",MD5File(entry->fts_accpath,md5sum)); > > > > then changed the two lines in Makefile, PROGNAME so i don't end up with > > 'find' executable and the other is -lmd so i get the library with md5 > > routines. > > > > I think maybe I wasn't clear that i was editing function.c, and that > there > > is more to function.c than my example code. > > > > I can put the source on git if you want, but it's pretty basic. Also i'd > > have to research the second parameter in MD5File function, i don't > actually > > think that's what i thought it was. it is returning the correct hash, and > > printing it out, as returned from the function. > > > > Waitman Gobble > > San Jose California > > _______________________________________________ > > freebsd-questions@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" >