Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was exploring around in the ubuntu unity terminal window when this came up:

When I typed:

file /bin/ls

the output is:

/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x214a38d0db472db559f0dabf0ae97f82fea83e03, stripped

I wanted to verify that the sha1 is correct and hence I typed this:

openssl sha1 /bin/ls

However, the output is as such:

SHA1(/bin/ls)= 8800fee57584ed1c44b638225c2f1eec818a27c2

While they are of the same length in hexadecimal, they don't seem to match. Did I miss something? Or does the BuildID[sha1] refer to something else?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Or does the BuildID[sha1] refer to something else?

BuildID is NOT the hash of a binary or related to it. It is an identifier for the "build" (or compiling) session which produced that binary. It is mostly there for debug purposes, so that the developers can look at the logs, environment, etc. from session number $BuildID and try to fix the problem, reproduce it, etc.

BTW, SHA1 hashes of anything are always 160 bits long :)

share|improve this answer
    
Thanks loads, that makes so much more sense now! Cheers :) –  Vern May 21 '12 at 12:20
    
Could this be used in build tool cache fingerprinting? For example scons could just read this id instead of having to re-calculate MD5-hashes of intermediate objects and libraries for use in dependency checking. –  Nordlöw Oct 1 '12 at 13:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.