-
Notifications
You must be signed in to change notification settings - Fork 42
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
Fix gpg issue with importing public key #252
Conversation
When you run the client in the development environment, it either starts a new Either a developer needs to know that they should kill the The confusing thing about this whole issue is that @redshiftzero - what do you think is reasonable to do in this case? |
6488a87
to
4af1711
Compare
update: the underlying issue appears to only be happening on debian (see details in #251). we chatted about this PR and decided that just killing the |
ce5b662
to
bd12f89
Compare
@redshiftzero so the code is ready for final review. it now:
TODO: Create a separate issue for killing the gpg-agent that is run from the client code since that will most likely also be used in production |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! couple minor suggestions inline
run.sh
Outdated
if [ -d "$SDC_HOME" ]; then | ||
SDC_HOME=${SDC_HOME} | ||
else | ||
SDC_HOME="/tmp/sdc-home" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note this is not platform independent (mac doesn't use /tmp
for tempdirs), so I think we want to keep the mktemp -d
logic
run.sh
Outdated
|
||
echo "Running app with home directory: $SDC_HOME" | ||
echo "" | ||
|
||
# make sure a ew gpg-agent is used for each run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ew
-> new
run.sh
Outdated
|
||
echo "Running app with home directory: $SDC_HOME" | ||
echo "" | ||
|
||
# make sure a ew gpg-agent is used for each run | ||
PID=$(ps -ef | grep gpg-agent | grep "$GPG_HOME" | grep -v grep | awk '{print $2}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! 😎
what about using this in a bash trap (so that we can use mktemp
above), i.e. here's a diff doing that based on your commit here:
diff --git a/run.sh b/run.sh
index 28fc9e3..e72b344 100755
--- a/run.sh
+++ b/run.sh
@@ -15,28 +15,25 @@ while [ -n "$1" ]; do
shift
done
-if [ -d "$SDC_HOME" ]; then
- SDC_HOME=${SDC_HOME}
-else
- SDC_HOME="/tmp/sdc-home"
- mkdir -p "SDC_HOME"
- chmod 0700 "$SDC_HOME"
-fi
+SDC_HOME=${SDC_HOME:-$(mktemp -d)}
export SDC_HOME
GPG_HOME="$SDC_HOME/gpg"
-mkdir -p "$GPG_HOME"
+mkdir -p "$SDC_HOME" "$GPG_HOME"
chmod 0700 "$GPG_HOME"
+function cleanup {
+ # make sure a new gpg-agent is used for each run
+ PID=$(ps -ef | grep gpg-agent | grep "$GPG_HOME" | grep -v grep | awk '{print $2}')
+ if [ "$PID" ]; then
+ kill $PID
+ fi
+}
+trap cleanup EXIT
+
echo "Running app with home directory: $SDC_HOME"
echo ""
-# make sure a ew gpg-agent is used for each run
-PID=$(ps -ef | grep gpg-agent | grep "$GPG_HOME" | grep -v grep | awk '{print $2}')
-if [ "$PID" ]; then
- kill "$PID"
-fi
-
gpg --homedir "$GPG_HOME" --allow-secret-key-import --import tests/files/securedrop.gpg.asc &
# create the database and config for local testing
@@ -44,4 +41,6 @@ gpg --homedir "$GPG_HOME" --allow-secret-key-import --import tests/files/secured
wait
-exec python -m securedrop_client --sdc-home "$SDC_HOME" --no-proxy $@
+exec python -m securedrop_client --sdc-home "$SDC_HOME" --no-proxy $@ &
+
+wait
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
making the client a bg process and waiting at the end did the trick! 💯
b69aaad
to
1950a9c
Compare
…eady running Signed-off-by: Allie Crevier <[email protected]>
1950a9c
to
e915907
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful! works as advertised, thanks @creviera
Fixes #251