Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: cafebabe python macosx easter egg?

Reply
Thread Tools

Re: cafebabe python macosx easter egg?

 
 
Chris Rebert
Guest
Posts: n/a
 
      02-11-2013
On Sun, Feb 10, 2013 at 10:10 PM, Rodrick Brown <(E-Mail Removed)> wrote:
> Subject: cafebabe python macosx easter egg?
>
> $ hexdump -n4 -C $(which python) | awk '{print $2 $3 $4 $5 }'

cafebabe

~ $ # Huh. Let's google...
http://en.wikipedia.org/wiki/Hexspeak :
"0xCAFEBABE ("cafe babe") is used by Mach-O to identify Universal
object files, and by the Java programming language to identify Java
bytecode class files."


Some background:

http://en.wikipedia.org/wiki/Mach-O : "Mach-O […] is a file format for
executables […] used by most systems based on the Mach kernel" (OS X's
kernel is based on the Mach kernel.)

http://en.wikipedia.org/wiki/Universal_binary :
"A universal binary is, in Apple parlance, an executable file or
application bundle that runs natively on either PowerPC or […] Intel
64-based Macintosh computers; it is an implementation of the concept
more generally known as a fat binary."


Confirmation:

"OS X ABI Mach-O File Format Reference":
https://developer.apple.com/library/...reference.html
:
struct fat_header
[...]
Fields:
magic
An integer containing the value 0xCAFEBABE in big-endian byte order format.


So, there you have it. Mach-O and Java bytecode just happen to use the
same magic number. Coincidence.

Cheers,
Chris R.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: cafebabe python macosx easter egg? Chris Angelico Python 0 02-11-2013 06:30 AM
cafebabe python macosx easter egg? Rodrick Brown Python 0 02-11-2013 06:10 AM
Path python versions and Macosx andrea Python 4 05-20-2007 03:02 PM
MySQLdb-python how to install on MacOsX Steve Python 1 12-16-2005 08:16 PM
Python-libnjb on macosx Timothy Grant Python 1 02-11-2005 12:08 AM



Advertisments