blampe / taskwarrior-reminders

Synchronize Taskwarrior with iOS Reminders
MIT License
76 stars 7 forks source link

Hard-coded /usr/local/bin/task incompatible with M1 Apple Silicon homebrew-installed taskwarrior #6

Closed jacobgreenleaf closed 3 years ago

jacobgreenleaf commented 3 years ago

It appears that taskwarrior-reminders uses a hard-coded path for the location of the task binary that is (for the moment) incompatible with the default installation directory for Homebrew-installed taskwarrior on M1 Apple Silicon machines.

The existing code is hard-coded to /usr/local/bin/task. Since https://github.com/Homebrew/brew/pull/9117, the suggested default installation directory for Homebrew is /opt/homebrew, which places task in /opt/homebrew/bin/task, rather than where this tool expects it.

This manifests in the launchd process crash-looping:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'launch path not accessible'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000186e3e320 __exceptionPreprocess + 240
    1   libobjc.A.dylib                     0x0000000186b6cc04 objc_exception_throw + 60
    2   Foundation                          0x0000000187bcdd3c -[NSConcreteTask launchWithDictionary:error:] + 4548
    3   task-reminders-sync                 0x0000000100888650 $s12Repositories21TaskwarriorRepositoryC04execB033_34B1B378C6FD518C2F80C60344E1C084LL4args5input10Foundation4DataVSgSaySSG_6Models4TaskCSgtFTf4nnd_n + 1348
    4   task-reminders-sync                 0x0000000100882684 $s12Repositories21TaskwarriorRepositoryC13syncWithTaskdyyF + 56
    5   task-reminders-sync                 0x00000001008a30e4 $s4Sync19TaskwarriorObserverC_9syncSince4lockAC12Repositories19RemindersRepositoryC_10Foundation4DateVSo21OS_dispatch_semaphoreCtcfcTf4gngn_n + 128
    6   task-reminders-sync             <…>

Symbolic linking task into /usr/local/bin/task solves the immediate problem:

# ln -s /opt/homebrew/bin/task /usr/local/bin/task

It seems like this is a change that Homebrew is going to stick with, as they're preferring not to mix native arm64 executables with x86-64 executables, in the same directory, so there may need to be some degree of variation of this path to support M1 Silicon Macs.

blampe commented 3 years ago

Hey Jacob! Great catch. I’m jealous of your M1 🙂 I’ll try to get to this soon.

On Wed, Mar 10, 2021 at 12:13 Jacob Greenleaf @.***> wrote:

It appears that taskwarrior-reminders uses a hard-coded path for the location of the task binary that is (for the moment) incompatible with the default installation directory for Homebrew-installed taskwarrior on M1 Apple Silicon machines.

The existing code https://github.com/blampe/taskwarrior-reminders/blob/master/Sources/Repositories/Taskwarrior.swift#L96 is hard-coded to /usr/local/bin/task. Since Homebrew/brew#9117 https://github.com/Homebrew/brew/pull/9117, the suggested default installation directory for Homebrew is /opt/homebrew, which places task in /opt/homebrew/bin/task, rather than where this tool expects it.

This manifests in the process crash-looping:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'launch path not accessible'

*** First throw call stack:

(

0 CoreFoundation 0x0000000186e3e320 __exceptionPreprocess + 240

1 libobjc.A.dylib 0x0000000186b6cc04 objc_exception_throw + 60

2 Foundation 0x0000000187bcdd3c -[NSConcreteTask launchWithDictionary:error:] + 4548

3 task-reminders-sync 0x0000000100888650 $s12Repositories21TaskwarriorRepositoryC04execB033_34B1B378C6FD518C2F80C60344E1C084LL4args5input10Foundation4DataVSgSaySSG_6Models4TaskCSgtFTf4nnd_n + 1348

4 task-reminders-sync 0x0000000100882684 $s12Repositories21TaskwarriorRepositoryC13syncWithTaskdyyF + 56

5 task-reminders-sync 0x00000001008a30e4 $s4Sync19TaskwarriorObserverC_9syncSince4lockAC12Repositories19RemindersRepositoryC_10Foundation4DateVSo21OS_dispatch_semaphoreCtcfcTf4gngn_n + 128

6 task-reminders-sync <…>

Symbolic linking task into /usr/local/bin/task solves the immediate problem:

ln -s /opt/homebrew/bin/task /usr/local/bin/task

It seems like this is a change that Homebrew is going to stick with, as they're preferring not to mix native arm64 executables with x86-64 executables, in the same directory, so there may need to be some degree of variation of this path to support M1 Silicon Macs.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/blampe/taskwarrior-reminders/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGPHSYW3IFAWGFZNEVXR2LTC7AERANCNFSM4Y6ZJJHA .