The Mystery of the Supranational Rabbit (porsupah) wrote,
The Mystery of the Supranational Rabbit

  • Mood:

Parse nip

I'm only vaguely aware of Perl, sad to say, though I'm finally getting around to picking up bits and pieces. So, this script has me a little puzzled. Any Perl guru feel like offering a smidgen of assistance?

file, as you may know, offers up information about what kind of file a particular file actually is. In this case, the output from file is:

/Users/porsupah/Development/ iPhone/Cocoa is my Girlfriend - First App demo/Basic iPhone App/build/Debug-iphoneos/Basic iPhone iPhone App: Mach-O executable arm

(Cocoa is my Girlfriend being the name of the site which offered up this handy starter tutorial for iPhone development)

The script, by one Tiku, gained from a thread on Apple's discussion boards:


for($b=0;$b<$#ARGV;$b++) {
if($ARGV[$b] eq "-s") {

$mums=`/usr/bin/file $realAppName`;
if($sign==1) {
print "codesign debug: we are attempting to sign a file.\n";
if($mums=~/executable arm/) {
print "codesign debug: verified the file is an ARM executable.\n";
if(($sign==1) && ($mums=~/executable arm/)) {
print "Signing armv6 new style..\n";
`$dev/lipo -create $realAppName -output $tmp`;
`mv $tmp $realAppName`;
`$dev/lipo -thin armv6 $realAppName -output $tmp`;
`mv $tmp $realAppName`;
system("rm $appDir"."/CodeResources");
system("cp $appDir"."/_CodeSignature/CodeResources $appDir"."/CodeResources");
exit 0;
} else {
print "Signing armv6 old style..\n";
exec '/usr/bin/codesign.orig',@ARGV;

So, the problem at paw: the hack is carried out if both conditions are true - we're passing the -s option in, and the file we want to sign is an ARM executable. I see the first debug output, noting the -s flag, but not the second. Why? Certainly, the output given should match the condition specified, executable arm, so is $mums not being assigned correctly?
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.