From: Thomas Bereknyei <tomberek@gmail.com>
To: zsh-workers@zsh.org
Subject: Generalize getent presence
Date: Fri, 04 Nov 2016 02:51:28 +0000 [thread overview]
Message-ID: <CA+CkF21yC1M1+6++TSm+M6Y_P8w+qvHG81hTJb+=P2Wet+Nxqw@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 500 bytes --]
How can we go about making the code for getent a bit more general with
respect to non-traditional locations for the binary? I ran into this while
troubleshooting mdns on NixOS and not having a functional getent, but the
replacement provided in compaudit. (share/zsh/5.2/function/compaudit).
-[[ -x /usr/bin/getent ]] || getent() {
+[[ -n ${commands[getent]} ]] || getent() {
I brought this up at https://github.com/NixOS/nixpkgs/issues/20138 where
the attached solution was suggested by Mic92.
[-- Attachment #1.2: Type: text/html, Size: 1322 bytes --]
[-- Attachment #2: getentGeneralize.patch --]
[-- Type: application/octet-stream, Size: 322 bytes --]
--- compaudit 2016-11-03 22:42:55.651628433 -0400
+++ compaudit.new 2016-11-03 22:44:06.081365726 -0400
@@ -15,7 +15,7 @@
emulate -L zsh
setopt extendedglob
-[[ -x /usr/bin/getent ]] || getent() {
+[[ -n ${commands[getent]} ]] || getent() {
if [[ $2 = <-> ]]; then
grep ":$2:[^:]*$" /etc/$1
else
next reply other threads:[~2016-11-04 3:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-04 2:51 Thomas Bereknyei [this message]
2016-11-05 4:47 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+CkF21yC1M1+6++TSm+M6Y_P8w+qvHG81hTJb+=P2Wet+Nxqw@mail.gmail.com' \
--to=tomberek@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).