I tried this tool with an IPS file produced by Adobe Acrobat, and I am very confused by the result.
Originally I got the "Unable to read file" error, and applied this working patch to get a little better error handling:
--- a/tool_ips2crash/ips2crash/main.m
+++ b/tool_ips2crash/ips2crash/main.m
@@ -19,6 +19,8 @@
#include <sys/types.h>
#include <unistd.h>
+
+#include <err.h>
#include <getopt.h>
void usage(void);
@@ -125,20 +127,19 @@ int main(int argc, const char * argv[])
switch(tError.code)
{
case NSFileReadNoSuchFileError:
-
+ perror("huh?");
(void)fprintf(stderr, "'%s': No such file.\n",tIPSFile.fileSystemRepresentation);
break;
case NSFileReadNoPermissionError:
-
+ perror("huh?");
(void)fprintf(stderr, "'%s': Permission denied.\n",tIPSFile.fileSystemRepresentation);
break;
default:
-
- (void)fprintf(stderr, "'%s': Unable to read file.\n",tIPSFile.fileSystemRepresentation);
+ warn("'%s': Unable to read file (%ld)", tIPSFile.fileSystemRepresentation, tError.code);
break;
}
And I get this behavior:
jhawk@lrr Debug % ls -ld b.ips
-rw-r--r-- 1 jhawk staff 48289 May 27 13:26 b.ips
jhawk@lrr Debug % ./ips2crash test-no-file
huh?: No such file or directory
'test-no-file': No such file.
jhawk@lrr Debug % ./ips2crash b.ips
ips2crash: 'b.ips': Unable to read file (3840): No such file or directory
jhawk@lrr Debug %
Which I don't understand. Obviously NSFileReadNoSuchFileError
isn't being returned, and the file is present, but there is still a similar error.
This seems to have something to do with the file format, since
jhawk@lrr Debug % cp b.ips b.json
jhawk@lrr Debug % ./ips2crash b.json
ips2crash: 'b.json': Unable to read file (3840): No such file or directory
jhawk@lrr Debug % jq < b.ips > b.json
parse error: Invalid numeric literal at line 305, column 4
jhawk@lrr Debug % ./ips2crash b.json
'b.json': An error occurred when reading the .ips file.
Invalid type of value for key: (null).
jhawk@lrr Debug %
That is, first I copy the file to demonstate that the file extension is unrelated. Then I use jq
to parse the JSON file, which does report that the JSON is malformed in some way. But the re-parsed JSON doesn't work either (although the error makes a little more sense, but not really).
Inspecting the file, the jq JSON error ("Invalid numeric literal at line 305, column 4") is because the file ends like this:
299 "experiments" : [
300
301 ]
302 }
303 }
304
305 RAM: 65536MB
306 Machine: arm64
307 Model: MacBookPro18,4
308 CPU * Core count: 10
309 CPU Frequency: 0MHz
310 Bus Frequency: 0MHz
311 Open GL Renderer: Apple M1 Max
312 Open GL Version: 2.1 Metal - 76.3
313 Open GL Vendor: Apple
...
so there's some plain text information appended to this file.
But jq
ends up stripping that out, leaving what seems like a valid IPS JSON file, and yet it still doesn't work for ips2crash
.
Curiously, if I strip out the out the non-JSON text at the end:
jhawk@lrr Debug % head -304 b.ips > b304.ips
jhawk@lrr Debug % ./ips2crash b304.ips|head
Process: AdobeAcrobat [7389]
Path: /Applications/Adobe Acrobat Beta/Adobe Acrobat.app/Contents/MacOS/AdobeAcrobat
Identifier: com.adobe.Acrobat.Pro
Version: 22.001.10171 (22.001.10171)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2022-05-26 07:25:27.532 -04:00
OS Version: macOS 12.3.1 (21E258)
jhawk@lrr Debug %
it seems to work fine [Yay!]. Yet this should be functionally equivalent to what jq
does. Indeed:
jhawk@lrr Debug % jq < b304.ips > b304.json
jhawk@lrr Debug % ls -l b.json b304.json
-rw-r--r-- 1 jhawk staff 68796 May 27 14:37 b.json
-rw-r--r-- 1 jhawk staff 68796 May 27 14:43 b304.json
jhawk@lrr Debug % diff b.json b304.json
jhawk@lrr Debug % ./ips2crash b304.json
'b304.json': An error occurred when reading the .ips file.
Invalid type of value for key: (null).
jhawk@lrr Debug %
I think I'm not at liberty to share the Acrobat crash report here, but it looks like this problem happens anytime an IPS file is reformatted via jq
. Here's a crash from Preview.app that I have attached:
jhawk@lrr Debug % jq < Preview-2022-05-24-100028.ips > Preview-2022-05-24-100028.json
jhawk@lrr Debug % ls -l Preview-2022-05-24-100028.*
-rw-------@ 1 jhawk staff 21400 May 27 14:31 Preview-2022-05-24-100028.ips
-rw-r--r-- 1 jhawk staff 27616 May 27 14:44 Preview-2022-05-24-100028.json
jhawk@lrr Debug % ./ips2crash Preview-2022-05-24-100028.json
'Preview-2022-05-24-100028.json': An error occurred when reading the .ips file.
Invalid type of value for key: (null).
jhawk@lrr Debug % ./ips2crash Preview-2022-05-24-100028.ips| head
Process: Preview [94083]
Path: /System/Applications/Preview.app/Contents/MacOS/Preview
Identifier: com.apple.Preview
Version: 11.0 (1033.3)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2022-05-24 10:00:25.573 -04:00
OS Version: macOS 12.3.1 (21E258)
jhawk@lrr Debug %
Workaround
Oh hey, it turns out jq
has a "compact" option (-c
) which appears to produce output that works fine with ips2crash
. So, e.g.:
jhawk@lrr Debug % jq -c < b.ips > b.cjson
jhawk@lrr Debug % ./ips2crash b.cjson| sed -ne 2d -e 4d -e 1,10p
Process: AdobeAcrobat [7389]
Identifier: com.adobe.Acrobat.Pro
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2022-05-26 07:25:27.532 -04:00
OS Version: macOS 12.3.1 (21E258)
jhawk@lrr Debug %