Re: cksum entire dir??

2012-10-04 Thread Mike Jeays
On Fri, 05 Oct 2012 05:36:19 +0400
Австин Ким  wrote:

> Hi, all,
> 
> > Paul Kraus  writes:
> >
> > > On Tue, Sep 11, 2012 at 9:18 PM,   wrote:
> > >
> > >> It's a real shame Unix doesn't have a really good tool for comparing
> > >> two directory trees. You can use 'diff -r' (even on binaries), but that
> > >> fails if you have devices, named pipes, or named sockets in the
> > >> filesystem. And diff or cksum don't tell you if symlinks are different.
> > >> Plus you may care about file ownership, and that's where the stat
> > >> command comes in handy.
> > >
> > > Solaris and a least a few versions of Linux have a "dircmp" command
> > > that is in reality a wrapper for diff that handles special files. The
> > > problem with it is that it tends to be slow (I had to validate
> > > millions of files).
> >
> > It's not clear what the danger profile is supposed to be here; dircmp
> > (and recursing 'diff' applications) can handle many cases, but mtree(8)
> > (with appropriate options) covers more pathological problems. Even so,
> > analysis of changes in file nodes like named sockets will usually
> > require some understanding of the application.
> >
> > I suspect that either a recursive diff or an mtree specification is a
> > good solution for the original poster's problem, but we don't have
> > enough information to be more sure than that.
> >
> > Be well.
> >Lowell
> 
> I happened to be restoring my home directory on my local machine and needed a 
> way to verify that its contents were in sync with the corresponding 
> directories on a remote server.  I first tried looking for an option for 
> _rsync_ that would check synchronization without actually forcibly 
> synchronizing one side to the other unidirectionally, but couldn't find 
> precisely what I was looking for.  I happened to come upon this thread, which 
> was a coincidence that this same issue recently came up again.
> 
> Obviously there must be more rigorous, secure, and industrial-strength ways 
> to check synchronization between corresponding directories on remote systems 
> (apart from doing a one-way sync with _rsync_), but here's my two bits, a 
> quick crack at a shell function to check recursively that the contents of two 
> directories (and the filenames contained therein) have a high probability of 
> being in sync:
> 
> BEGIN CUT
> 
> # s:  Function to compute recursive MD5 sum.
> s ( ) {
>   if [ -d "$1" ]
>  then DIR=$1
>  else DIR=.
>   fi
>   if [ `uname` = Linux ]
>  then find "$DIR" -type f -or -type l |sort |tr \\n \\0 |xargs -0 openssl 
> \
> dgst |sed s/.*\(\\\(.*\\\)\).*\ \\\(.*\\\)/\\2\ \\1/ |tee 
> /tmp/dgst
>   openssl dgst   else find -s "$DIR" -type f -or -type l|tr \\n \\0 |xargs -0 md5 \
>  |sed s/.*\(\\\(.*\\\)\).*\ \\\(.*\\\)/\\2\ \\1/ |tee 
> /tmp/dgst
>   md5fi
>   unset DIR
>   rm /tmp/dgst
>   return
>   }
> 
> # sq:  Function to compute recursive MD5 sum quietly.
> sq ( ) {
>   if [ -d "$1" ]
>  then DIR=$1
>  else DIR=.
>   fi
>   if [ `uname` = Linux ]
>  then find "$DIR" -type f -or -type l |sort |tr \\n \\0 |xargs -0 openssl 
> \
> dgst |sed s/.*\(\\\(.*\\\)\).*\ \\\(.*\\\)/\\2\ \\1/ >/tmp/dgst
>   openssl dgst   else find -s "$DIR" -type f -or -type l|tr \\n \\0 |xargs -0 md5 \
>  |sed s/.*\(\\\(.*\\\)\).*\ \\\(.*\\\)/\\2\ \\1/ >/tmp/dgst
>   md5fi
>   unset DIR
>   rm /tmp/dgst
>   return
>   }
> 
> END CUT
> 
> These functions simply apply the `find ... |xargs' method suggested by 
> previous posts to output a list of MD5 digests with filenames, and then just 
> _md5_ the resulting file.  I tried out the above in both sh(1) in FreeBSD (my 
> local machine) as well as in ksh(1) in Linux (the remote server), though I 
> haven't tested them extensively.  Obviously the above are not `secure,' and 
> obviously an infinite number of variations are possible (such as, for 
> example, also outputting file permissions and dates of last modification with 
> ls(1) to the digest file before running _md5_ on it, to check that 
> permissions and dates are also in sync).  Thanks to the previous posters for 
> solving my problem!  :)
> 
> All the best,
> Austin

"rsync --dry-run" may be a simple solution that would meet your needs? You 
might need to add the "--delete" option.

Take another look at man rsync.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-10-04 Thread Австин Ким
Hi, all,

> Paul Kraus  writes:
>
> > On Tue, Sep 11, 2012 at 9:18 PM,   wrote:
> >
> >> It's a real shame Unix doesn't have a really good tool for comparing
> >> two directory trees. You can use 'diff -r' (even on binaries), but that
> >> fails if you have devices, named pipes, or named sockets in the
> >> filesystem. And diff or cksum don't tell you if symlinks are different.
> >> Plus you may care about file ownership, and that's where the stat
> >> command comes in handy.
> >
> > Solaris and a least a few versions of Linux have a "dircmp" command
> > that is in reality a wrapper for diff that handles special files. The
> > problem with it is that it tends to be slow (I had to validate
> > millions of files).
>
> It's not clear what the danger profile is supposed to be here; dircmp
> (and recursing 'diff' applications) can handle many cases, but mtree(8)
> (with appropriate options) covers more pathological problems. Even so,
> analysis of changes in file nodes like named sockets will usually
> require some understanding of the application.
>
> I suspect that either a recursive diff or an mtree specification is a
> good solution for the original poster's problem, but we don't have
> enough information to be more sure than that.
>
> Be well.
>Lowell

I happened to be restoring my home directory on my local machine and needed a 
way to verify that its contents were in sync with the corresponding directories 
on a remote server.  I first tried looking for an option for _rsync_ that would 
check synchronization without actually forcibly synchronizing one side to the 
other unidirectionally, but couldn't find precisely what I was looking for.  I 
happened to come upon this thread, which was a coincidence that this same issue 
recently came up again.

Obviously there must be more rigorous, secure, and industrial-strength ways to 
check synchronization between corresponding directories on remote systems 
(apart from doing a one-way sync with _rsync_), but here's my two bits, a quick 
crack at a shell function to check recursively that the contents of two 
directories (and the filenames contained therein) have a high probability of 
being in sync:

BEGIN CUT

