<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">Am 23.10.2018 um 13:35 schrieb Allan Odgaard <<a href="mailto:lists+pass@simplit.com" class="">lists+pass@simplit.com</a>>:</div><br class="Apple-interchange-newline"><div class="">


<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8" class="">

<div class="">
<div style="font-family:sans-serif" class=""><div style="white-space:normal" class=""><p dir="auto" class="">On 23 Oct 2018, at 18:11, <a href="mailto:pass-maillinglist@artursterz.de" style="color:#3983C4" class="">pass-maillinglist@artursterz.de</a> wrote:</p>

</div>
<div style="white-space:normal" class=""><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px" class=""><p dir="auto" class="">But you are right in one part, Amir. Just because brew or macports are installed doesn't mean that gnu-getopts was installed with either tool. Therefore, we should check if either is installed AND if gnu-getopt is in the path we assume. If nothing is true, then (and only then) use any reasonable fall back.<br class="">
<br class="">
But I have to think about it and make a diff as soon as I am ready.</p>
</blockquote></div>
<div style="white-space:normal" class=""><p dir="auto" class="">At least for homebrew, the <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7" class="">pass</code> formula depends on <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7" class="">gnu-getopt</code>, therefor only a user who has <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7" class="">brew</code> installed but who did a custom install of <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7" class="">pass</code>, could run into an issue of missing <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7" class="">gnu-getopt</code>.</p><p dir="auto" class="">I think such scenario is unlikely, especially as <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7" class="">brew</code> allows installing <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7" class="">pass</code> directly from git (using <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7" class="">HEAD</code>).</p><p dir="auto" class="">Also, if it is desirable with additional fault tolerance, I would argue it belongs in a different commit, as it’s unrelated to the optimization that is being proposed.</p>
</div>
</div>
</div>

</div></blockquote></div>I guess having a version that is reasonably fast and fault tolerant at the same time would be great. I pasted a fourth version below, which tries to handle the case, that brew is available, but gnu-getopt was not installed using brew. I also implemented the test for macports, but again since I am not using macports, I can not test this.<div class=""><br class=""></div><div class="">What do you think?</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh</font></div><div class=""><font face="Menlo" class="">index 342ecce..e402120 100644</font></div><div class=""><font face="Menlo" class="">--- a/src/platform/darwin.sh</font></div><div class=""><font face="Menlo" class="">+++ b/src/platform/darwin.sh</font></div><div class=""><font face="Menlo" class="">@@ -43,6 +43,19 @@ qrcode() {</font></div><div class=""><font face="Menlo" class="">        fi</font></div><div class=""><font face="Menlo" class=""> }</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">-GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || { which port &>/dev/null && echo /opt/local; } || echo /usr/local)/bin/getopt"</font></div><div class=""><font face="Menlo" class="">+GETOPT_PREFIX=""</font></div><div class=""><font face="Menlo" class="">+if command -v brew >/dev/null; then</font></div><div class=""><font face="Menlo" class="">+    GETOPT_PREFIX="$(brew --prefix)/opt/gnu-getopt"</font></div><div class=""><font face="Menlo" class="">+    if ![ -x "$GETOPT_PREFIX/bin/getopt" ]; then</font></div><div class=""><font face="Menlo" class="">+        GETOPT_PREFIX=""</font></div><div class=""><font face="Menlo" class="">+    fi</font></div><div class=""><font face="Menlo" class="">+elif [[ $GETOPT_PREFIX ]] && command -v port >/dev/null; then</font></div><div class=""><font face="Menlo" class="">+    GETOPT_PREFIX="/opt/local"</font></div><div class=""><font face="Menlo" class="">+    if ![ -x "GETOPT_PREFIX/bin/getopt" ]; then</font></div><div class=""><font face="Menlo" class="">+        GETOPT_PREFIX=""</font></div><div class=""><font face="Menlo" class="">+    fi</font></div><div class=""><font face="Menlo" class="">+fi</font></div><div class=""><font face="Menlo" class="">+GETOPT="${GETOPT_PREFIX:-/usr/local}/bin/getopt"</font></div><div class=""><font face="Menlo" class="">+</font></div><div class=""><font face="Menlo" class=""> SHRED="srm -f -z"</font></div><div class=""><font face="Menlo" class=""> BASE64="openssl base64"</font></div></div></body></html>