The binaries are all but identical:
diff -u <(hexdump -C /bin/uname) <(hexdump -C /usr/bin/arch)
--- /dev/fd/63 2011-12-07 11:38:18.344027319 +0100
+++ /dev/fd/62 2011-12-07 11:38:18.344027319 +0100
@@ -38,8 +38,8 @@
00000250 6f 2e 32 00 04 00 00 00 10 00 00 00 01 00 00 00 |o.2.............|
00000260 47 4e 55 00 00 00 00 00 02 00 00 00 06 00 00 00 |GNU.............|
00000270 0f 00 00 00 04 00 00 00 14 00 00 00 03 00 00 00 |................|
-00000280 47 4e 55 00 7a 96 5e a8 ad 05 ae 51 d7 26 8a fa |GNU.z.^....Q.&..|
-00000290 bd 1a a6 ca 5a b3 02 dc 25 00 00 00 2a 00 00 00 |....Z...%...*...|
+00000280 47 4e 55 00 fd 70 a8 c1 df cc 73 cb 78 c6 a5 77 |GNU..p....s.x..w|
+00000290 04 d1 36 af 91 e8 3f 7d 25 00 00 00 2a 00 00 00 |..6...?}%...*...|
000002a0 18 00 00 00 19 00 00 00 22 00 00 00 00 00 00 00 |........".......|
000002b0 14 00 00 00 00 00 00 00 1b 00 00 00 00 00 00 00 |................|
000002c0 26 00 00 00 28 00 00 00 0a 00 00 00 00 00 00 00 |&...(...........|
@@ -1315,10 +1315,10 @@
000060f0 3e 10 40 00 00 00 00 00 4e 10 40 00 00 00 00 00 |>.@.....N.@.....|
00006100 5e 10 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |^.@.............|
00006110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
-00006120 01 00 00 00 00 00 00 00 00 41 40 00 00 00 00 00 |.........A@.....|
+00006120 02 00 00 00 00 00 00 00 00 41 40 00 00 00 00 00 |.........A@.....|
00006130 40 61 60 00 00 00 00 00 01 00 00 00 00 00 00 00 |@a`.............|
00006140 00 01 00 00 00 00 00 00 20 62 60 00 00 00 00 00 |........ b`.....|
-00006150 01 00 00 00 75 6e 61 6d 65 00 00 00 79 ac e0 1f |....uname...y...|
+00006150 01 00 00 00 61 72 63 68 00 00 00 00 d2 34 36 6a |....arch.....46j|
00006160 00 2e 73 68 73 74 72 74 61 62 00 2e 69 6e 74 65 |..shstrtab..inte|
00006170 72 70 00 2e 6e 6f 74 65 2e 41 42 49 2d 74 61 67 |rp..note.ABI-tag|
00006180 00 2e 6e 6f 74 65 2e 67 6e 75 2e 62 75 69 6c 64 |..note.gnu.build|
This was discovered because of another Q&A which mentioned the similarity in functionality.
Since these are essentially identical, why are there two of them? Why not just use a symlink (especially since one is in /usr/bin)?
-m
option touname
to obtain the same behavior. I would see intocoreutils
sources. – enzotib Dec 07 '11 at 10:59uname
could just checkbasename "$0"
- If it'sarch
, then act likeuname -m
. But of course you could create another symlink calleduname
to that symlink, and you'd be back where you started. – l0b0 Dec 07 '11 at 11:54basename
, in C (coreutils) forargv[0]
. Why it is done differently I don't know (the 'symlink' approach would save some space). – arrange Dec 07 '11 at 12:23