timvisee / prs

🔐 A secure, fast & convenient password manager CLI using GPG and git to sync.
https://gitlab.com/timvisee/prs
GNU General Public License v3.0
211 stars 8 forks source link

The process has forked and you cannot use this CoreFoundation functionality safely #1

Closed ivan-avalos closed 3 years ago

ivan-avalos commented 3 years ago

I'm using prs-cli 0.1.2 in macOS Big Sur, and after prs copy'ing, the clipboard is cleared and the following message starts getting printed multiple times on the terminal:

The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.

Let me know if you need more information!

timvisee commented 3 years ago

Thanks for the report!

This must be caused by the way the delayed clipboard clearing is set up. It might not be supported on macOS. I might have to find a different way to do this then.

ivan-avalos commented 3 years ago

This seems to occur after the 20 seconds, indeed, and the clipboard isn't being cleared. Perhaps password-store code could give you a hint: https://git.zx2c4.com/password-store/tree/src/password-store.sh#n155

ivan-avalos commented 3 years ago

Is there a way to disable clipboard clearing for now? Until this issue if fixed.

ivan-avalos commented 3 years ago

Oh, I closed accidentally.

timvisee commented 3 years ago

I'm looking into a proper way to achieve this at the moment. The current approach uses forking to easily spawn a background task that outlives the main prs thread to support clearing after prs quits. As you've noticed this method isn't supported on macOS.

This seems to occur after the 20 seconds, indeed, and the clipboard isn't being cleared. Perhaps password-store code could give you a hint: https://git.zx2c4.com/password-store/tree/src/password-store.sh#n155

Thanks for the hint. Though I don't think this nicely supports reverting clipboard contents after clearing, it may be a nice temporary fix.

Is there a way to disable clipboard clearing for now? Until this issue if fixed.

Not at the moment. If you're calling through an alias or function, you may be able to hide the error with:

prs copy 2>&1 /dev/null

Otherwise, would a --no-clear flag suffice? That's something I can quickly add.

ivan-avalos commented 3 years ago

Otherwise, would a --no-clear flag suffice? That's something I can quickly add.

That would be nice!

timvisee commented 3 years ago

Just noticed this can already be achieved through the timeout option instead. Forgot about that. A timeout of 0 won't do the clearing, which essentially is the same as --no-clear.

prs copy --timeout 0
# or shorter
prs copy -t0
timvisee commented 3 years ago

I experimented with a new clipboard timeout approach. I've not been able to test it on a macOS machine yet, but it does seem to work fine on Linux.

It would be awesome if you could give the latest build including this change for macOS a try:

https://gitlab.com/timvisee/prs/-/jobs/910479654/artifacts/browse

Changes are listed here:

https://gitlab.com/timvisee/prs/-/merge_requests/10/diffs

timvisee commented 3 years ago

I've just tested these changes on macOS, and it seems to work fine.

I've released these as part of v0.1.3. This version should be available once the release pipeline succeeds.

Closing this now. Feel free to open this again if you're still experiencing these issues with v0.1.3.

Also, since prs is in early development, I'd love to get some feedback.