executable LaunchDaemons plist
Michael Crawford
mdcrawford at gmail.com
Tue Jan 26 22:42:00 PST 2010
Just for grins I just tried the following on Ubuntu:
$ cat runme.plist
<xml>
<foo>
<bar>This is some text</bar>
<baz boo="This is an attribute value">But this isn't</baz>
</foo>
$ chmod +x runme.plist
$ ./runme.plist
./runme.plist: line 1: syntax error near unexpected token `newline'
./runme.plist: line 1: `<xml>'
I would expect Mac OS X to complain in a similar way.
Strictly speaking, executable programs on *NIX systems are expected to
begin with a "Magic Number" that identifies the type of executable
machine code they consist of.
In my younger, less bald and overweight days I did tech support at
Microport Systems. Our founder Chuck Hickey had ported AT&T SystemV
UNIX to the 80286 AT. Our SystemV/AT ran 16-bit UNIX code that worked
much like 16-bit DOS code - there was small model, and large model,
and huge model, and segment and offset registers and so on.
(Be grateful for the good things you have, kids.)
We were always fielding calls about the error message "Bad Magic".
True to UNIX tradition, it identified the problem without giving you
the first clue as to what went wrong or what to do about it. "Bad
Magic" meant that you were trying to link two or more object files or
libraries that were built with different memory models, and so had
different Magic Numbers.
Anyway, the Magic Number for a script that is to be executed by some
kind of interpreter is, when expressed as ASCII:
#!
Immediately following the Magic Number was required to be the path to
the interpreter's executable file:
#!/bin/sh
or
#!/usr/bin/perl
The interpreter would then be exec'ed and fed the script as its input.
Somehow though #! lost all its Magic somewhere along the way. I don't
think the kernel uses it as a binary executable Magic Number at all
anymore.
So my guess is that if an executable doesn't start out with one of the
well-known machine code Magic Numbers, and it doesn't start out with
Pound-Sign Bang Path Name, then the kernel just assumes it's a Bourne
Shell script.
So to the extent that your property lists don't run when executed by
the Bourne Shell or by Bash, there shouldn't be any problems.
Hope That Helps,
Mike
--
Michael David Crawford
mdcrawford at gmail dot com
GoingWare's Bag of Programming Tricks
http://www.goingware.com/tips/
More information about the macports-dev
mailing list