From mcy at lm7.fr Fri Oct 31 22:57:32 2025 From: mcy at lm7.fr (Matteo Cypriani) Date: Fri, 31 Oct 2025 23:57:32 +0100 Subject: [PATCH 0/3] Improved OpenBSD support Message-ID: <20251031235732.c490864997cfdb39491ae906@lm7.fr> Hi folks, new contributor here. I noticed there was a platform file for OpenBSD, but when trying to set Pass up and use it, I came across several issues. Here?s a series of patches to address those, please let me know if you see anything that could be improved. Cheers, Matteo -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From mcy at lm7.fr Fri Oct 31 22:58:19 2025 From: mcy at lm7.fr (Matteo Cypriani) Date: Fri, 31 Oct 2025 23:58:19 +0100 Subject: [PATCH 1/3] Makefile: Support OpenBSD In-Reply-To: <20251031235732.c490864997cfdb39491ae906@lm7.fr> References: <20251031235732.c490864997cfdb39491ae906@lm7.fr> Message-ID: <20251031235819.e765707f0b25d4fab81680ca@lm7.fr> OpenBSD's install doesn't have a -v switch. --- Makefile | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index eac2291..cca7bd1 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,11 @@ MANDIR ?= $(PREFIX)/share/man PLATFORMFILE := src/platform/$(shell uname | cut -d _ -f 1 | tr '[:upper:]' '[:lower:]').sh +ifeq ($(shell uname),OpenBSD) +INSTALLOPTS := +endif +INSTALLOPTS ?= -v + BASHCOMPDIR ?= $(PREFIX)/share/bash-completion/completions ZSHCOMPDIR ?= $(PREFIX)/share/zsh/site-functions FISHCOMPDIR ?= $(PREFIX)/share/fish/vendor_completions.d @@ -35,24 +40,24 @@ all: @echo "Password store is a shell script, so there is nothing to do. Try \"make install\" instead." install-common: - @install -v -d "$(DESTDIR)$(MANDIR)/man1" && install -m 0644 -v man/pass.1 "$(DESTDIR)$(MANDIR)/man1/pass.1" - @[ "$(WITH_BASHCOMP)" = "yes" ] || exit 0; install -v -d "$(DESTDIR)$(BASHCOMPDIR)" && install -m 0644 -v src/completion/pass.bash-completion "$(DESTDIR)$(BASHCOMPDIR)/pass" - @[ "$(WITH_ZSHCOMP)" = "yes" ] || exit 0; install -v -d "$(DESTDIR)$(ZSHCOMPDIR)" && install -m 0644 -v src/completion/pass.zsh-completion "$(DESTDIR)$(ZSHCOMPDIR)/_pass" - @[ "$(WITH_FISHCOMP)" = "yes" ] || exit 0; install -v -d "$(DESTDIR)$(FISHCOMPDIR)" && install -m 0644 -v src/completion/pass.fish-completion "$(DESTDIR)$(FISHCOMPDIR)/pass.fish" + @install $(INSTALLOPTS) -d "$(DESTDIR)$(MANDIR)/man1" && install $(INSTALLOPTS) -m 0644 man/pass.1 "$(DESTDIR)$(MANDIR)/man1/pass.1" + @[ "$(WITH_BASHCOMP)" = "yes" ] || exit 0; install $(INSTALLOPTS) -d "$(DESTDIR)$(BASHCOMPDIR)" && install $(INSTALLOPTS) -m 0644 src/completion/pass.bash-completion "$(DESTDIR)$(BASHCOMPDIR)/pass" + @[ "$(WITH_ZSHCOMP)" = "yes" ] || exit 0; install $(INSTALLOPTS) -d "$(DESTDIR)$(ZSHCOMPDIR)" && install $(INSTALLOPTS) -m 0644 src/completion/pass.zsh-completion "$(DESTDIR)$(ZSHCOMPDIR)/_pass" + @[ "$(WITH_FISHCOMP)" = "yes" ] || exit 0; install $(INSTALLOPTS) -d "$(DESTDIR)$(FISHCOMPDIR)" && install $(INSTALLOPTS) -m 0644 src/completion/pass.fish-completion "$(DESTDIR)$(FISHCOMPDIR)/pass.fish" ifneq ($(strip $(wildcard $(PLATFORMFILE))),) install: install-common - @install -v -d "$(DESTDIR)$(LIBDIR)/password-store" && install -m 0644 -v "$(PLATFORMFILE)" "$(DESTDIR)$(LIBDIR)/password-store/platform.sh" - @install -v -d "$(DESTDIR)$(LIBDIR)/password-store/extensions" - @install -v -d "$(DESTDIR)$(BINDIR)/" + @install $(INSTALLOPTS) -d "$(DESTDIR)$(LIBDIR)/password-store" && install $(INSTALLOPTS) -m 0644 "$(PLATFORMFILE)" "$(DESTDIR)$(LIBDIR)/password-store/platform.sh" + @install $(INSTALLOPTS) -d "$(DESTDIR)$(LIBDIR)/password-store/extensions" + @install $(INSTALLOPTS) -d "$(DESTDIR)$(BINDIR)/" @trap 'rm -f src/.pass' EXIT; sed 's:.*PLATFORM_FUNCTION_FILE.*:source "$(LIBDIR)/password-store/platform.sh":;s:^SYSTEM_EXTENSION_DIR=.*:SYSTEM_EXTENSION_DIR="$(LIBDIR)/password-store/extensions":' src/password-store.sh > src/.pass && \ - install -v -d "$(DESTDIR)$(BINDIR)/" && install -m 0755 -v src/.pass "$(DESTDIR)$(BINDIR)/pass" + install $(INSTALLOPTS) -d "$(DESTDIR)$(BINDIR)/" && install $(INSTALLOPTS) -m 0755 src/.pass "$(DESTDIR)$(BINDIR)/pass" else install: install-common - @install -v -d "$(DESTDIR)$(LIBDIR)/password-store/extensions" + @install $(INSTALLOPTS) -d "$(DESTDIR)$(LIBDIR)/password-store/extensions" @trap 'rm -f src/.pass' EXIT; sed '/PLATFORM_FUNCTION_FILE/d;s:^SYSTEM_EXTENSION_DIR=.*:SYSTEM_EXTENSION_DIR="$(LIBDIR)/password-store/extensions":' src/password-store.sh > src/.pass && \ - install -v -d "$(DESTDIR)$(BINDIR)/" && install -m 0755 -v src/.pass "$(DESTDIR)$(BINDIR)/pass" + install $(INSTALLOPTS) -d "$(DESTDIR)$(BINDIR)/" && install $(INSTALLOPTS) -m 0755 src/.pass "$(DESTDIR)$(BINDIR)/pass" endif uninstall: -- 2.51.0 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From mcy at lm7.fr Fri Oct 31 22:59:13 2025 From: mcy at lm7.fr (Matteo Cypriani) Date: Fri, 31 Oct 2025 23:59:13 +0100 Subject: [PATCH 2/3] INSTALL: Recommend gmake on BSD In-Reply-To: <20251031235732.c490864997cfdb39491ae906@lm7.fr> References: <20251031235732.c490864997cfdb39491ae906@lm7.fr> Message-ID: <20251031235913.fd88d0ab4e5f88cb3ec8c040@lm7.fr> --- INSTALL | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index 3c37f14..32c43fe 100644 --- a/INSTALL +++ b/INSTALL @@ -2,12 +2,13 @@ Simply typing make install -should install pass to the standard locations. +should install pass to the standard locations. (On BSD platforms, +use gmake instead.) The makefile is aware of the following environment variables: PREFIX default: /usr -DESTDIR default: +DESTDIR default: BINDIR default: $(PREFIX)/bin LIBDIR default: $(PREFIX)/lib MANDIR default: $(PREFIX)/share/man -- 2.51.0 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From mcy at lm7.fr Fri Oct 31 23:00:14 2025 From: mcy at lm7.fr (Matteo Cypriani) Date: Sat, 1 Nov 2025 00:00:14 +0100 Subject: [PATCH 3/3] Support OpenBSD's tree command In-Reply-To: <20251031235732.c490864997cfdb39491ae906@lm7.fr> References: <20251031235732.c490864997cfdb39491ae906@lm7.fr> Message-ID: <20251101000014.2373bb3b49e18618ae07dc5f@lm7.fr> OpenBSD packages Pierre-Yves Ritschard's BSD-licenced tree command rather than the more common (and fancier) GPL-licenced implementation from Steve Baker . Ritschard's tree uses a different set of options and lacks `-P` (pattern matching), so we fall back to the find command for `pass find`. --- src/password-store.sh | 25 ++++++++++++++++++++++--- src/platform/openbsd.sh | 7 ++++++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/password-store.sh b/src/password-store.sh index 22e818f..eb6a83f 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -242,9 +242,13 @@ tmpdir() { fi } + +HAS_FANCY_TREE=1 + +BASE64="base64" GETOPT="getopt" SHRED="shred -f -z" -BASE64="base64" +TREE="tree -NCl --noreport" source "$(dirname "$0")/platform/$(uname | cut -d _ -f 1 | tr '[:upper:]' '[:lower:]').sh" 2>/dev/null # PLATFORM_FUNCTION_FILE @@ -402,7 +406,7 @@ cmd_show() { else echo "${path%\/}" fi - tree -N -C -l --noreport "$PREFIX/$path" 3>&- | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of line, but keep colors + $TREE "$PREFIX/$path" 3>&- | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of line, but keep colors elif [[ -z $path ]]; then die "Error: password store is empty. Try \"pass init\"." else @@ -414,7 +418,22 @@ cmd_find() { [[ $# -eq 0 ]] && die "Usage: $PROGRAM $COMMAND pass-names..." IFS="," eval 'echo "Search Terms: $*"' local terms="*$(printf '%s*|*' "$@")" - tree -N -C -l --noreport -P "${terms%|*}" --prune --matchdirs --ignore-case "$PREFIX" 3>&- | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' + + if [[ $HAS_FANCY_TREE -eq 1 ]]; then + $TREE -P "${terms%|*}" --prune --matchdirs --ignore-case "$PREFIX" 3>&- \ + | tail -n +2 \ + | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' + else + # This is not strictly functionnaly equivalent to the above + # `tree -P` command: subelements of a directory matching the + # pattern will be shown only if they match the pattern + # themselves. + find "$PREFIX" -iname "${terms%|*}" 3>&- \ + | sed -E -e 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' \ + | while read -r res; do + echo "${res#"${PREFIX}/"}" + done + fi } cmd_grep() { diff --git a/src/platform/openbsd.sh b/src/platform/openbsd.sh index fc27f6a..a22d4dd 100644 --- a/src/platform/openbsd.sh +++ b/src/platform/openbsd.sh @@ -36,6 +36,11 @@ tmpdir() { fi } +# OpenBSD packages a more basic version of the tree command than the Old Man +# Programmer's that is common on GNU/Linux distros. +HAS_FANCY_TREE=0 + +BASE64="openssl base64" GETOPT="gnugetopt" SHRED="rm -P -f" -BASE64="openssl base64" +TREE="tree -sl" -- 2.51.0 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 833 bytes Desc: not available URL: