[csw-maintainers] Determining the architecture of a binary

Sebastian Kayser skayser at opencsw.org
Wed Jan 13 12:07:54 CET 2010


Hi Maciej,

* Maciej (Matchek) Blizinski <maciej at opencsw.org> wrote:
> I'd like to write a new check, to make sure that the actual binaries
> inside a package match the architecture declared in the pkginfo file.
> Unfortunately, the file command's output is not as reliable as I'd
> like it to.  For instance, on build8s, it can tell when a binary is
> i386, but it doesn't say the same about an amd64 binary.
> 
> maciej at build8s [build8s]:~ > file
> ~maciej/src/opencsw/pkg/mysql5/branches/mysql-5.0.x/work/solaris8-i386/install-isa-i386/opt/csw/mysql5/bin/mysql
> | cut -d: -f2
>         ELF 32-bit LSB executable 80386 Version 1, dynamically linked, stripped
> maciej at build8s [build8s]:~ > file
> ~maciej/src/opencsw/pkg/mysql5/branches/mysql-5.0.x/work/solaris8-i386/install-isa-amd64/opt/csw/mysql5/bin/amd64/mysql
> | cut -d: -f2
>         ELF 64-bit LSB executable Version 1, dynamically linked, stripped
> 
> We don't have our own, up-to-date file (or gfile), do we?
> 
> Is there a better way of determining binary's architecture? (/usr/ccs/bin/dump?)

great to see that you are enhancing the checks. The more we do catch
upfront the better it is for all involved people (maintainer and release
manager).

You could have a look at the ELF header via elfdump. All outputs are
from build8s.

$ /usr/ccs/bin/elfdump -e ~maciej/src/opencsw/pkg/mysql5/branches/mysql-5.0.x/work/solaris8-i386/install-isa-i386/opt/csw/mysql5/bin/mysql | grep e_machine
  e_machine:  EM_386              e_version:    EV_CURRENT

$ /usr/ccs/bin/elfdump -e ~maciej/src/opencsw/pkg/mysql5/branches/mysql-5.0.x/work/solaris8-i386/install-isa-amd64/opt/csw/mysql5/bin/amd64/mysql | grep e_machine
  e_machine:  EM_AMD64            e_version:    EV_CURRENT

$ /usr/ccs/bin/elfdump -e ~maciej/src/opencsw/pkg/mysql5/branches/mysql-5.0.x/work/solaris8-sparc/install-isa-sparcv8/opt/csw/mysql5/bin/mysql | grep e_machine
  e_machine:  EM_SPARC            e_version:    EV_CURRENT

$ /usr/ccs/bin/elfdump -e ~maciej/src/opencsw/pkg/mysql5/branches/mysql-5.0.x/work/solaris8-sparc/install-isa-sparcv9/opt/csw/mysql5/bin/sparcv9/mysql | grep e_machine
  e_machine:  EM_SPARCV9          e_version:    EV_CURRENT

Sebastian



More information about the maintainers mailing list