zsh-workers
 help / color / mirror / code / Atom feed
* Generalize getent presence
@ 2016-11-04  2:51 Thomas Bereknyei
  2016-11-05  4:47 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Bereknyei @ 2016-11-04  2:51 UTC (permalink / raw)
  To: zsh-workers


[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Generalize getent presence
  2016-11-04  2:51 Generalize getent presence Thomas Bereknyei
@ 2016-11-05  4:47 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2016-11-05  4:47 UTC (permalink / raw)
  To: zsh-workers

On Nov 4,  2:51am, Thomas Bereknyei wrote:
}
} -[[ -x /usr/bin/getent ]] || getent() {
} 
} +[[ -n ${commands[getent]} ]] || getent() {

Seems reasonable; we test for ${commands[getent]} in _hosts.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-05  4:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-04  2:51 Generalize getent presence Thomas Bereknyei
2016-11-05  4:47 ` Bart Schaefer

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).