Bug?: `op signin` not idempotent as advertised when called in parallel
I'm attempting to use op signin
from a parallel set of processes, counting on its advertisement of idempotency to work.
Unfortunately, that doesn't seem to be the case. You have to have one successful signin at which point the rest will succeed only if they're started after that one does. If you call them all in parallel then every one of them prompts for biometric unlock.
This can be demonstrated simply with the following shell script which relies on GNU Parallel:
#!/usr/bin/env bash export account=$1 signin() { local sequence=$1 echo "$1" eval "$(op signin --account ${account})" } export -f signin # You'll be prompted for biometric unlock once and then see the rest of the sequence numbers in random order op signout && parallel -j1 signin ::: {1..10} # You'll be prompted 10 times for biometrics unlock, one at a time in # random order. op signout && parallel -j0 signin ::: {1..10}
Called like:
$ ~/Downloads/x <account>
Hopefully I'm just missing something obvious. At the moment I'm needing to use semaphores to make sure only one process is actually attempting to signin at a time.
1Password Version: 1Password for Mac 8.10.0 (81000055), cli 2.14.0
Extension Version: N/A
OS Version: 13.2 (22D49)
Browser:_ N/A
Comments
-
Actually this is a better script. The above still works but it's not as efficient and doesn't show that once you're signed in you can indeed call
signin
in parallel just fine.#!/usr/bin/env bash export account=$1 signin() { local sequence=$1 echo "$1" eval "$(op signin --account ${account})" } export -f signin cat <<EOF You'll be prompted for biometric unlock once and then see the rest of the sequence numbers in random order EOF op signout && signin 1 && parallel -j0 signin ::: {2..10} cat <<EOF You'll be prompted 10 times for biometrics unlock, one at a time in random order. EOF op signout && parallel -j0 signin ::: {1..10}
Again on my box:
$ bash ~/Downloads/x *** You'll be prompted for biometric unlock once and then see the rest of the sequence numbers in random order 1 2 4 3 6 5 7 8 9 10 You'll be prompted 10 times for biometrics unlock, one at a time in random order. 1 2 3 5 4 6 9 7 8 10
0