OSDN Git Service

Don't try to guess the build id type in file(1).
authorElliott Hughes <enh@google.com>
Tue, 5 Jul 2016 20:39:42 +0000 (13:39 -0700)
committerRob Landley <rob@landley.net>
Tue, 5 Jul 2016 22:29:06 +0000 (17:29 -0500)
They're really just arbitrary byte sequences of arbitrary length.
Sure, a 20-byte sequence is _probably_ a SHA-1, but there's no way
to know, so let's stop pretending...

toys/posix/file.c

index d3e80f4..0cd9047 100644 (file)
@@ -136,7 +136,7 @@ static void do_elf_file(int fd, struct stat *sb)
 
         if (n_namesz==4 && !memcmp(note+12, "GNU", 4)) {
           if (n_type == 3 /*NT_GNU_BUILD_ID*/) {
-            printf(", BuildID[%s]=", (n_descsz==20)?"sha1":"md5");
+            printf(", BuildID=");
             for (j = 0; j < n_descsz; ++j) printf("%02x", note[16 + j]);
           }
         } else if (n_namesz==8 && !memcmp(note+12, "Android", 8)) {