AutoDMG icon indicating copy to clipboard operation
AutoDMG copied to clipboard

progresswatcher crashes with NSRunLoop error

Open MagerValp opened this issue 5 years ago • 3 comments

Originally posted by @rickheil in https://github.com/MagerValp/AutoDMG/issues/232#issuecomment-498851230

When running with sudo and passing -r:

2019-06-04 17:28:32.126 AutoDMG[12957:144790] TMPDIR is not set
Running as root, using /var/root/Library/Application Support/AutoDMG
AutoDMG v1.9 build 578
Mac OS X 10.15 19A471t
CPython 2.7.10 (GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.21.8))
PyObjC 2.5.1
Setting source path to '/Volumes/Install macOS 10.15 Beta/Install macOS 10.15 Beta.app'
Setting output path to '/Users/onepath/Desktop/test.apfs'
Setting volume name to 'Testing'
Setting volume size to '100'
Installer: /Volumes/Install macOS 10.15 Beta/Install macOS 10.15 Beta.app
Examining source…
Found source: Mac OS X 10.15 19A471t
Accepted source /Volumes/Install macOS 10.15 Beta/Install macOS 10.15 Beta.app: Mac OS X 10.15 19A471t
Found installer: Mac OS X 10.15 19A471t
Output Path: /Users/onepath/Desktop/test.apfs
Volume Name: Testing
Unrecognized filesystem setting '(null)'
Starting build
Using installer: Mac OS X 10.15 19A471t
Using output path: /Users/onepath/Desktop/test.apfs
TMPDIR is set to: (null)
Task taskPrepare with 1 phases:
    Phase 'Preparing' with weight 34.0
Task taskInstall with 4 phases:
    Phase 'Starting install' with weight 21.0
    Phase 'Creating disk image' with weight 21.0
    Phase 'Installing OS' with weight 4096.0
    Phase 'Converting disk image' with weight 313.0
Task taskFinalize with 4 phases:
    Phase 'Scanning disk image' with weight 2.0
    Phase 'Scanning disk image' with weight 1.0
    Phase 'Scanning disk image' with weight 150.0
    Phase 'Scanning disk image' with weight 17.0
Task taskFinish with 1 phases:
    Phase 'Finishing' with weight 1.0
Starting task Prepare with 1 phases
Starting phase: Preparing
phase: Preparing
progress: 0.0%
1 packages to install:
    /Volumes/Install macOS 10.15 Beta/Install macOS 10.15 Beta.app/Contents/SharedSupport/InstallInfo.plist requires 16.2 GB
Workflow requires a 16.2 GB disk image
Using a 100 GB disk image
Starting task Install with 4 phases
Phase Preparing with weight 35651584 finished after 0.007 seconds
Starting phase: Starting install
phase: Starting install
progress: 0.7%
Install task running
Launching install with arguments:
    '/Volumes/AutoDMG-1.9/AutoDMG.app/Contents/Resources/progresswatcher.py'
    '--cd'
    '/Volumes/AutoDMG-1.9/AutoDMG.app/Contents/Resources'
    '--socket'
    '/tmp/se.gu.it.IEDSocketListener.259de147ae1af35d'
    'installesdtodmg'
    '--user'
    '0'
    '--group'
    '0'
    '--fstype'
    'apfs'
    '--output'
    '/Users/onepath/Desktop/test.apfs'
    '--volume-name'
    'Testing'
    '--size'
    '100'
    '--template'
    '/tmp/tmpJcpvJy/AutoDMG-20190604.adtmpl'
    '/Volumes/Install macOS 10.15 Beta/Install macOS 10.15 Beta.app/Contents/SharedSupport/InstallInfo.plist'
Install task launched
2019-06-04 17:28:33.160 Python[12973:144959] progresswatcher launching
2019-06-04 17:28:33.160 Python[12973:144959] progresswatcher arguments: (
    "/Volumes/AutoDMG-1.9/AutoDMG.app/Contents/Resources/progresswatcher.py",
    "--cd",
    "/Volumes/AutoDMG-1.9/AutoDMG.app/Contents/Resources",
    "--socket",
    "/tmp/se.gu.it.IEDSocketListener.259de147ae1af35d",
    installesdtodmg,
    "--user",
    0,
    "--group",
    0,
    "--fstype",
    apfs,
    "--output",
    "/Users/onepath/Desktop/test.apfs",
    "--volume-name",
    Testing,
    "--size",
    100,
    "--template",
    "/tmp/tmpJcpvJy/AutoDMG-20190604.adtmpl",
    "/Volumes/Install macOS 10.15 Beta/Install macOS 10.15 Beta.app/Contents/SharedSupport/InstallInfo.plist"
)
2019-06-04 17:28:33.160 Python[12973:144959] progresswatcher uid: 0, euid: 0
2019-06-04 17:28:33.164 Python[12973:144959] progresswatcher language: en
2019-06-04 17:28:33.167 Python[12973:144959] progresswatcher uid: 0, euid: 0
2019-06-04 17:28:33.170 Python[12973:144959] progresswatcher died with an uncaught exception: Traceback (most recent call last):
  File "/Volumes/AutoDMG-1.9/AutoDMG.app/Contents/Resources/progresswatcher.py", line 363, in main
    args.func(args)
  File "/Volumes/AutoDMG-1.9/AutoDMG.app/Contents/Resources/progresswatcher.py", line 324, in installesdtodmg
    run(pwargs, args.socket, "ied")
  File "/Volumes/AutoDMG-1.9/AutoDMG.app/Contents/Resources/progresswatcher.py", line 300, in run
    pw.watchTask_socket_mode_(args, sockPath, mode)
  File "/Volumes/AutoDMG-1.9/AutoDMG.app/Contents/Resources/progresswatcher.py", line 76, in watchTask_socket_mode_
    task.launch()
ValueError: NSInvalidArgumentException - *** -scheduleInRunLoop:forMode: cannot be sent to an abstract object of class NSMachPort: Create a concrete instance!
2019-06-04 17:28:33.170 Python[12973:144959] PyObjC: Exception during dealloc of proxy: *** -removeFromRunLoop:forMode: cannot be sent to an abstract object of class NSMachPort: Create a concrete instance!
Install task finished with exit status 70
Workflow failed: Build failed (Install task failed with status 70)
Build failed: Build failed
    Install task failed with status 70

MagerValp avatar Jun 14 '19 21:06 MagerValp

This works:

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {

        NSTask *task = [[NSTask alloc] init];
        task.executableURL = [NSURL fileURLWithPath:@"/usr/bin/true"];
        [task launch];
        
        NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
        for (;;) {
            [runLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
        }
    }
    return 0;
}

This crashes:

#!/usr/bin/python

from Foundation import *

task = NSTask.alloc().init()

task.setExecutableURL_(NSURL.fileURLWithPath_("/usr/bin/true"))
task.launch()

runLoop = NSRunLoop.currentRunLoop()
while True:
    runLoop.runMode_beforeDate_(NSDefaultRunLoopMode, NSDate.distantFuture())

MagerValp avatar Jun 14 '19 21:06 MagerValp

Did you implement this fix into any code yet? I am getting this on 10.15.0 b3

cybertunnel avatar Jul 16 '19 16:07 cybertunnel

No, I don't know how to fix the crash yet.

MagerValp avatar Jul 16 '19 17:07 MagerValp