Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blackbox_addadmin leaves the system in unconsistent state if the GPG key does not exists #273

Open
kwilczek opened this issue Oct 3, 2018 · 0 comments

Comments

@kwilczek
Copy link
Contributor

kwilczek commented Oct 3, 2018

Hi,

when you run blackbox_addadmin, the code firstly add the admin-to-be to the blackbox-admins.txt, then access GPG database and fails if the key does not exists. Steps to reproduce:

mkdir /dev/shm/empty_repo && cd $_
git init
blackbox_initialize
blackbox_addadmin dummy_admin@dummy_domain.com

The code will fail with GPG warning: nothing were exported and GPG key 'dummy_admin@dummy_domain.com' not found .... But the repo is changed:

cat .blackbox/blackbox-admins.txt
dummy_admin@dummy_domain.com

I think that adding a check for the key existence or simply moving the code:

# Add the email address to the BB_ADMINS file. Remove any duplicates.
# The file must exist for sort to act as we expect.
touch "$BB_ADMINS"
sort -fdu -o "$BB_ADMINS" <(echo "$1") "$BB_ADMINS"

below the GPG import part would be enough.

--
K.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant