Sequel-Ace / Sequel-Ace

MySQL/MariaDB database management for macOS
https://sequel-ace.com
Other
6.73k stars 250 forks source link

Third-party bundle not working again #1107

Closed cviebrock closed 3 years ago

cviebrock commented 3 years ago

Is Issue Present in Latest Beta? Not sure ... the latest version in Github (3.3.2 / 3030) is the same as what I just installed from the app store.

Description Running the export command from the package returns the following error message:

Error for “Export To Laravel Migration(s)”:
./parse.sh: /usr/bin/env: bad interpreter: Operation not permitted

Steps To Reproduce

  1. Install latest version of Sequel Pro Laravel Export bundle (2.0.1)
  2. Ensure SA has permission to write to ~/Desktop/SequelProLaravelExport
  3. Connect to any database and select a table in the left column
  4. Run Bundles > Export > Export to Laravel Migration(s)

Expected Behaviour ~/Desktop/SequelProLaravelExport should be populated with some PHP files, and a friendly popup should appear when the export is complete.

Related Issues

556

Additional Context Hi folks. This is a rehash of #556 as I've tried my Laravel Export bundle (v2.0.1) with the latest version of Sequel Ace from the app store.

I'm getting the same error as before, but I've ensured that:

I've also tried using the old sequelpro:// schema. I'm prompted that SA will upgrade my bundle for me, then it asks if I want to overwrite the existing bundle. I say yes, but then get a message that the bundle already exists.

10 minutes later...

I managed (somehow) to remove the bundle from SA, and reinstall the version with the correct schema. If I ensure that SA has permission to write to the desktop, the bundle appears to work:

Output directory: /Users/admin/Desktop/SequelProLaravelExport

Migration saved: 2021_05_17_204559_create_posts_table.php

Migration for foreign key saved: 2021_05_17_204600_add_foreign_key_to_posts_table.php

The output directory exists, however none of the files have been created in it.

I'm kinda unsure what's going on with this. Did something about bundles change since the app moved out of beta, maybe?

Jason-Morcos commented 3 years ago

Did this bundle work with a previous version if Sequel Ace? If so, which version? Does it work if you give Ace Full Disk Access in the macOS privacy settings?

cviebrock commented 3 years ago

Yeah, it worked fine with a previous version. Sadly, I don't remember the exact one ... one of the 3.x.x betas I believe. You can maybe tell from the time of our conversation back in #556 ?

I ran it again to check the disk access issues. I'm getting an error from the bundle:

Could not create directory: /Users/admin/Desktop/SequelProLaravelExport

This is despite me grating SA access to /Users/admin/Desktop/ via the app's preferences.

If I create that directory manually, the bundle runs, but doesn't write out those files to that directory (as I mentioned above). Giving it Full Disk Access doesn't help either.

Jason-Morcos commented 3 years ago

Two things:

1: Can you try the very latest beta and see if it works now? https://github.com/Sequel-Ace/Sequel-Ace/releases

2: If it is still broken in latest beta, are you getting that could not create directory error still even after you pre-create the directory, or are you getting a different error? Can you try opening up the permissions to the dir (chmod 777 /Users/admin/Desktop/SequelProLaravelExport) and granting Ace specific access to the /Users/admin/Desktop/SequelProLaravelExport directory? Does it work then? Additionally, can you confirm that your bundle itself isn't broken in the latest version (can you try an earlier version of your bundle)?

cviebrock commented 3 years ago

I installed the new beta, and then installed the latest version of my bundle (which doesn't require any SequelPro-to-SequelAce conversions).

Loaded a database and did a test export. It created the /Users/admin/Desktop/SequelProLaravelExport directory without issue (without needing to grant it permissions), but didn't create the file in that directory.

Tried again after opening up permissions: same thing, no file was created.

Tried again after granting SA permissions (via Preferences > Files): that seems to have worked.

I then tried closing SA, deleting the /Users/admin/Desktop/SequelProLaravelExport directory, relaunching SA, and exporting again. I get a "Could not create directory: /Users/admin/Desktop/SequelProLaravelExport" from my bundle, which would have come from this part of my script:

DESTDIR=~/Desktop/SequelProLaravelExport
if mkdir -p $DESTDIR; then
    echo "<p>Output directory: <a href='SP-REVEAL-FILE://$DESTDIR'>$DESTDIR</a></p>";
else
    echo "<h2 class='err'>Error</h2><p>Could not create directory: <strong>$DESTDIR</strong></p>"
    echo "<button onclick=\"window.system.closeHTMLOutputWindow()\">Close</button>"
    exit "$SP_BUNDLE_EXIT_SHOW_AS_HTML"
fi

Revoking access in the app and re-adding it fixes this.

If I think quit SA and launch it again (without deleting that destination folder), then attempt an export with my bundle, the bundle claims success, but no files are written.

So it appears that SA needs to be re-granted access to the Desktop folder each time it's launched for it to work. Hope that helps? Let me know if there is anything else I can do to test.

Jason-Morcos commented 3 years ago

Okay I'm 99% sure I fixed the issue! Unfortunately, you will have to revoke and re-grant access to the desktop/other folders one last time, but after that it should work again. Basically manually granted folders were only getting readonly access 🤦 Please try this latest beta and let me know! https://github.com/Sequel-Ace/Sequel-Ace/releases/tag/beta%2F3.3.3-3033

Jason-Morcos commented 3 years ago

Closing unless I hear it's still broken! :)

cviebrock commented 3 years ago

Sorry I didn't respond earlier. This appears to be fixed in the 3.3.3 release. Thanks!