3 ms·
Not really. Consider the case where are editing a configuration file for some service, need to type a file path, and drag in a folder from the Finder instead.
by Someone 7y ago
Not really. Consider the case where are editing a configuration file for some service, need to type a file path, and drag in a folder from the Finder instead.
Even simpler, if you write a small shell script with a hard-coded path in it that you run occasionally, you expect that script to keep running even across reboots. That means that, _if Terminal.app automatically adds a permission_, that permission has to be fairly permanent.
In both cases, under your suggested solution, both scripts would work when you test them, and then silently break when you close the terminal window.
I do wonder whether Terminal.app should automatically add that permission, though. If, instead of using emacs/pico/nano/vim, you use a GUI app to edit that script, that doesn’t happen, either, does it?
- pcr910303 7y agoActually, that wouldn't work; AFAIK the binary that executes the script needs to have permission, so for example if you're adding a cron script cron has to have the permission, not the Terminal.app, since the cron script running has nothing to do with Terminal.app. It's confusing. :-(
- oldmanhorton 7y agoThis is not always the case though - in order to run some applescripts, you need accessibility permissions... But you grant that to terminal.app, not applescript or not even bash that invokes applescript
- Someone 7y agoYou probably are right about that, but it can’t be fully correct. If I type “cat ”, drag in a file, and hit return, it isn’t Terminal.app that reads the file, but cat, launched by my shell (and that’s the simple case; nothing forbids me from nesting a few shells, a few sudo’s, etc. before accessing a file) ⇒ this special permission must either directly apply to all command-line tools or always be inherited on fork and/or execve (it cannot require a magic system call, as the command-line tool reading or writing data might not be Apple-supplied) I can see how opening this door “just long enough” gets hairy very easily. So, as others suggest, this may have been implemented as a “OK, let’s do it this way for now, and try and figure out whether we can better later”.