From 2584dda50db06c6173fcf2320757dd32c0f401e6 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Sun, 8 Apr 2018 16:07:15 +0200 Subject: [PATCH 1/2] Add note about hanging xclip --- NOTES.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 NOTES.md diff --git a/NOTES.md b/NOTES.md new file mode 100644 index 0000000..c995603 --- /dev/null +++ b/NOTES.md @@ -0,0 +1,14 @@ +# Notes + +## xclip hangs in subshell environment + +In certain situations xclip is known to wait infinatly. +According to this: + +- [Stackoverflow](https://stackoverflow.com/questions/19237559/why-xclip-bashrc-takes-much-longer-than-systemxclip-bashrc-in-ruby) +- [Sourceforge](http://sourceforge.net/p/xclip/bugs/9/) + +This is related to xclip not closing stdout. + +To mitigate this I will try to close stdout and stderr within the +accountmanager.sh script. From 31b93e82add80892ff7e9733892abac9a646c1e1 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Sun, 8 Apr 2018 16:13:13 +0200 Subject: [PATCH 2/2] Explicitly close stdout with each xclip -i call --- accountmanager.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/accountmanager.sh b/accountmanager.sh index 3e30567..fc042a7 100644 --- a/accountmanager.sh +++ b/accountmanager.sh @@ -266,7 +266,7 @@ function amngradd() { PASSWORD="$(amngrcrypt -r "${RECIPIENT}" -- "${3}")" else PASSWORD="$(amngrgen -r "${RECIPIENT}")" - echo -n "${PASSWORD}" | gpg -dq | xclip -i + echo -n "${PASSWORD}" | gpg -dq | xclip -i >&- fi if [ -z "${PASSWORD}" ] @@ -359,7 +359,7 @@ function amngrgetuser() { if [ $STDOUT -eq 0 ] then sqlite3 "${DB}" <<-EOD |\ - awk 'NR>1{print p}{p=$0}END{ORS="";print}' | xclip -i + awk 'NR>1{print p}{p=$0}END{ORS="";print}' | xclip -i >&- SELECT user FROM account JOIN account_cred ON account.id=account_cred.account_id JOIN cred ON cred.id=account_cred.cred_id @@ -411,7 +411,7 @@ function amngrgetpass() { test "${STATE}" != "1" -a "${STATE}" != "2" && STATE="1" sqlite3 "${DB}" <<-EOD |\ - awk 'NR>1{print p}{p=$0}END{ORS="";print}' | gpg -dq | xclip -i + awk 'NR>1{print p}{p=$0}END{ORS="";print}' | gpg -dq | xclip -i >&- SELECT pass FROM account JOIN account_cred ON account.id=account_cred.account_id JOIN cred ON cred.id=account_cred.cred_id