# s:  Function to compute recursive MD5 sum.
s ( ) {
  if [ -d "$1" ]
 then DIR=$1
 else DIR=.
  fi
  if [ `uname` = Linux ]
 then find "$DIR" -type f -or -type l |sort |tr \\n \\0 |xargs -0 openssl \
dgst |sed s/.*\(\\\(.*\\\)\).*\ \\\(.*\\\)/\\2\ \\1/ |tee /tmp/dgst
  openssl dgst /tmp/dgst
  openssl dgst /tmp/dgst
  md5 ___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Re: cksum entire dir??

2012-09-14 Thread Karl Vogel
>> On Thu, 13 Sep 2012 23:35:22 -0400, kpn...@pobox.com said:

K> But in both your and my code the uniq will frequently fail because the
K> input is not sorted.

   No, check the first command:

 me% find . -type f -print0 | xargs -0 md5 -r | sort >> /tmp/sig1


-- 
Karl Vogel  I don't speak for the USAF or my company

When I'm feeling down, I like to whistle.  It makes the neighbor's dog
run to the end of his chain and gag himself.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-14 Thread C. P. Ghost
On Thu, Sep 13, 2012 at 9:18 PM, Karl Vogel  wrote:
> Here's a simple, system-independent way to find duplicate files.  All you

There's also sysutils/samefile:

http://www.schweikhardt.net/samefile/index.html

-cpghost.

-- 
Cordula's Web. http://www.cordula.ws/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-13 Thread Waitman Gobble
On Thu, Sep 13, 2012 at 8:35 PM,  wrote:

> On Thu, Sep 13, 2012 at 03:18:43PM -0400, Karl Vogel wrote:
> > Here's a simple, system-independent way to find duplicate files.  All you
> > need is something to generate a digest you trust (MD5, SHA1, whatever)
> plus
> > normal Unix stuff: awk, expand, grep, join, sort, and uniq.
> >
> > Generate the signatures:
> >
> >   me% cd ~/bin
> >   me% find . -type f -print0 | xargs -0 md5 -r | sort > /tmp/sig1
> >
> >   me% cat /tmp/sig1
> >   0287839688bd660676582266685b05bd ./mkrcs
> >   0b97494883c76da546e3603d1b65e7b2 ./pwgen
> >   ddbed53e795724e4a6683e7b0987284c ./authlog
> >   ddbed53e795724e4a6683e7b0987284c ./cmdlog
> >   fdff1fd84d47f76dbd4954c607d66714 ./dbrun
> >   ff5e24efec5cf1e17cf32c58e9c4b317 ./tr0
> >
> > Find duplicate signatures:
> >
> >   me% awk '{print $1}' /tmp/sig1 | uniq -c | expand | grep -v "^  *1 "
> > 2 ddbed53e795724e4a6683e7b0987284c
>
> you% awk '{print $1}' /tmp/sig1 | uniq -d
>
> But in both your and my code the uniq will frequently fail because the
> input is not sorted. The uniq command only works when the lines to compare
> are adjacent. So...
>
> you% awk '{print $1}' /tmp/sig1 | sort | uniq -d
> --
> Kevin P. Nealhttp://www.pobox.com/~kpn/
>
>"I like being on The Daily Show." - Kermit the Frog, Feb 13 2001
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscr...@freebsd.org"
>

Hi,

But what happens when, like in my 'md5 file' tinkering example above,
there's one or more identical files along the path which may or may not
exist in both hierarchies? For example, the BSD License file. In my
previous message I purposely made a 'testdir' and copied a file into that
dir... they have the same hash.

Anyway I was thinking if I had proceeded with the tinker example, using
sys/tree.h and creating an associative array and using the relative path
and filename, along with the md5 hash, as the key. So the keys would be
like

[8d3986a5e8747ae89b3c5f82f22bc402 ./find.c]
[8d3986a5e8747ae89b3c5f82f22bc402 ./testdir/find.c]

then you'd have path A and path B to compare, which i think basically add 1
for A and 2 for B, so you'd know a "1" would be in "A" only, or "2" would
be in "B" only, and "3" would be in both A and B.

[e406e4422cf29f3b42484596524b71c1 ./find] => 1 //A only
[e3ea95347aa5efd7030103536c23a8d3 ./find.1.gz] => 3 //OK
[4b1fd4eb69577f53bd97d8cd2159c8eb ./md5find] => 3 //OK
[03d161fcb84fb38aad6ccd8ce0cafeaf ./testdir] => 2 //B only



But again I have to say that mtree already does this very well...

Here's an example of mtree for Gary to compare two paths, hopefully helpful.


set up two things to compare, A and B

# mkdir A B
# touch A/1 A/2 A/3 A/4
# find A
A
A/1
A/2
A/3
A/4

# rsync -av A B
sending incremental file list
A/
A/1
A/2
A/3
A/4

sent 236 bytes  received 92 bytes  656.00 bytes/sec
total size is 0  speedup is 0.00

# find B
B
B/A
B/A/1
B/A/2
B/A/3
B/A/4


compare with mtree

# mtree -K sha256digest,uname,gname -c -p A | mtree -p B/A

{no output = OK they match, default: only report situations}


now mess up B

# rm B/A/3
# touch B/A/2
# touch B/A/extrabonusfile


compare again

# mtree -K sha256digest,uname,gname -c -p A | mtree -p B/A

. changed
modification time expected Thu Sep 13 22:33:02 2012 found Thu Sep 13
22:43:46 2012
2 changed
modification time expected Thu Sep 13 22:33:02 2012 found Thu Sep 13
22:38:01 2012
extrabonusfile extra
./3 missing


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-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-13 Thread Polytropon
On Wed, 12 Sep 2012 10:46:25 -0700, Gary Kline wrote:
> On Wed, Sep 12, 2012 at 07:31:45AM +0100, Matthew Seaman wrote:
> > On 12/09/2012 00:14, Polytropon wrote:
> > >   % cksum 
> > > 
> > > and could obtain a checksum - so it _seems_ to work.
> > > After alteration of one file within the hierarchy a
> > > different result was printed.
> > 
> > That will give you a checksum on the directory inode -- file names and
> > associated metadata only, not file content.  In theory you could edit a
> > file without modifying any of the timestamps, and that wouldn't result
> > in any change to the directory checksum.  Also, modifying things a few
> > layers down the filesystem hierarchy won't have any effect either.
> > 
> > Generally I find the best test for differences between old and new
> > copies of a filesystem is 'rsync -avx -n ...'
> > 
> > Also, sum and cksum have way too small a key size for this to be
> > reliable, since you can't tell a true result from a hash collision.  Use
> > md5 or sha1 or sha256 for best results.
> > 
> 
>   So this sha256 is *real*??  I have no md5 on my "fedora"
>   that is on my desktop and m having trouble getting used to.  
>   but the gentleman who recommened cpio was right on the money.
> 
>   note that I am loathe to spam this list with the following mail from my
>   files in sept, 1988, but here it is.  if I had only gr -r -w cpio
>   around in all my directories, I would have found this, sent to one Dirm
>   Myers across the pond ::
> 
> 
>   ===
> 
> From kline Sat Sep  5 11:52:20 1998
> Subject: lost mail file...
> To: di...@buster.dhis.eu.org (Dirk Myers)
> Date: Sat, 5 Sep 1998 11:52:20 -0700 (PDT)
> Organization: <> thought.org: public access uNix in service... <>
> X-Mailer: ELM [version 2.4ME+ PL32 (25)]
> MIME-Version: 1.0
> Content-Type: text/plain; charset=US-ASCII
> Content-Transfer-Encoding: 7bit
> Content-Length: 2283
> Status: RO
> 
> 
>   Yesterday morning I began composing the next two Q's and A's
>   in my mailer.  Last night in the wee hours there was a power
>   glitch and I lost the mail.
> 
>   Enclosed is the first//next Q/A.  I'll send along another one
>   or two later today.  One that I was playing around with *failed*
>   and I'm trying to figure out why.
> 
>   -
> 
>   How can I uise my FBSD floppy drive to copy files to it (in this case,
>   at work), and retrieve the files on my FBSD systtem at home.  So far
>   I've only seen examples that used floppies with a filesystem on them.
>   Is there a simplr, more direct way?
> 
>   You can treat the 'raw' floppy device as if it is a tape drive, and
>   use typically UNIX tape tools to read/write, such as tar and  cpio.
>   For instance, to copy the current directory onto a floppy to
>   take home at night:
> 
> (put the floppy in the drive, and cd to the directory where
>  the files are; then )
> 
> % tar -cvf /dev/rfd0 .
> 
>   To read it when you get home:
> 
> (put the floppy in the drive at home; and extract the tarball
>  wherever you want the files)
> 
> % tar -xvf /dev/rfd0
> 
>   The flags -c and -x indicate create and extract mode, the ``v''
>   specifies verbose mode, and the ``f'' tells tar that the following
>   argument is the file or device that tar acts upon.  Here, it is
>   the floppy devide.
> 
> 
>   With cpio:
> 
> (chdir to the directory where the files are)
> 
> % ls | cpio -oc > /dev/rfd0
> 
>To read a cpio archive from a tape drive:
> 
>% cpio -icd < /dev/rfd0
> 
> 
>The flags -i and -o indicate copy-in or extract mode and
>copy-out or create archive mode.   The ``c'' tells cpio
>to use the old, portablr ASCII archive format.  And the
>``d'' flag tells cpio to create directories where necessary.
> 
>Do a
> 
>% man cpio
> 
>for much greater detail on this utility.
> 
>   -
> 
>   There are another one or two of the simpler Q/A's and one or two
>   more involved.
> 
>   Then, for this month only, I want to write a paragraph or two
>   about who I am and where I'm coming from.  Since you are sharing
>   the by-line you might want to consider this too.
> 
>   gary
> 
>   PS:   Next month we get a break!!
> 
> --
>Gary D. Kline kl...@tao.thought.org  Public service uNix
> 
>   
>   as you can see, this dealt with my olden tape drive.  a 250meg
>   QIC drive, I think.  

Really? I think /dev/rfd0 refers to fd - floppy disk. Even
though I know there are floppy-controller connected tape
drives (still have one myself!), the examples shown seem
to indicate work with a floppy disk, used in a "non-fs'ed"
manner, just as I did in the past with "tar, the most
universal file system that isn't even a filesystem" to
transfer files across different UNIX / BSD / Linux boxes
via floppy (because they've not been networked). Still the
examples look fully valid when applied to a tape dri

Re: cksum entire dir??

2012-09-13 Thread Karl Vogel
Here's a simple, system-independent way to find duplicate files.  All you
need is something to generate a digest you trust (MD5, SHA1, whatever) plus
normal Unix stuff: awk, expand, grep, join, sort, and uniq.

Generate the signatures:

  me% cd ~/bin
  me% find . -type f -print0 | xargs -0 md5 -r | sort > /tmp/sig1

  me% cat /tmp/sig1
  0287839688bd660676582266685b05bd ./mkrcs
  0b97494883c76da546e3603d1b65e7b2 ./pwgen
  ddbed53e795724e4a6683e7b0987284c ./authlog
  ddbed53e795724e4a6683e7b0987284c ./cmdlog
  fdff1fd84d47f76dbd4954c607d66714 ./dbrun
  ff5e24efec5cf1e17cf32c58e9c4b317 ./tr0

Find duplicate signatures:

  me% awk '{print $1}' /tmp/sig1 | uniq -c | expand | grep -v "^  *1 "
2 ddbed53e795724e4a6683e7b0987284c

  me% awk '{print $1}' /tmp/sig1 | uniq -c | expand | grep -v "^  *1 " |
  awk '{print $2}' > /tmp/sig2

Associate the duplicates with files:

  me% join /tmp/sig[12]
  ddbed53e795724e4a6683e7b0987284c ./authlog
  ddbed53e795724e4a6683e7b0987284c ./cmdlog

If your filenames contain whitespace, you can URL-encode them, play some
games with awk, or use perl.

-- 
Karl Vogel  I don't speak for the USAF or my company

This is really a lovely horse, I once rode her mother.
   --Ted Walsh, Horse Racing Commentator
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-13 Thread Gary Kline
On Thu, Sep 13, 2012 at 10:23:47AM +0200, Jonathan McKeown wrote:
> On Wednesday 12 September 2012 22:29:45 Gary Kline wrote:
> 
> > how, with mtree, could I tell  whether dir1 == dir2 or not?
> 
> From the manpage:
> 
> ``The mtree utility compares the file hierarchy rooted in the
> current directory against a specification read from the standard
> input.  Messages are written to the standard output for any files
> whose characteristics do not match the specifications, or which
> are missing from either the file hierarchy or the specification.''
> 
> So you run mtree twice, once against dir1 with the -c option to output the 
> specification for the directory tree to stdout (which you can capture to a 
> file, or pipe straight into the second invocation) and once against dir2 with 
> the output of the first one as input (either in a pipeline, or by using -f 
> with the filename of the captured output).
> 
> Jonathan
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

I'm having unexpected troubles with my old BSD server.  ...

I've seen Waitman's examples, and your paragraphs above--[thankx, both
of you, BTW].  I'Ve got several hours of piecing the fragments of my
original *desktop* back together.  Following that, I'll be back.

gary


-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
  Twenty-six years of service to the Unix community.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-13 Thread markham breitbach
Perhaps this would be a question best asked in a Linux Forum or on a Fedora 
list in that
case.  This is, after all, the FreeBSD Questions mailing list.


On 12-09-12 9:12 PM, Gary Kline wrote:
> On Wed, Sep 12, 2012 at 08:17:16PM -0500, Robert Bonomi wrote:
>>> Date: Wed, 12 Sep 2012 14:47:04 -0700
>>> From: Gary Kline 
>>> Subject: Re: cksum entire dir??
>>>
>>> On Wed, Sep 12, 2012 at 10:55:57AM -0700, Waitman Gobble wrote:
>> [sneck]
>>>> are you sure it's not 'md5sum' ? ... that seems to be on all my 
>>>> GNU/Linux machines.
>>>>
>>>  yup, you be right.  altho we have no md5 [[does FBSD?]], fedora does 
>>>  have md5sum.  makes me wonder why this flavor didnt do at least a 
>>>  symlink.   oh well.
>> to find out what you do have, try 'apropos'.
>> e.g.
>>apropos checksum
>>apropos md5
>>apropos sha
>
>   this was the second thing I did.  I have basically 
>   cksum and sum
>
>   on this fedora box.
>
>   oh, and now, md5sum.
>
>> ___
>> freebsd-questions@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
>> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-13 Thread Jonathan McKeown
On Wednesday 12 September 2012 22:29:45 Gary Kline wrote:

>   how, with mtree, could I tell  whether dir1 == dir2 or not?

From the manpage:

``The mtree utility compares the file hierarchy rooted in the
current directory against a specification read from the standard
input.  Messages are written to the standard output for any files
whose characteristics do not match the specifications, or which
are missing from either the file hierarchy or the specification.''

So you run mtree twice, once against dir1 with the -c option to output the 
specification for the directory tree to stdout (which you can capture to a 
file, or pipe straight into the second invocation) and once against dir2 with 
the output of the first one as input (either in a pipeline, or by using -f 
with the filename of the captured output).

Jonathan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Waitman Gobble
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 <
> kl...@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-unsubscr...@freebsd.org"
> > > > > ___
> > > > > freebsd-questions@freebsd.org mailing list
> > > > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > > > > To unsubscribe, send any mail to "
> > > > > freebsd-questions-unsubscr...@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-unsubscr...@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

Re: cksum entire dir??

2012-09-12 Thread Gary Kline
On Wed, Sep 12, 2012 at 08:17:16PM -0500, Robert Bonomi wrote:
> 
> > Date: Wed, 12 Sep 2012 14:47:04 -0700
> > From: Gary Kline 
> > Subject: Re: cksum entire dir??
> >
> > On Wed, Sep 12, 2012 at 10:55:57AM -0700, Waitman Gobble wrote:
> > >
> [sneck]
> > >
> > > are you sure it's not 'md5sum' ? ... that seems to be on all my 
> > > GNU/Linux machines.
> > >
> >
> >  yup, you be right.  altho we have no md5 [[does FBSD?]], fedora does 
> >  have md5sum.  makes me wonder why this flavor didnt do at least a 
> >  symlink.   oh well.
> 
> to find out what you do have, try 'apropos'.
> e.g.
>apropos checksum
>apropos md5
>apropos sha


this was the second thing I did.  I have basically 
cksum and sum

on this fedora box.

oh, and now, md5sum.

> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Gary Kline
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 
> > > > 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-unsubscr...@freebsd.org"
> > > > ___
> > > > freebsd-questions@freebsd.org mailing list
> > > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > > > To unsubscribe, send any mail to "
> > > > freebsd-questions-unsubscr...@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-unsubscr...@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... .


> 
> 
> 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 f

Re: cksum entire dir??

2012-09-12 Thread Robert Bonomi

> Date: Wed, 12 Sep 2012 14:47:04 -0700
> From: Gary Kline 
> Subject: Re: cksum entire dir??
>
> On Wed, Sep 12, 2012 at 10:55:57AM -0700, Waitman Gobble wrote:
> >
[sneck]
> >
> > are you sure it's not 'md5sum' ? ... that seems to be on all my 
> > GNU/Linux machines.
> >
>
>  yup, you be right.  altho we have no md5 [[does FBSD?]], fedora does 
>  have md5sum.  makes me wonder why this flavor didnt do at least a 
>  symlink.   oh well.

to find out what you do have, try 'apropos'.
e.g.
   apropos checksum
   apropos md5
   apropos sha
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Waitman Gobble
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 
> > > 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-unsubscr...@freebsd.org"
> > > ___
> > > freebsd-questions@freebsd.org mailing list
> > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > > To unsubscribe, send any mail to "
> > > freebsd-questions-unsubscr...@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-unsubscr...@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


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-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Gary Kline
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 
> > 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-unsubscr...@freebsd.org"
> > ___
> > freebsd-questions@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > To unsubscribe, send any mail to "
> > freebsd-questions-unsubscr...@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-unsubscr...@freebsd.org"
o
where, Sir, is the header?!

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Gary Kline
On Wed, Sep 12, 2012 at 11:39:46PM +0100, RW wrote:
> On Wed, 12 Sep 2012 14:47:04 -0700
> Gary Kline wrote:
> 
> > On Wed, Sep 12, 2012 at 10:55:57AM -0700, Waitman Gobble wrote:
>  
> > > are you sure it's not 'md5sum' ? ... that seems to be on all my
> > > GNU/Linux machines.
> > > 
> > > Waitman Gobble
> > > San Jose California USA
> > > 
> > 
> > yup, you be right.  altho we have no md5 [[does FBSD?]],
> > fedora does have md5sum.  makes me wonder why this flavor didnt do at
> > least a symlink.   oh well.
> 
> FreeBSD's md5 and GNU's md5sum don't behave the same. Specifically when
> reading from stdin (as in a pipeline) md5 sensibly just outputs the hash
> and a newline, whereas md5sum follows the hash with a "-" to indicate
> stdin as the "filename".
o


ah shit.  well, I spent at least ten years porting stuff--everything
F'ing thing...So I'll  have to find the md5 src and port it.

then follow karl's example.  and others'.  [[[ See, this is just one
example of taken proven code and adding something and breaking 
something ... ]]]


> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Waitman Gobble
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 
> 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-unsubscr...@freebsd.org"
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscr...@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-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread RW
On Wed, 12 Sep 2012 14:47:04 -0700
Gary Kline wrote:

> On Wed, Sep 12, 2012 at 10:55:57AM -0700, Waitman Gobble wrote:
 
> > are you sure it's not 'md5sum' ? ... that seems to be on all my
> > GNU/Linux machines.
> > 
> > Waitman Gobble
> > San Jose California USA
> > 
> 
>   yup, you be right.  altho we have no md5 [[does FBSD?]],
> fedora does have md5sum.  makes me wonder why this flavor didnt do at
> least a symlink.   oh well.

FreeBSD's md5 and GNU's md5sum don't behave the same. Specifically when
reading from stdin (as in a pipeline) md5 sensibly just outputs the hash
and a newline, whereas md5sum follows the hash with a "-" to indicate
stdin as the "filename".
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Gary Kline
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  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-unsubscr...@freebsd.org"
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Gary Kline
On Wed, Sep 12, 2012 at 02:11:05PM -0400, Karl Vogel wrote:
> >> On Tue, 11 Sep 2012 14:38:04 -0700, Gary Kline wrote:
> 
> G> I'm trying to checksum directories as I move them around.  ive read the
> G> man page for sum and cksum ... or maybe skimmed them.  no joy.  anybody
> G> know of a utility to do this?  I've got files that are decades old...
> 
>I wouldn't use CRC32 to check file integrity; use SHA1 or MD5 at the
>very least.  See http://home.comcast.net/~bretm/hash/8.html for details.


[root@ethos klinebak]# yum install sha1
Loaded plugins: langpacks, presto, refresh-packagekit
adobe-linux-x86_64   |  951 B 00:00 
rpmfusion-free-updates   | 3.3 kB 00:00 
rpmfusion-nonfree-updates| 3.3 kB 00:00 
updates/metalink |  18 kB 00:00 
No package sha1 available.
Error: Nothing to do
[root@ethos klinebak]# 

see, nothing; I tried to install sha256 as  well. zip.  but md5sum
I have, so that will serve.

> 
> >> On Tue, 11 Sep 2012 18:17:25 -0700, 
> >> Colin Barnabas  replied:
> 
>Are you by any chance a "Dark Shadows" fan?


I havent a clue what that is; if it's a tv show, no.  
same w/ movies.

> 
> C> This works for me:
> C> $ find foo/ -type f -print0 | xargs -0 md5 >> foo.md5
> 
>I do something similar when copying files to a backup server; it's not
>unheard of for SSH to drop a session or a drive to have a bad spot.
> 
>An easy-to-automate way is: get a list of files, use the hash of your
>choice to generate signatures, sort the signature file by the hash, and
>then get the hash value of the signature file.  Here's an example using
>my bin directory:
> 
>  me% ls
>  aline   dir histmakecfg mx  ro
>  authlog diskusedisodate makekey mylook  setperm
>  avg dline   kernlog makepassn32 sha
>  buildenvdnslog  lastdom mb  n64 sshlog
>  cline   dosrc   linkdupsmd5path nr  sulog
>  cmdlog  dot ll  memuse  ntplog  syslog
>  conlog  dp  lsl mgrep   pathinfotc
>  coref   lslmmk  pingtcv
>  cronlog fixhist lsn mkdtree plogtl
>  daemonlog   fmt lsnmmkproto pwgen   tr0
>  dblog   getperm lss mkrcs   r   tx
>  dbrun   google  lssmmongolograndvi
>  dh  haval   lst month   range   zp
>  dig help2manlstmmv2inode
>  
>  me% find . -type f -print0 | xargs -0 md5 -r | sort > /tmp/dir.md5
>  
>  me% cat /tmp/dir.md5
>  01328aeb4fd0eb3d998f4d7ad407a73f ./setperm
>  017d6d622fb93bf7f23c0fb7b96b16eb ./core
>  0287839688bd660676582266685b05bd ./mkrcs
>  0b97494883c76da546e3603d1b65e7b2 ./pwgen
>  ...
>  ddbed53e795724e4a6683e7b0987284c ./authlog
>  ddbed53e795724e4a6683e7b0987284c ./cmdlog
>  ddbed53e795724e4a6683e7b0987284c ./conlog
>  ddbed53e795724e4a6683e7b0987284c ./cronlog
>  ddbed53e795724e4a6683e7b0987284c ./daemonlog
>  ddbed53e795724e4a6683e7b0987284c ./kernlog
>  ddbed53e795724e4a6683e7b0987284c ./ntplog
>  ddbed53e795724e4a6683e7b0987284c ./sulog
>  ddbed53e795724e4a6683e7b0987284c ./syslog
>  ...
>  fdff1fd84d47f76dbd4954c607d66714 ./dbrun
>  ff5e24efec5cf1e17cf32c58e9c4b317 ./tr0
> 
>The *log files are hard-linked, hence the duplicate MD5 values.
>  

right.


>  me% md5 -r /tmp/dir.md5
>  fdc34a5a5df7807d4fc45739d2d3039f /tmp/dir.md5
> 
>If I copy these files elsewhere, I can repeat the steps and just compare
>the final hash; if it's anything other than 'fdc34...3039f', something's
>wrong.


well, the full story is my new system admin left my desktop 3/4 or 7/8
or 15/16ths in shardes.  I have to-be-made-whole files/dirs in
/home/kline.  copies from two primary computers are scattered all
over.  I/  it won't be the-end if I lose a few favorite songs, but 
I  wantto make certain that my devel and journal and writing dirs 
and a few others are md5sum flawless. 

thanks for youw howto across machines, karl.  I'll save this in my
howto file.  my present desktop is temp; I'll turn it into a server
---just-in-case.  then will use my server for backups.  gotta 
match up.

> 
> -- 
> Karl Vogel  I don't speak for the USAF or my company
> 
> When In Doubt, Empty The Magazine--bumper-sticker seen on military base
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.o

Re: cksum entire dir??

2012-09-12 Thread Waitman Gobble
On Wed, Sep 12, 2012 at 2:47 PM, Gary Kline  wrote:

> On Wed, Sep 12, 2012 at 10:55:57AM -0700, Waitman Gobble wrote:
> > On Wed, Sep 12, 2012 at 10:46 AM, Gary Kline  wrote:
> >
> > > On Wed, Sep 12, 2012 at 07:31:45AM +0100, Matthew Seaman wrote:
> > > > On 12/09/2012 00:14, Polytropon wrote:
> > > > > % cksum 
> > > > >
> > > > > and could obtain a checksum - so it _seems_ to work.
> > > > > After alteration of one file within the hierarchy a
> > > > > different result was printed.
> > > >
> > > > That will give you a checksum on the directory inode -- file names
> and
> > > > associated metadata only, not file content.  In theory you could
> edit a
> > > > file without modifying any of the timestamps, and that wouldn't
> result
> > > > in any change to the directory checksum.  Also, modifying things a
> few
> > > > layers down the filesystem hierarchy won't have any effect either.
> > > >
> > > > Generally I find the best test for differences between old and new
> > > > copies of a filesystem is 'rsync -avx -n ...'
> > > >
> > > > Also, sum and cksum have way too small a key size for this to be
> > > > reliable, since you can't tell a true result from a hash collision.
>  Use
> > > > md5 or sha1 or sha256 for best results.
> > > >
> > >
> > > So this sha256 is *real*??  I have no md5 on my "fedora"
> > > that is on my desktop and m having trouble getting used to.
> > > but the gentleman who recommened cpio was right on the money.
> > >
> >
> >
> >
> > are you sure it's not 'md5sum' ? ... that seems to be on all my GNU/Linux
> > machines.
> >
> > Waitman Gobble
> > San Jose California USA
> >
>
> yup, you be right.  altho we have no md5 [[does FBSD?]], fedora
> does have md5sum.  makes me wonder why this flavor didnt do at
> least a
> symlink.   oh well.
>
> thankee much.
>
> [[
> axeing to save BW
> ]]
>
>
> >
> > > > Dr Matthew J Seaman MA, D.Phil.
> > > > PGP: http://www.infracaninophile.co.uk/pgpkey
> > > >
> > > >
> > >
> > >
> > > ___
> > > freebsd-questions@freebsd.org mailing list
> > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > > To unsubscribe, send any mail to "
> > > freebsd-questions-unsubscr...@freebsd.org"
> > >
>


cat /usr/src/sbin/md5
/*
 * Derived from:
 *
 * MDDRIVER.C - test driver for MD2, MD4 and MD5
 */

/*
 *  Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All
 *  rights reserved.
 *
 *  RSA Data Security, Inc. makes no representations concerning either
 *  the merchantability of this software or the suitability of this
 *  software for any particular purpose. It is provided "as is"
 *  without express or implied warranty of any kind.
 *
 *  These notices must be retained in any copies of any part of this
 *  documentation and/or software.
 */



on my fedora machine, md5sum is from GNU coreutils (on FreeBSD this is in
ports/sysutils/coreutils)

FreeBSD
$ md5 messages
MD5 (messages) = cfbeddecf1a699471c8135a331aac589

Fedora
# md5sum messages
ece159dd0b47c7a7592ceb036745a474  messages


if you gotta have md5.c, could probably pull the src and build on fedora or
maybe something like http://www.efgh.com/software/md5.htm

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-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Gary Kline
On Wed, Sep 12, 2012 at 10:55:57AM -0700, Waitman Gobble wrote:
> On Wed, Sep 12, 2012 at 10:46 AM, Gary Kline  wrote:
> 
> > On Wed, Sep 12, 2012 at 07:31:45AM +0100, Matthew Seaman wrote:
> > > On 12/09/2012 00:14, Polytropon wrote:
> > > > % cksum 
> > > >
> > > > and could obtain a checksum - so it _seems_ to work.
> > > > After alteration of one file within the hierarchy a
> > > > different result was printed.
> > >
> > > That will give you a checksum on the directory inode -- file names and
> > > associated metadata only, not file content.  In theory you could edit a
> > > file without modifying any of the timestamps, and that wouldn't result
> > > in any change to the directory checksum.  Also, modifying things a few
> > > layers down the filesystem hierarchy won't have any effect either.
> > >
> > > Generally I find the best test for differences between old and new
> > > copies of a filesystem is 'rsync -avx -n ...'
> > >
> > > Also, sum and cksum have way too small a key size for this to be
> > > reliable, since you can't tell a true result from a hash collision.  Use
> > > md5 or sha1 or sha256 for best results.
> > >
> >
> > So this sha256 is *real*??  I have no md5 on my "fedora"
> > that is on my desktop and m having trouble getting used to.
> > but the gentleman who recommened cpio was right on the money.
> >
> 
> 
> 
> are you sure it's not 'md5sum' ? ... that seems to be on all my GNU/Linux
> machines.
> 
> Waitman Gobble
> San Jose California USA
> 

yup, you be right.  altho we have no md5 [[does FBSD?]], fedora 
does have md5sum.  makes me wonder why this flavor didnt do at least a
symlink.   oh well.

thankee much.

[[ 
axeing to save BW
]]


> 
> > > Dr Matthew J Seaman MA, D.Phil.
> > > PGP: http://www.infracaninophile.co.uk/pgpkey
> > >
> > >
> >
> >
> > ___
> > freebsd-questions@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > To unsubscribe, send any mail to "
> > freebsd-questions-unsubscr...@freebsd.org"
> >
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Gary Kline
On Wed, Sep 12, 2012 at 09:12:58AM +0200, Jonathan McKeown wrote:
> On Wednesday 12 September 2012 08:31:45 Matthew Seaman wrote:
> > On 12/09/2012 00:14, Polytropon wrote:
> > >   % cksum 
> [snip]
> >
> > That will give you a checksum on the directory inode -- file names and
> > associated metadata only, not file content.
> [snip]
> > Generally I find the best test for differences between old and new
> > copies of a filesystem is 'rsync -avx -n ...'
> 
> Wouldn't suitable applications of mtree(8) also do what's wanted?
> 
> Jonathan
> ___

how, with mtree, could I tell  whether dir1 == dir2 or not?

gary


> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Mike Jeays
On Wed, 12 Sep 2012 10:55:57 -0700
Waitman Gobble  wrote:

> On Wed, Sep 12, 2012 at 10:46 AM, Gary Kline  wrote:
> 
> > On Wed, Sep 12, 2012 at 07:31:45AM +0100, Matthew Seaman wrote:
> > > On 12/09/2012 00:14, Polytropon wrote:
> > > > % cksum 
> > > >
> > > > and could obtain a checksum - so it _seems_ to work.
> > > > After alteration of one file within the hierarchy a
> > > > different result was printed.
> > >
> > > That will give you a checksum on the directory inode -- file names and
> > > associated metadata only, not file content.  In theory you could edit a
> > > file without modifying any of the timestamps, and that wouldn't result
> > > in any change to the directory checksum.  Also, modifying things a few
> > > layers down the filesystem hierarchy won't have any effect either.
> > >
> > > Generally I find the best test for differences between old and new
> > > copies of a filesystem is 'rsync -avx -n ...'
> > >
> > > Also, sum and cksum have way too small a key size for this to be
> > > reliable, since you can't tell a true result from a hash collision.  Use
> > > md5 or sha1 or sha256 for best results.
> > >
> >
> > So this sha256 is *real*??  I have no md5 on my "fedora"
> > that is on my desktop and m having trouble getting used to.
> > but the gentleman who recommened cpio was right on the money.
> >
> 
> 
> 
> are you sure it's not 'md5sum' ? ... that seems to be on all my GNU/Linux
> machines.
> 
> Waitman Gobble
> San Jose California USA
> 
> 
> 
> 
> >
> > note that I am loathe to spam this list with the following mail
> > from my
> > files in sept, 1988, but here it is.  if I had only gr -r -w cpio
> > around in all my directories, I would have found this, sent to one
> > Dirm
> > Myers across the pond ::
> >
> >
> > ===
> >
> > >From kline Sat Sep  5 11:52:20 1998
> > Subject: lost mail file...
> > To: di...@buster.dhis.eu.org (Dirk Myers)
> > Date: Sat, 5 Sep 1998 11:52:20 -0700 (PDT)
> > Organization: <> thought.org: public access uNix in service... <>
> > X-Mailer: ELM [version 2.4ME+ PL32 (25)]
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=US-ASCII
> > Content-Transfer-Encoding: 7bit
> > Content-Length: 2283
> > Status: RO
> >
> >
> >   Yesterday morning I began composing the next two Q's and A's
> >   in my mailer.  Last night in the wee hours there was a power
> >   glitch and I lost the mail.
> >
> >   Enclosed is the first//next Q/A.  I'll send along another one
> >   or two later today.  One that I was playing around with *failed*
> >   and I'm trying to figure out why.
> >
> >   -
> >
> >   How can I uise my FBSD floppy drive to copy files to it (in this case,
> >   at work), and retrieve the files on my FBSD systtem at home.  So far
> >   I've only seen examples that used floppies with a filesystem on them.
> >   Is there a simplr, more direct way?
> >
> >   You can treat the 'raw' floppy device as if it is a tape drive, and
> >   use typically UNIX tape tools to read/write, such as tar and  cpio.
> >   For instance, to copy the current directory onto a floppy to
> >   take home at night:
> >
> > (put the floppy in the drive, and cd to the directory where
> >  the files are; then )
> >
> > % tar -cvf /dev/rfd0 .
> >
> >   To read it when you get home:
> >
> > (put the floppy in the drive at home; and extract the tarball
> >  wherever you want the files)
> >
> > % tar -xvf /dev/rfd0
> >
> >   The flags -c and -x indicate create and extract mode, the ``v''
> >   specifies verbose mode, and the ``f'' tells tar that the following
> >   argument is the file or device that tar acts upon.  Here, it is
> >   the floppy devide.
> >
> >
> >   With cpio:
> >
> > (chdir to the directory where the files are)
> >
> > % ls | cpio -oc > /dev/rfd0
> >
> >To read a cpio archive from a tape drive:
> >
> >% cpio -icd < /dev/rfd0
> >
> >
> >The flags -i and -o indicate copy-in or extract mode and
> >copy-out or create archive mode.   The ``c'' tells cpio
> >to use the old, portablr ASCII archive format.  And the
> >``d'' flag tells cpio to create directories where necessary.
> >
> >Do a
> >
> >% man cpio
> >
> >for much greater detail on this utility.
> >
> >   -
> >
> >   There are another one or two of the simpler Q/A's and one or two
> >   more involved.
> >
> >   Then, for this month only, I want to write a paragraph or two
> >   about who I am and where I'm coming from.  Since you are sharing
> >   the by-line you might want to consider this too.
> >
> >   gary
> >
> >   PS:   Next month we get a break!!
> >
> > --
> >Gary D. Kline kl...@tao.thought.org  Public service
> > uNix
> >
> > 
> > as you can see, this dealt with my olden tape drive.  a 250meg
> > QIC drive, I think.but this was about the earliest referenc

Re: cksum entire dir??

2012-09-12 Thread Karl Vogel
>> On Tue, 11 Sep 2012 14:38:04 -0700, Gary Kline wrote:

G> I'm trying to checksum directories as I move them around.  ive read the
G> man page for sum and cksum ... or maybe skimmed them.  no joy.  anybody
G> know of a utility to do this?  I've got files that are decades old...

   I wouldn't use CRC32 to check file integrity; use SHA1 or MD5 at the
   very least.  See http://home.comcast.net/~bretm/hash/8.html for details.

>> On Tue, 11 Sep 2012 18:17:25 -0700, 
>> Colin Barnabas  replied:

   Are you by any chance a "Dark Shadows" fan?

C> This works for me:
C> $ find foo/ -type f -print0 | xargs -0 md5 >> foo.md5

   I do something similar when copying files to a backup server; it's not
   unheard of for SSH to drop a session or a drive to have a bad spot.

   An easy-to-automate way is: get a list of files, use the hash of your
   choice to generate signatures, sort the signature file by the hash, and
   then get the hash value of the signature file.  Here's an example using
   my bin directory:

 me% ls
 aline   dir histmakecfg mx  ro
 authlog diskusedisodate makekey mylook  setperm
 avg dline   kernlog makepassn32 sha
 buildenvdnslog  lastdom mb  n64 sshlog
 cline   dosrc   linkdupsmd5path nr  sulog
 cmdlog  dot ll  memuse  ntplog  syslog
 conlog  dp  lsl mgrep   pathinfotc
 coref   lslmmk  pingtcv
 cronlog fixhist lsn mkdtree plogtl
 daemonlog   fmt lsnmmkproto pwgen   tr0
 dblog   getperm lss mkrcs   r   tx
 dbrun   google  lssmmongolograndvi
 dh  haval   lst month   range   zp
 dig help2manlstmmv2inode
 
 me% find . -type f -print0 | xargs -0 md5 -r | sort > /tmp/dir.md5
 
 me% cat /tmp/dir.md5
 01328aeb4fd0eb3d998f4d7ad407a73f ./setperm
 017d6d622fb93bf7f23c0fb7b96b16eb ./core
 0287839688bd660676582266685b05bd ./mkrcs
 0b97494883c76da546e3603d1b65e7b2 ./pwgen
 ...
 ddbed53e795724e4a6683e7b0987284c ./authlog
 ddbed53e795724e4a6683e7b0987284c ./cmdlog
 ddbed53e795724e4a6683e7b0987284c ./conlog
 ddbed53e795724e4a6683e7b0987284c ./cronlog
 ddbed53e795724e4a6683e7b0987284c ./daemonlog
 ddbed53e795724e4a6683e7b0987284c ./kernlog
 ddbed53e795724e4a6683e7b0987284c ./ntplog
 ddbed53e795724e4a6683e7b0987284c ./sulog
 ddbed53e795724e4a6683e7b0987284c ./syslog
 ...
 fdff1fd84d47f76dbd4954c607d66714 ./dbrun
 ff5e24efec5cf1e17cf32c58e9c4b317 ./tr0

   The *log files are hard-linked, hence the duplicate MD5 values.
 
 me% md5 -r /tmp/dir.md5
 fdc34a5a5df7807d4fc45739d2d3039f /tmp/dir.md5

   If I copy these files elsewhere, I can repeat the steps and just compare
   the final hash; if it's anything other than 'fdc34...3039f', something's
   wrong.

-- 
Karl Vogel  I don't speak for the USAF or my company

When In Doubt, Empty The Magazine--bumper-sticker seen on military base
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Waitman Gobble
On Wed, Sep 12, 2012 at 10:46 AM, Gary Kline  wrote:

> On Wed, Sep 12, 2012 at 07:31:45AM +0100, Matthew Seaman wrote:
> > On 12/09/2012 00:14, Polytropon wrote:
> > > % cksum 
> > >
> > > and could obtain a checksum - so it _seems_ to work.
> > > After alteration of one file within the hierarchy a
> > > different result was printed.
> >
> > That will give you a checksum on the directory inode -- file names and
> > associated metadata only, not file content.  In theory you could edit a
> > file without modifying any of the timestamps, and that wouldn't result
> > in any change to the directory checksum.  Also, modifying things a few
> > layers down the filesystem hierarchy won't have any effect either.
> >
> > Generally I find the best test for differences between old and new
> > copies of a filesystem is 'rsync -avx -n ...'
> >
> > Also, sum and cksum have way too small a key size for this to be
> > reliable, since you can't tell a true result from a hash collision.  Use
> > md5 or sha1 or sha256 for best results.
> >
>
> So this sha256 is *real*??  I have no md5 on my "fedora"
> that is on my desktop and m having trouble getting used to.
> but the gentleman who recommened cpio was right on the money.
>



are you sure it's not 'md5sum' ? ... that seems to be on all my GNU/Linux
machines.

Waitman Gobble
San Jose California USA




>
> note that I am loathe to spam this list with the following mail
> from my
> files in sept, 1988, but here it is.  if I had only gr -r -w cpio
> around in all my directories, I would have found this, sent to one
> Dirm
> Myers across the pond ::
>
>
> ===
>
> >From kline Sat Sep  5 11:52:20 1998
> Subject: lost mail file...
> To: di...@buster.dhis.eu.org (Dirk Myers)
> Date: Sat, 5 Sep 1998 11:52:20 -0700 (PDT)
> Organization: <> thought.org: public access uNix in service... <>
> X-Mailer: ELM [version 2.4ME+ PL32 (25)]
> MIME-Version: 1.0
> Content-Type: text/plain; charset=US-ASCII
> Content-Transfer-Encoding: 7bit
> Content-Length: 2283
> Status: RO
>
>
>   Yesterday morning I began composing the next two Q's and A's
>   in my mailer.  Last night in the wee hours there was a power
>   glitch and I lost the mail.
>
>   Enclosed is the first//next Q/A.  I'll send along another one
>   or two later today.  One that I was playing around with *failed*
>   and I'm trying to figure out why.
>
>   -
>
>   How can I uise my FBSD floppy drive to copy files to it (in this case,
>   at work), and retrieve the files on my FBSD systtem at home.  So far
>   I've only seen examples that used floppies with a filesystem on them.
>   Is there a simplr, more direct way?
>
>   You can treat the 'raw' floppy device as if it is a tape drive, and
>   use typically UNIX tape tools to read/write, such as tar and  cpio.
>   For instance, to copy the current directory onto a floppy to
>   take home at night:
>
> (put the floppy in the drive, and cd to the directory where
>  the files are; then )
>
> % tar -cvf /dev/rfd0 .
>
>   To read it when you get home:
>
> (put the floppy in the drive at home; and extract the tarball
>  wherever you want the files)
>
> % tar -xvf /dev/rfd0
>
>   The flags -c and -x indicate create and extract mode, the ``v''
>   specifies verbose mode, and the ``f'' tells tar that the following
>   argument is the file or device that tar acts upon.  Here, it is
>   the floppy devide.
>
>
>   With cpio:
>
> (chdir to the directory where the files are)
>
> % ls | cpio -oc > /dev/rfd0
>
>To read a cpio archive from a tape drive:
>
>% cpio -icd < /dev/rfd0
>
>
>The flags -i and -o indicate copy-in or extract mode and
>copy-out or create archive mode.   The ``c'' tells cpio
>to use the old, portablr ASCII archive format.  And the
>``d'' flag tells cpio to create directories where necessary.
>
>Do a
>
>% man cpio
>
>for much greater detail on this utility.
>
>   -
>
>   There are another one or two of the simpler Q/A's and one or two
>   more involved.
>
>   Then, for this month only, I want to write a paragraph or two
>   about who I am and where I'm coming from.  Since you are sharing
>   the by-line you might want to consider this too.
>
>   gary
>
>   PS:   Next month we get a break!!
>
> --
>Gary D. Kline kl...@tao.thought.org  Public service
> uNix
>
> 
> as you can see, this dealt with my olden tape drive.  a 250meg
> QIC drive, I think.but this was about the earliest reference
> I could find re my use of cpio.  there are others in my journal
> dir that reference my running out of hard drive and using cpio
> rather
> that a straight cp -rp.  [this was back when a 130meg drive was
> Huge
> and made me feel rick.]
>
>
>
> >   Cheers,
> >
> >   Matthew
> >
> > --
> > Dr Matthew J 

Re: cksum entire dir??

2012-09-12 Thread Gary Kline
On Wed, Sep 12, 2012 at 07:31:45AM +0100, Matthew Seaman wrote:
> On 12/09/2012 00:14, Polytropon wrote:
> > % cksum 
> > 
> > and could obtain a checksum - so it _seems_ to work.
> > After alteration of one file within the hierarchy a
> > different result was printed.
> 
> That will give you a checksum on the directory inode -- file names and
> associated metadata only, not file content.  In theory you could edit a
> file without modifying any of the timestamps, and that wouldn't result
> in any change to the directory checksum.  Also, modifying things a few
> layers down the filesystem hierarchy won't have any effect either.
> 
> Generally I find the best test for differences between old and new
> copies of a filesystem is 'rsync -avx -n ...'
> 
> Also, sum and cksum have way too small a key size for this to be
> reliable, since you can't tell a true result from a hash collision.  Use
> md5 or sha1 or sha256 for best results.
> 

So this sha256 is *real*??  I have no md5 on my "fedora"
that is on my desktop and m having trouble getting used to.  
but the gentleman who recommened cpio was right on the money.

note that I am loathe to spam this list with the following mail from my
files in sept, 1988, but here it is.  if I had only gr -r -w cpio
around in all my directories, I would have found this, sent to one Dirm
Myers across the pond ::


===

>From kline Sat Sep  5 11:52:20 1998
Subject: lost mail file...
To: di...@buster.dhis.eu.org (Dirk Myers)
Date: Sat, 5 Sep 1998 11:52:20 -0700 (PDT)
Organization: <> thought.org: public access uNix in service... <>
X-Mailer: ELM [version 2.4ME+ PL32 (25)]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 2283
Status: RO


  Yesterday morning I began composing the next two Q's and A's
  in my mailer.  Last night in the wee hours there was a power
  glitch and I lost the mail.

  Enclosed is the first//next Q/A.  I'll send along another one
  or two later today.  One that I was playing around with *failed*
  and I'm trying to figure out why.

  -

  How can I uise my FBSD floppy drive to copy files to it (in this case,
  at work), and retrieve the files on my FBSD systtem at home.  So far
  I've only seen examples that used floppies with a filesystem on them.
  Is there a simplr, more direct way?

  You can treat the 'raw' floppy device as if it is a tape drive, and
  use typically UNIX tape tools to read/write, such as tar and  cpio.
  For instance, to copy the current directory onto a floppy to
  take home at night:

(put the floppy in the drive, and cd to the directory where
 the files are; then )

% tar -cvf /dev/rfd0 .

  To read it when you get home:

(put the floppy in the drive at home; and extract the tarball
 wherever you want the files)

% tar -xvf /dev/rfd0

  The flags -c and -x indicate create and extract mode, the ``v''
  specifies verbose mode, and the ``f'' tells tar that the following
  argument is the file or device that tar acts upon.  Here, it is
  the floppy devide.


  With cpio:

(chdir to the directory where the files are)

% ls | cpio -oc > /dev/rfd0

   To read a cpio archive from a tape drive:

   % cpio -icd < /dev/rfd0


   The flags -i and -o indicate copy-in or extract mode and
   copy-out or create archive mode.   The ``c'' tells cpio
   to use the old, portablr ASCII archive format.  And the
   ``d'' flag tells cpio to create directories where necessary.

   Do a

   % man cpio

   for much greater detail on this utility.

  -

  There are another one or two of the simpler Q/A's and one or two
  more involved.

  Then, for this month only, I want to write a paragraph or two
  about who I am and where I'm coming from.  Since you are sharing
  the by-line you might want to consider this too.

  gary

  PS:   Next month we get a break!!

--
   Gary D. Kline kl...@tao.thought.org  Public service uNix


as you can see, this dealt with my olden tape drive.  a 250meg
QIC drive, I think.but this was about the earliest reference 
I could find re my use of cpio.  there are others in my journal 
dir that reference my running out of hard drive and using cpio rather
that a straight cp -rp.  [this was back when a 130meg drive was Huge
and made me feel rick.]



>   Cheers,
> 
>   Matthew
> 
> -- 
> Dr Matthew J Seaman MA, D.Phil.
> PGP: http://www.infracaninophile.co.uk/pgpkey
> 
> 


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Waitman Gobble
On Sep 11, 2012 10:10 PM, "Gary Kline"  wrote:
>
> On Tue, Sep 11, 2012 at 09:18:13PM -0400, kpn...@pobox.com wrote:
> > On Tue, Sep 11, 2012 at 05:24:08PM -0700, Gary Kline wrote:
> > > On Wed, Sep 12, 2012 at 01:14:43AM +0200, Polytropon wrote:
> > > > But I also tried cksum directly with a directory
> > > > like
> > > >
> > > >   % cksum 
> > > >
> > > > and could obtain a checksum - so it _seems_ to work.
> > > > After alteration of one file within the hierarchy a
> > > > different result was printed.
> >
> > > I think I tried something like your second example last night.
> > > I think I did
> > >
> > > % cksum foodir/*
> > >
> > > and had to compare each file from another file I was copying from.
> > > it was tiresome to check each of dozens of files tho. I was here
at
> > > desk for something obscene -- over 12 hrs. getting my new
[slightly
> > > used:)] computer back to normal.
> > >
> > > if there isn't anything that can compare entire dirs, it looks
like
> > > it's time to hack a small program.  tx, polyt.
> >
> > Unix was originally created to do text manipulation. No need for a new
> > program when you can do it from the command line.
> >
> > cd dir1 ; cksum * | sort > /tmp/dir1-cksum
> > cd dir2 ; cksum * | sort > /tmp/dir2-cksum
> >
> > diff /tmp/dir?-cksum
> >
> > Don't forget to remove temporary files when you are done.
> >
> > Other useful commands:
> > cut
> > paste
> >
> > You can use awk to pull out and rearrange columns:
> > cksum * | awk '{ print $3, $1, $2; }' | sort
> >
> > This gives you a little easier diff in case you do have changes.
> >
> > Friendly tip: if you did comparisons by hand for 12 hours then you
> > may have missed something.
>
>
> no, it was several other tasks that I had t  o do very carefully
> by hand.  I was going to write an awk script.  I figured there
> were others ways.
>
> my desktop is a flavor of linux that i don't  know.  it seems to
be
> lacking in many common unix binaries; md5 is one that I spent
> an hour checking.  zero.
>
> your first way works very well and will serve.   many thanks.
> now I can listen to:
>
> /Lectures on the Critique of Pure Reason
>
> which is now safely in my home directory in several mp3 files.
>
> >
> > It's a real shame Unix doesn't have a really good tool for comparing
> > two directory trees. You can use 'diff -r' (even on binaries), but that
> > fails if you have devices, named pipes, or named sockets in the
> > filesystem. And diff or cksum don't tell you if symlinks are different.
> > Plus you may care about file ownership, and that's where the stat
> > command comes in handy.
>
>
> right.  these are things you only discover the hard way.
> >
> > Not that I'm volunteering, mind you. I ended up instead writing a
> > Python script to do copies of filesystems off of old machines I'm
> > putting to pasture. It's amazing how badly old versions of dump and
> > tar behave.
>
>
> REmember CP/M and MP/M?  I started out with a dual 8085/80888 box
> with MP/Mand wrote notes and letters that were stored on 8"
> twin floppies.  circa mid-1980's I transferred a boatload of
floppies
> onto my 386 with SVR2 with uucp and others C programs on the 8088
box.
> it took forever and things keep faulting, but I got it done.
> eventually.
>
> >

oh yeah, I remember the Kaypro «portable» which was as big as a sampsonite,
and despite being built like a tank probably couldn't handle a wrangling by
a gorilla.

Waitman Gobble
San Jose California



 --
> > Kevin P. Nealhttp://www.pobox.com/~kpn/
> >
> >"I like being on The Daily Show." - Kermit the Frog, Feb 13 2001
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
freebsd-questions-unsubscr...@freebsd.org"
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Matthew Seaman
On 09/12/12 08:12, Jonathan McKeown wrote:
>> Generally I find the best test for differences between old and new
>> > copies of a filesystem is 'rsync -avx -n ...'

> Wouldn't suitable applications of mtree(8) also do what's wanted?

TIMTOWTDI.

Cheers,

Matthew


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-12 Thread Jonathan McKeown
On Wednesday 12 September 2012 08:31:45 Matthew Seaman wrote:
> On 12/09/2012 00:14, Polytropon wrote:
> > % cksum 
[snip]
>
> That will give you a checksum on the directory inode -- file names and
> associated metadata only, not file content.
[snip]
> Generally I find the best test for differences between old and new
> copies of a filesystem is 'rsync -avx -n ...'

Wouldn't suitable applications of mtree(8) also do what's wanted?

Jonathan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread Matthew Seaman
On 12/09/2012 00:14, Polytropon wrote:
>   % cksum 
> 
> and could obtain a checksum - so it _seems_ to work.
> After alteration of one file within the hierarchy a
> different result was printed.

That will give you a checksum on the directory inode -- file names and
associated metadata only, not file content.  In theory you could edit a
file without modifying any of the timestamps, and that wouldn't result
in any change to the directory checksum.  Also, modifying things a few
layers down the filesystem hierarchy won't have any effect either.

Generally I find the best test for differences between old and new
copies of a filesystem is 'rsync -avx -n ...'

Also, sum and cksum have way too small a key size for this to be
reliable, since you can't tell a true result from a hash collision.  Use
md5 or sha1 or sha256 for best results.

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.
PGP: http://www.infracaninophile.co.uk/pgpkey




signature.asc
Description: OpenPGP digital signature


Re: cksum entire dir??

2012-09-11 Thread Gary Kline
On Tue, Sep 11, 2012 at 09:55:33PM -0500, Robert Bonomi wrote:
> 
> > Date: Tue, 11 Sep 2012 17:24:08 -0700
> > From: Gary Kline 
> > Subject: Re: cksum entire dir??
> >
> > On Wed, Sep 12, 2012 at 01:14:43AM +0200, Polytropon wrote:
> > > On Tue, 11 Sep 2012 14:38:04 -0700, Gary Kline wrote:
> > > > 
> > > > I'm trying to checksum directories as I move them around.
> > > > ive read the man page for sum and cksum ... or maybe skimmed 
> > > > them.  no joy.  anybody know of a utility to do this?  I've 
> > > > got files that are decades old... 
> > > 
> > > Maybe it's possible to tar the directory (without
> > > compression of course) and obtain a checksum of
> > > the tar archive?
> > > 
> > >   % tar cf -  | cksum
> > > 
> > > But I also tried cksum directly with a directory
> > > like
> > > 
> > >   % cksum 
> > > 
> > > and could obtain a checksum - so it _seems_ to work.
> > > After alteration of one file within the hierarchy a
> > > different result was printed.
> > > 
> > > Tested on OS version 8.2-STABLE/i386, one year old.
> > > 
> >
> >
> > I think I tried something like your second example last night.
> > I think I did
> >
> > % cksum foodir/*
> >
> > and had to compare each file from another file I was copying from.
> > it was tiresome to check each of dozens of files tho. I was here at 
> > desk for something obscene -- over 12 hrs. getting my new [slightly
> > used:)] computer back to normal.  
> 
> If you'd say _what_ you are trying to accomplish, as distinct from
> _how_ you are attempting to do things,  people might be able to 
> suggest a "sensible" answer.
> 
> Taking what you asked _literally_, 'tar . -cf - | cksum' answers the question.
> Although 'find . -exec cat {} \; | cksum' may be closer.





below, is what is easiest to script ... this was kevin's idea, simple
and straight foreward.  the only trick is that in several cases I have
to type [[ ot alias ]] prefix strings like
"/home/ethic/usr/home/kline" before I get into the breadth or depth of
my directories ...

> 
> However, if you just want to etablish that the contents of two directories
> are identical, the 'diff -r -q {dir1} {dir2} might be appropriate.
> 
> 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread Gary Kline
On Tue, Sep 11, 2012 at 09:18:13PM -0400, kpn...@pobox.com wrote:
> On Tue, Sep 11, 2012 at 05:24:08PM -0700, Gary Kline wrote:
> > On Wed, Sep 12, 2012 at 01:14:43AM +0200, Polytropon wrote:
> > > But I also tried cksum directly with a directory
> > > like
> > > 
> > >   % cksum 
> > > 
> > > and could obtain a checksum - so it _seems_ to work.
> > > After alteration of one file within the hierarchy a
> > > different result was printed.
>  
> > I think I tried something like your second example last night.
> > I think I did
> > 
> > % cksum foodir/*
> > 
> > and had to compare each file from another file I was copying from.
> > it was tiresome to check each of dozens of files tho. I was here at 
> > desk for something obscene -- over 12 hrs. getting my new [slightly
> > used:)] computer back to normal.  
> > 
> > if there isn't anything that can compare entire dirs, it looks like
> > it's time to hack a small program.  tx, polyt.
> 
> Unix was originally created to do text manipulation. No need for a new
> program when you can do it from the command line.
> 
> cd dir1 ; cksum * | sort > /tmp/dir1-cksum
> cd dir2 ; cksum * | sort > /tmp/dir2-cksum
> 
> diff /tmp/dir?-cksum
> 
> Don't forget to remove temporary files when you are done.
> 
> Other useful commands:
> cut
> paste
> 
> You can use awk to pull out and rearrange columns:
> cksum * | awk '{ print $3, $1, $2; }' | sort
> 
> This gives you a little easier diff in case you do have changes.
> 
> Friendly tip: if you did comparisons by hand for 12 hours then you
> may have missed something.


no, it was several other tasks that I had t  o do very carefully
by hand.  I was going to write an awk script.  I figured there
were others ways.

my desktop is a flavor of linux that i don't  know.  it seems to be
lacking in many common unix binaries; md5 is one that I spent
an hour checking.  zero.

your first way works very well and will serve.   many thanks.
now I can listen to:

/Lectures on the Critique of Pure Reason

which is now safely in my home directory in several mp3 files.

> 
> It's a real shame Unix doesn't have a really good tool for comparing
> two directory trees. You can use 'diff -r' (even on binaries), but that
> fails if you have devices, named pipes, or named sockets in the
> filesystem. And diff or cksum don't tell you if symlinks are different.
> Plus you may care about file ownership, and that's where the stat
> command comes in handy.


right.  these are things you only discover the hard way.   
>  
> Not that I'm volunteering, mind you. I ended up instead writing a
> Python script to do copies of filesystems off of old machines I'm
> putting to pasture. It's amazing how badly old versions of dump and
> tar behave. 


REmember CP/M and MP/M?  I started out with a dual 8085/80888 box 
with MP/Mand wrote notes and letters that were stored on 8"
twin floppies.  circa mid-1980's I transferred a boatload of floppies
onto my 386 with SVR2 with uucp and others C programs on the 8088 box. 
it took forever and things keep faulting, but I got it done.
eventually.

> -- 
> Kevin P. Nealhttp://www.pobox.com/~kpn/
> 
>"I like being on The Daily Show." - Kermit the Frog, Feb 13 2001
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread Robert Bonomi

> Date: Tue, 11 Sep 2012 17:24:08 -0700
> From: Gary Kline 
> Subject: Re: cksum entire dir??
>
> On Wed, Sep 12, 2012 at 01:14:43AM +0200, Polytropon wrote:
> > On Tue, 11 Sep 2012 14:38:04 -0700, Gary Kline wrote:
> > > 
> > > I'm trying to checksum directories as I move them around.
> > > ive read the man page for sum and cksum ... or maybe skimmed 
> > > them.  no joy.  anybody know of a utility to do this?  I've 
> > > got files that are decades old... 
> > 
> > Maybe it's possible to tar the directory (without
> > compression of course) and obtain a checksum of
> > the tar archive?
> > 
> > % tar cf -  | cksum
> > 
> > But I also tried cksum directly with a directory
> > like
> > 
> > % cksum 
> > 
> > and could obtain a checksum - so it _seems_ to work.
> > After alteration of one file within the hierarchy a
> > different result was printed.
> > 
> > Tested on OS version 8.2-STABLE/i386, one year old.
> > 
>
>
>   I think I tried something like your second example last night.
>   I think I did
>
>   % cksum foodir/*
>
>   and had to compare each file from another file I was copying from.
>   it was tiresome to check each of dozens of files tho. I was here at 
>   desk for something obscene -- over 12 hrs. getting my new [slightly
>   used:)] computer back to normal.  

If you'd say _what_ you are trying to accomplish, as distinct from
_how_ you are attempting to do things,  people might be able to 
suggest a "sensible" answer.

Taking what you asked _literally_, 'tar . -cf - | cksum' answers the question.
Although 'find . -exec cat {} \; | cksum' may be closer.

However, if you just want to etablish that the contents of two directories
are identical, the 'diff -r -q {dir1} {dir2} might be appropriate.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread Lowell Gilbert
Paul Kraus  writes:

> On Tue, Sep 11, 2012 at 9:18 PM,   wrote:
>
>> It's a real shame Unix doesn't have a really good tool for comparing
>> two directory trees. You can use 'diff -r' (even on binaries), but that
>> fails if you have devices, named pipes, or named sockets in the
>> filesystem. And diff or cksum don't tell you if symlinks are different.
>> Plus you may care about file ownership, and that's where the stat
>> command comes in handy.
>
> Solaris and a least a few versions of Linux have a "dircmp" command
> that is in reality a wrapper for diff that handles special files. The
> problem with it is that it tends to be slow (I had to validate
> millions of files).

It's not clear what the danger profile is supposed to be here; dircmp
(and recursing 'diff' applications) can handle many cases, but mtree(8)
(with appropriate options) covers more pathological problems. Even so,
analysis of changes in file nodes like named sockets will usually
require some understanding of the application.

I suspect that either a recursive diff or an mtree specification is a
good solution for the original poster's problem, but we don't have
enough information to be more sure than that.

Be well.
Lowell
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread markham breitbach
As long as you are not moving files across mount points, you could always do 
something
like this:

cd $SOURCE_DIR && find . -print | cpio -dplm $DEST_DIR
rm -rf $SOURCE_DIR

That will create hard links from one directory to the other so you don't have 
to worry
about any file corruption since the data is never actually moved around on the 
disk.  It
should also be a whole lot faster than actually moving or copying the data and 
you don't
have to worry about running out of disk space half way through a copy.

-M


On 12-09-11 3:38 PM, Gary Kline wrote:
> I'm trying to checksum directories as I move them around.
> ive read the man page for sum and cksum ... or maybe skimmed 
> them.  no joy.  anybody know of a utility to do this?  I've 
> got files that are decades old... 
>
> tx, guys.
>
> gary
>
>
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread Paul Kraus
On Tue, Sep 11, 2012 at 10:03 PM, Gary Kline  wrote:

> I'm not concerned about a file having been changed, just whether
>
>% cp -rp /home/klinebak/foodir   /home/kline/
>
> is 100% reliable.  down to the bit!

If "cp" is not reliable (down to the bit), then you have much bigger problems.

On the other hand, hard drives do have uncorrectable errors and
they report the read operation as valid even though they returned bad
data. That is part of why ZFS was created and ported to FreeBSD, it
checksums the data so a bad bit coming from a drive does not corrupt a
file.

-- 
{1-2-3-4-5-6-7-}
Paul Kraus
-> Principal Consultant, Business Information Technology Systems
-> Deputy Technical Director, LoneStarCon 3 (http://lonestarcon3.org/)
-> Sound Coordinator, Schenectady Light Opera Company (
http://www.sloctheater.org/ )
-> Technical Advisor, Troy Civic Theatre Company
-> Technical Advisor, RPI Players
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread Paul Kraus
On Tue, Sep 11, 2012 at 9:18 PM,   wrote:

> It's a real shame Unix doesn't have a really good tool for comparing
> two directory trees. You can use 'diff -r' (even on binaries), but that
> fails if you have devices, named pipes, or named sockets in the
> filesystem. And diff or cksum don't tell you if symlinks are different.
> Plus you may care about file ownership, and that's where the stat
> command comes in handy.

Solaris and a least a few versions of Linux have a "dircmp" command
that is in reality a wrapper for diff that handles special files. The
problem with it is that it tends to be slow (I had to validate
millions of files).

-- 
{1-2-3-4-5-6-7-}
Paul Kraus
-> Principal Consultant, Business Information Technology Systems
-> Deputy Technical Director, LoneStarCon 3 (http://lonestarcon3.org/)
-> Sound Coordinator, Schenectady Light Opera Company (
http://www.sloctheater.org/ )
-> Technical Advisor, Troy Civic Theatre Company
-> Technical Advisor, RPI Players
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread Gary Kline
On Wed, Sep 12, 2012 at 02:48:54AM +0200, Polytropon wrote:
> On Tue, 11 Sep 2012 17:24:08 -0700, Gary Kline wrote:
> > On Wed, Sep 12, 2012 at 01:14:43AM +0200, Polytropon wrote:
> > > On Tue, 11 Sep 2012 14:38:04 -0700, Gary Kline wrote:
> > > > 
> > > > I'm trying to checksum directories as I move them around.
> > > > ive read the man page for sum and cksum ... or maybe skimmed 
> > > > them.  no joy.  anybody know of a utility to do this?  I've 
> > > > got files that are decades old... 
> > > 
> > > Maybe it's possible to tar the directory (without
> > > compression of course) and obtain a checksum of
> > > the tar archive?
> > > 
> > >   % tar cf -  | cksum
> > > 
> > > But I also tried cksum directly with a directory
> > > like
> > > 
> > >   % cksum 
> > > 
> > > and could obtain a checksum - so it _seems_ to work.
> > > After alteration of one file within the hierarchy a
> > > different result was printed.
> > > 
> > > Tested on OS version 8.2-STABLE/i386, one year old.
> > > 
> > 
> > 
> > I think I tried something like your second example last night.
> > I think I did
> > 
> > % cksum foodir/*
> 
> That lets the shell expand * to the content of foodir, making
> a final command line like "cksum foodir/file1 foodir/file2"
> and so on. If you omit the /* part, the directory will be
> checksummed entirely. If you then remove a file or change
> it, a different checksum will be printed. At least that is
> my interpretation of what I've tested.
> 
> 
> 
> > if there isn't anything that can compare entire dirs, it looks like
> > it's time to hack a small program.  tx, polyt.
> 
> The Midnight Commander has a function to compare directories
> which will also identify _which_ files have changed (unlike
> the command "cksum foodir" that will tell you _that_ a file
> has been changed) and use the "mark file" function to highlight
> those files. It can be accessed by putting one directory into
> the left, the other one into the right panel, and then F9 C C
> (or Ctrl-X D). You are then presented a selection:
> 
>   + Compare directories -+
>   | Select compare method:   |
>   |  |
>   |  [ Quick ]  [ Size only ]  [ Thorough ]  [ Cancel ]  |
>   +--+
> 
> Quick = file names, Size only = file sizes, Thorough = file
> content.
> 


I'm not concerned about a file having been changed, just whether

   % cp -rp /home/klinebak/foodir   /home/kline/

is 100% reliable.  down to the bit!  a friend has volunteered
to take over my system admin chores.  he left my drive fragmented 
and while I am going over /home/klinebak with extreme caution--
getting rid of dross while coping everything valid to my new 
/home/ dir.  im hoping that the cp utility is flawless and/or 
that the drive to this duo/dual-CPU computer is good.   I'm 
buying a new Dell 4-CPU new.  Should have everything setup in a
couple weeks.  Oh, and in addition to klinebak, there are 
fragments of my backup systems all over the place.

Higgsbo, give me strength!
> 
> 
> -- 
> Polytropon
> Magdeburg, Germany
> Happy FreeBSD user since 4.0
> Andra moi ennepe, Mousa, ...
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread Colin Barnabas
On Tue, Sep 11, 2012 at 05:24:08PM -0700, Gary Kline wrote:
> On Wed, Sep 12, 2012 at 01:14:43AM +0200, Polytropon wrote:
> > On Tue, 11 Sep 2012 14:38:04 -0700, Gary Kline wrote:
> > > 
> > > I'm trying to checksum directories as I move them around.
> > > ive read the man page for sum and cksum ... or maybe skimmed 
> > > them.  no joy.  anybody know of a utility to do this?  I've 
> > > got files that are decades old... 
> > 
> > Maybe it's possible to tar the directory (without
> > compression of course) and obtain a checksum of
> > the tar archive?
> > 
> > % tar cf -  | cksum
> > 
> > But I also tried cksum directly with a directory
> > like
> > 
> > % cksum 
> > 
> > and could obtain a checksum - so it _seems_ to work.
> > After alteration of one file within the hierarchy a
> > different result was printed.
> > 
> > Tested on OS version 8.2-STABLE/i386, one year old.
> > 
> 
> 
>   I think I tried something like your second example last night.
>   I think I did
> 
>   % cksum foodir/*
> 
>   and had to compare each file from another file I was copying from.
>   it was tiresome to check each of dozens of files tho. I was here at 
>   desk for something obscene -- over 12 hrs. getting my new [slightly
>   used:)] computer back to normal.  
> 
>   if there isn't anything that can compare entire dirs, it looks like
>   it's time to hack a small program.  tx, polyt.
> 
>   gary
> 
> 
> > 
> > -- 
> > Polytropon
> > Magdeburg, Germany
> > Happy FreeBSD user since 4.0
> > Andra moi ennepe, Mousa, ...
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

This works for me:

$ find foo/ -type f -print0 | xargs -0 md5 >> foo.md5

Maybe for you as well? Hope I could help.

-- 
Colin Barnabas
 _
( ) ACII Ribbon Campaign - www.asciiribbon.org
 X  No HTML/RTF in E-mail
/ \ Respect for open standards

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread Noel
On 9/11/2012 7:48 PM, Polytropon wrote:
>
>   I think I tried something like your second example last night.
>   I think I did
>
>   % cksum foodir/*
> That lets the shell expand * to the content of foodir, making
> a final command line like "cksum foodir/file1 foodir/file2"
> and so on. If you omit the /* part, the directory will be
> checksummed entirely. If you then remove a file or change
> it, a different checksum will be printed. At least that is
> my interpretation of what I've tested.


I think that command checksums the *directory block*, not the same
as a combined checksum of all the files, and probably not useful for
verifying if all files have been copied/moved correctly to a
different directory.


> The Midnight Commander has a function to compare directories
> which will also identify _which_ files have changed (unlike

Yes, much more promising.



  -- Noel Jones
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread Polytropon
On Tue, 11 Sep 2012 17:24:08 -0700, Gary Kline wrote:
> On Wed, Sep 12, 2012 at 01:14:43AM +0200, Polytropon wrote:
> > On Tue, 11 Sep 2012 14:38:04 -0700, Gary Kline wrote:
> > > 
> > > I'm trying to checksum directories as I move them around.
> > > ive read the man page for sum and cksum ... or maybe skimmed 
> > > them.  no joy.  anybody know of a utility to do this?  I've 
> > > got files that are decades old... 
> > 
> > Maybe it's possible to tar the directory (without
> > compression of course) and obtain a checksum of
> > the tar archive?
> > 
> > % tar cf -  | cksum
> > 
> > But I also tried cksum directly with a directory
> > like
> > 
> > % cksum 
> > 
> > and could obtain a checksum - so it _seems_ to work.
> > After alteration of one file within the hierarchy a
> > different result was printed.
> > 
> > Tested on OS version 8.2-STABLE/i386, one year old.
> > 
> 
> 
>   I think I tried something like your second example last night.
>   I think I did
> 
>   % cksum foodir/*

That lets the shell expand * to the content of foodir, making
a final command line like "cksum foodir/file1 foodir/file2"
and so on. If you omit the /* part, the directory will be
checksummed entirely. If you then remove a file or change
it, a different checksum will be printed. At least that is
my interpretation of what I've tested.



>   if there isn't anything that can compare entire dirs, it looks like
>   it's time to hack a small program.  tx, polyt.

The Midnight Commander has a function to compare directories
which will also identify _which_ files have changed (unlike
the command "cksum foodir" that will tell you _that_ a file
has been changed) and use the "mark file" function to highlight
those files. It can be accessed by putting one directory into
the left, the other one into the right panel, and then F9 C C
(or Ctrl-X D). You are then presented a selection:

+ Compare directories -+
| Select compare method:   |
|  |
|  [ Quick ]  [ Size only ]  [ Thorough ]  [ Cancel ]  |
+--+

Quick = file names, Size only = file sizes, Thorough = file
content.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread Gary Kline
On Wed, Sep 12, 2012 at 01:14:43AM +0200, Polytropon wrote:
> On Tue, 11 Sep 2012 14:38:04 -0700, Gary Kline wrote:
> > 
> > I'm trying to checksum directories as I move them around.
> > ive read the man page for sum and cksum ... or maybe skimmed 
> > them.  no joy.  anybody know of a utility to do this?  I've 
> > got files that are decades old... 
> 
> Maybe it's possible to tar the directory (without
> compression of course) and obtain a checksum of
> the tar archive?
> 
>   % tar cf -  | cksum
> 
> But I also tried cksum directly with a directory
> like
> 
>   % cksum 
> 
> and could obtain a checksum - so it _seems_ to work.
> After alteration of one file within the hierarchy a
> different result was printed.
> 
> Tested on OS version 8.2-STABLE/i386, one year old.
> 


I think I tried something like your second example last night.
I think I did

% cksum foodir/*

and had to compare each file from another file I was copying from.
it was tiresome to check each of dozens of files tho. I was here at 
desk for something obscene -- over 12 hrs. getting my new [slightly
used:)] computer back to normal.  

if there isn't anything that can compare entire dirs, it looks like
it's time to hack a small program.  tx, polyt.

gary


> 
> -- 
> Polytropon
> Magdeburg, Germany
> Happy FreeBSD user since 4.0
> Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: cksum entire dir??

2012-09-11 Thread Polytropon
On Tue, 11 Sep 2012 14:38:04 -0700, Gary Kline wrote:
> 
> I'm trying to checksum directories as I move them around.
> ive read the man page for sum and cksum ... or maybe skimmed 
> them.  no joy.  anybody know of a utility to do this?  I've 
> got files that are decades old... 

Maybe it's possible to tar the directory (without
compression of course) and obtain a checksum of
the tar archive?

% tar cf -  | cksum

But I also tried cksum directly with a directory
like

% cksum 

and could obtain a checksum - so it _seems_ to work.
After alteration of one file within the hierarchy a
different result was printed.

Tested on OS version 8.2-STABLE/i386, one year old.


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"