pass: 1.7.3 -> 1.7.4

Mostly bug fixes, the following changes were required in the package:

* set-correct-program-name-for-sleep.patch needed to be rebased,
b08781e2a6e183986eb1c24f51cdeff879b7a6af partially implemented
the changes done in this patch, so we don't need to touch
password-store.sh anymore.

* Remove wayland patch since it is part of the release now

* Reworked assert logic wrt to x11-/wayland- and dmenuSupport:
passmenu now supports wayland as well via dmenu-wayland. Sadly
the choice of menu is not changeable, pending
https://lists.zx2c4.com/pipermail/password-store/2021-January/004363.html

* Rebased no-darwin-getopt.patch

* Note that f.el is no longer required

Reviews would be appreciated, I might've missed something.

+24 -153
-113
pkgs/tools/security/pass/clip-wayland-support.patch
··· 1 - From b0b784b1a57c0b06936e6f5d6560712b4b810cd3 Mon Sep 17 00:00:00 2001 2 - From: Brett Cornwall <brett@i--b.com> 3 - Date: Wed, 27 Feb 2019 00:08:33 -0700 4 - Subject: clip: Add support for wl-clipboard 5 - 6 - Edited to properly apply with 7 - `set-correct-program-name-for-sleep.patch`. 8 - 9 - --- 10 - README | 4 +++- 11 - man/pass.1 | 5 +++++ 12 - src/password-store.sh | 26 +++++++++++++++++++++----- 13 - 3 files changed, 29 insertions(+), 6 deletions(-) 14 - 15 - diff --git a/README b/README 16 - index 6b59965..1a46242 100644 17 - --- a/README 18 - +++ b/README 19 - @@ -19,8 +19,10 @@ Depends on: 20 - http://www.gnupg.org/ 21 - - git 22 - http://www.git-scm.com/ 23 - -- xclip 24 - +- xclip (for X11 environments) 25 - http://sourceforge.net/projects/xclip/ 26 - +- wl-clipboard (for wlroots Wayland-based environments) 27 - + https://github.com/bugaevc/wl-clipboard 28 - - tree >= 1.7.0 29 - http://mama.indstate.edu/users/ice/tree/ 30 - - GNU getopt 31 - diff --git a/man/pass.1 b/man/pass.1 32 - index 01a3fbe..a555dcb 100644 33 - --- a/man/pass.1 34 - +++ b/man/pass.1 35 - @@ -99,6 +99,8 @@ Decrypt and print a password named \fIpass-name\fP. If \fI--clip\fP or \fI-c\fP 36 - is specified, do not print the password but instead copy the first (or otherwise specified) 37 - line to the clipboard using 38 - .BR xclip (1) 39 - +or 40 - +.BR wl-clipboard(1) 41 - and then restore the clipboard after 45 (or \fIPASSWORD_STORE_CLIP_TIME\fP) seconds. If \fI--qrcode\fP 42 - or \fI-q\fP is specified, do not print the password but instead display a QR code using 43 - .BR qrencode (1) 44 - @@ -132,6 +134,8 @@ in generating passwords can be changed with the \fIPASSWORD_STORE_CHARACTER_SET\ 45 - If \fI--clip\fP or \fI-c\fP is specified, do not print the password but instead copy 46 - it to the clipboard using 47 - .BR xclip (1) 48 - +or 49 - +.BR wl-clipboard(1) 50 - and then restore the clipboard after 45 (or \fIPASSWORD_STORE_CLIP_TIME\fP) seconds. If \fI--qrcode\fP 51 - or \fI-q\fP is specified, do not print the password but instead display a QR code using 52 - .BR qrencode (1) 53 - @@ -466,6 +470,7 @@ The location of the text editor used by \fBedit\fP. 54 - .BR tr (1), 55 - .BR git (1), 56 - .BR xclip (1), 57 - +.BR wl-clipboard (1), 58 - .BR qrencode (1). 59 - 60 - .SH AUTHOR 61 - diff --git a/src/password-store.sh b/src/password-store.sh 62 - index d89d455..284eabf 100755 63 - --- a/src/password-store.sh 64 - +++ b/src/password-store.sh 65 - @@ -152,16 +152,32 @@ check_sneaky_paths() { 66 - # 67 - 68 - clip() { 69 - + if [[ -n $WAYLAND_DISPLAY ]]; then 70 - + local copy_cmd=( wl-copy ) 71 - + local paste_cmd=( wl-paste -n ) 72 - + if [[ $X_SELECTION == primary ]]; then 73 - + copy_cmd+=( --primary ) 74 - + paste_cmd+=( --primary ) 75 - + fi 76 - + local display_name="$WAYLAND_DISPLAY" 77 - + elif [[ -n $DISPLAY ]]; then 78 - + local copy_cmd=( xclip -selection "$X_SELECTION" ) 79 - + local paste_cmd=( xclip -o -selection "$X_SELECTION" ) 80 - + local display_name="$DISPLAY" 81 - + else 82 - + die "Error: No X11 or Wayland display detected" 83 - + fi 84 - + local sleep_argv0="password store sleep on display $display_name" 85 - + 86 - # This base64 business is because bash cannot store binary data in a shell 87 - # variable. Specifically, it cannot store nulls nor (non-trivally) store 88 - # trailing new lines. 89 - - local sleep_argv0="password store sleep on display $DISPLAY" 90 - pkill -P $(pgrep -f "^$sleep_argv0") 2>/dev/null && sleep 0.5 91 - - local before="$(xclip -o -selection "$X_SELECTION" 2>/dev/null | $BASE64)" 92 - - echo -n "$1" | xclip -selection "$X_SELECTION" || die "Error: Could not copy data to the clipboard" 93 - + local before="$("${paste_cmd[@]}" 2>/dev/null | $BASE64)" 94 - + echo -n "$1" | "${copy_cmd[@]}" || die "Error: Could not copy data to the clipboard" 95 - ( 96 - ( exec -a "$sleep_argv0" bash <(echo trap 'kill %1' TERM\; sleep "$CLIP_TIME & wait") ) 97 - - local now="$(xclip -o -selection "$X_SELECTION" | $BASE64)" 98 - + local now="$("${paste_cmd[@]}" | $BASE64)" 99 - [[ $now != $(echo -n "$1" | $BASE64) ]] && before="$now" 100 - 101 - # It might be nice to programatically check to see if klipper exists, 102 - @@ -173,7 +189,7 @@ clip() { 103 - # so we axe it here: 104 - qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory &>/dev/null 105 - 106 - - echo "$before" | $BASE64 -d | xclip -selection "$X_SELECTION" 107 - + echo "$before" | $BASE64 -d | "${copy_cmd[@]}" 108 - ) >/dev/null 2>&1 & disown 109 - echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds." 110 - } 111 - -- 112 - cgit v1.2.1-28-gf32c 113 -
+16 -15
pkgs/tools/security/pass/default.nix
··· 3 3 , which, procps , qrencode , makeWrapper, pass, symlinkJoin 4 4 5 5 , xclip ? null, xdotool ? null, dmenu ? null 6 - , x11Support ? !stdenv.isDarwin , dmenuSupport ? x11Support 6 + , x11Support ? !stdenv.isDarwin , dmenuSupport ? (x11Support || waylandSupport) 7 7 , waylandSupport ? false, wl-clipboard ? null 8 + , ydotool ? null, dmenu-wayland ? null 8 9 9 10 # For backwards-compatibility 10 11 , tombPluginSupport ? false ··· 13 14 with lib; 14 15 15 16 assert x11Support -> xclip != null; 17 + assert waylandSupport -> wl-clipboard != null; 16 18 17 - assert dmenuSupport -> dmenu != null 18 - && xdotool != null 19 - && x11Support; 19 + assert dmenuSupport -> x11Support || waylandSupport; 20 + assert dmenuSupport && x11Support 21 + -> dmenu != null && xdotool != null; 22 + assert dmenuSupport && waylandSupport 23 + -> dmenu-wayland != null && ydotool != null; 20 24 21 - assert waylandSupport -> wl-clipboard != null; 22 25 23 26 let 24 27 passExtensions = import ./extensions { inherit pkgs; }; ··· 52 55 in 53 56 54 57 stdenv.mkDerivation rec { 55 - version = "1.7.3"; 58 + version = "1.7.4"; 56 59 pname = "password-store"; 57 60 58 61 src = fetchurl { 59 62 url = "https://git.zx2c4.com/password-store/snapshot/${pname}-${version}.tar.xz"; 60 - sha256 = "1x53k5dn3cdmvy8m4fqdld4hji5n676ksl0ql4armkmsds26av1b"; 63 + sha256 = "1h4k6w7g8pr169p5w9n6mkdhxl3pw51zphx7www6pvgjb7vgmafg"; 61 64 }; 62 65 63 66 patches = [ 64 67 ./set-correct-program-name-for-sleep.patch 65 68 ./extension-dir.patch 66 - ] ++ lib.optional stdenv.isDarwin ./no-darwin-getopt.patch 67 - # TODO (@Ma27) this patch adds support for wl-clipboard and can be removed during the next 68 - # version bump. 69 - ++ lib.optional waylandSupport ./clip-wayland-support.patch; 69 + ] ++ lib.optional stdenv.isDarwin ./no-darwin-getopt.patch; 70 70 71 71 nativeBuildInputs = [ makeWrapper ]; 72 72 ··· 74 74 75 75 postInstall = '' 76 76 # Install Emacs Mode. NOTE: We can't install the necessary 77 - # dependencies (s.el and f.el) here. The user has to do this 78 - # himself. 77 + # dependencies (s.el) here. The user has to do this themselves. 79 78 mkdir -p "$out/share/emacs/site-lisp" 80 79 cp "contrib/emacs/password-store.el" "$out/share/emacs/site-lisp/" 81 80 '' + optionalString dmenuSupport '' ··· 96 95 procps 97 96 ] ++ optional stdenv.isDarwin openssl 98 97 ++ optional x11Support xclip 99 - ++ optionals dmenuSupport [ xdotool dmenu ] 100 - ++ optional waylandSupport wl-clipboard); 98 + ++ optional waylandSupport wl-clipboard 99 + ++ optionals (waylandSupport && dmenuSupport) [ ydotool dmenu-wayland ] 100 + ++ optionals (x11Support && dmenuSupport) [ xdotool dmenu ] 101 + ); 101 102 102 103 postFixup = '' 103 104 # Fix program name in --help
+8 -6
pkgs/tools/security/pass/no-darwin-getopt.patch
··· 1 - diff -Naur password-store-1.6.5-orig/src/platform/darwin.sh password-store-1.6.5/src/platform/darwin.sh 2 - --- password-store-1.6.5-orig/src/platform/darwin.sh 2015-01-28 16:43:02.000000000 +0000 3 - +++ password-store-1.6.5/src/platform/darwin.sh 2015-02-15 16:09:02.000000000 +0000 4 - @@ -31,5 +31,4 @@ 5 - mount -t hfs -o noatime -o nobrowse "$DARWIN_RAMDISK_DEV" "$SECURE_TMPDIR" || die "Error: could not mount filesystem on ramdisk." 1 + diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh 2 + index f6cc471..e2e8bba 100644 3 + --- a/src/platform/darwin.sh 4 + +++ b/src/platform/darwin.sh 5 + @@ -39,6 +39,5 @@ qrcode() { 6 + fi 6 7 } 7 8 8 - -GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || { which port &>/dev/null && echo /opt/local; } || echo /usr/local)/bin/getopt" 9 + -GETOPT="$({ test -x /usr/local/opt/gnu-getopt/bin/getopt && echo /usr/local/opt/gnu-getopt; } || brew --prefix gnu-getopt 2>/dev/null || { which port &>/dev/null && echo /opt/local; } || echo /usr/local)/bin/getopt" 9 10 SHRED="srm -f -z" 11 + BASE64="openssl base64"
-19
pkgs/tools/security/pass/set-correct-program-name-for-sleep.patch
··· 5 5 single-binary coreutils 6 6 7 7 --- 8 - src/password-store.sh | 4 ++-- 9 8 src/platform/cygwin.sh | 4 ++-- 10 9 src/platform/darwin.sh | 4 ++-- 11 10 3 files changed, 6 insertions(+), 6 deletions(-) 12 11 13 - diff --git a/src/password-store.sh b/src/password-store.sh 14 - index 7264ffc..68551a4 100755 15 - --- a/src/password-store.sh 16 - +++ b/src/password-store.sh 17 - @@ -155,11 +155,11 @@ clip() { 18 - # variable. Specifically, it cannot store nulls nor (non-trivally) store 19 - # trailing new lines. 20 - local sleep_argv0="password store sleep on display $DISPLAY" 21 - - pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5 22 - + pkill -P $(pgrep -f "^$sleep_argv0") 2>/dev/null && sleep 0.5 23 - local before="$(xclip -o -selection "$X_SELECTION" 2>/dev/null | $BASE64)" 24 - echo -n "$1" | xclip -selection "$X_SELECTION" || die "Error: Could not copy data to the clipboard" 25 - ( 26 - - ( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '$CLIP_TIME' & wait" ) 27 - + ( exec -a "$sleep_argv0" bash <(echo trap 'kill %1' TERM\; sleep "$CLIP_TIME & wait") ) 28 - local now="$(xclip -o -selection "$X_SELECTION" | $BASE64)" 29 - [[ $now != $(echo -n "$1" | $BASE64) ]] && before="$now" 30 - 31 12 diff --git a/src/platform/cygwin.sh b/src/platform/cygwin.sh 32 13 index 5a8d5ea..423e0ce 100644 33 14 --- a/src/platform/cygwin.sh