|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Directory csum / cksum
I've created a directory in /tmp/csum-test on AIX 6.1. Then another under AIX 7.1 host called /tmp/csum-test. There is no files in the directories.
When I run csum -h SHA1 /tmp/csum-test on AIX 6.1 host it gives me a different value then if I run csum -h SHA1 /tmp/csum-test under the AIX 7.1 host. Granted the csum binaries are different however should csum have reported a different value and what is it including in it's comparisons for directories and files? In simpler terms, what is this command comparing? I've searched around but couldn't find an answer that explicitly outlines the logic. Cheers, Tom |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Hi, Code:
man csum The csum command calculates a message digest for the specified files using the specified hash algorithm. Code:
man cksum Displays the checksum and byte count of a file. Doesn't work on directories. Regards |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
The reason it does not work on directories is because a very vital part of a directory entry is the first two bytes which is the inode number of an entry. The first two entries of a directory are named . and .. So, if either inode numbers are different csum and/or cksum will report generally report different values. Code:
od -dc /some/directory read: octalDump -decimalCharacter /some/directory This will output two lines for each entry in the directory /some/directory The first line: first number is the inode number; second line (ignore first two values (are inode number in character notation) - remaining bytes are the file/directory name) Example: Code:
michael@x054:[/]ls -lid /x /y
17424 drwxr-xr-x 2 pconsole pconsole 256 May 15 2012 /x
20576 drwxr-x--- 2 root system 256 Feb 11 16:00 /y
michael@x054:[/]od -dc /x
0000000 17424 11776 0 0 0 0 0 0
D 020 . \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000020 2 11822 0 0 0 0 0 0
\0 002 . . \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000040
michael@x054:[/]od -dc /y
0000000 20576 11776 0 0 0 0 0 0
P ` . \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000020 2 11822 0 0 0 0 0 0
\0 002 . . \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000040Hope this helps/explains WHY cksum/csum does not work on directories. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| command to find cksum of all files inside a directory? | ezee | UNIX for Dummies Questions & Answers | 3 | 11-10-2011 11:11 PM |
| cksum for all files in home directory | moe458 | UNIX for Advanced & Expert Users | 4 | 09-29-2010 05:15 PM |
| Cksum dependencies | vibhor_agarwali | UNIX for Advanced & Expert Users | 3 | 09-05-2007 02:38 AM |
| using cksum | leeRoberts2007 | Shell Programming and Scripting | 4 | 05-31-2007 09:30 PM |
| cksum question | rjsha1 | Shell Programming and Scripting | 4 | 01-17-2006 10:44 AM |
|
|