Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #38647 > unrolled thread
| Started by | Chris Rebert <clp2@rebertia.com> |
|---|---|
| First post | 2013-02-10 22:49 -0800 |
| Last post | 2013-02-10 22:49 -0800 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: cafebabe python macosx easter egg? Chris Rebert <clp2@rebertia.com> - 2013-02-10 22:49 -0800
| From | Chris Rebert <clp2@rebertia.com> |
|---|---|
| Date | 2013-02-10 22:49 -0800 |
| Subject | Re: cafebabe python macosx easter egg? |
| Message-ID | <mailman.1626.1360565395.2939.python-list@python.org> |
On Sun, Feb 10, 2013 at 10:10 PM, Rodrick Brown <rodrick.brown@gmail.com> 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/mac/#documentation/DeveloperTools/Conceptual/MachORuntime/Reference/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.
Back to top | Article view | comp.lang.python
csiph-web