From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#22091: [PATCH 1/2] * lisp/env.el: Add (whereis-command) Date: Fri, 04 Dec 2015 19:53:34 -0500 Message-ID: References: <1449210313-10200-1-git-send-email-lx@shellcodes.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1449276859 18746 80.91.229.3 (5 Dec 2015 00:54:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Dec 2015 00:54:19 +0000 (UTC) To: 22091-done@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 05 01:54:10 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a5172-00056g-3u for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Dec 2015 01:54:08 +0100 Original-Received: from localhost ([::1]:44085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a5171-00045G-Aa for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Dec 2015 19:54:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a516x-000454-GF for bug-gnu-emacs@gnu.org; Fri, 04 Dec 2015 19:54:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a516w-0003VV-Eh for bug-gnu-emacs@gnu.org; Fri, 04 Dec 2015 19:54:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a516w-0003VL-BK for bug-gnu-emacs@gnu.org; Fri, 04 Dec 2015 19:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1a516w-0006KU-7c for bug-gnu-emacs@gnu.org; Fri, 04 Dec 2015 19:54:02 -0500 In-Reply-To: <1449210313-10200-1-git-send-email-lx@shellcodes.org> Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Dec 2015 00:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 22091 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 22091@debbugs.gnu.org, rgm@gnu.org, lx@shellcodes.org Original-Received: via spool by 22091-done@debbugs.gnu.org id=D22091.144927683724314 (code D ref 22091); Sat, 05 Dec 2015 00:54:01 +0000 Original-Received: (at 22091-done) by debbugs.gnu.org; 5 Dec 2015 00:53:57 +0000 Original-Received: from localhost ([127.0.0.1]:39524 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a516q-0006K6-SK for submit@debbugs.gnu.org; Fri, 04 Dec 2015 19:53:57 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57190) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a516W-0006Jg-Pn for 22091-done@debbugs.gnu.org; Fri, 04 Dec 2015 19:53:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a516V-0003IY-LC for 22091-done@debbugs.gnu.org; Fri, 04 Dec 2015 19:53:36 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33313) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a516V-0003IU-Hw for 22091-done@debbugs.gnu.org; Fri, 04 Dec 2015 19:53:35 -0500 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1a516U-0002Lo-KO; Fri, 04 Dec 2015 19:53:34 -0500 X-Spook: Customs and Border Protection Ruby Ridge threat Avian DES X-Ran: M;qCO^=N1{uQeq0S}.k1M^l,0B#[ev!Fi+#FE8}XlgBSJ|3rj3En:>cH%H(?De&Uq=Z:*X X-Hue: red X-Attribution: GM User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:109631 Archived-At: Version: 25.1 Thanks for the report and the patch(es). I installed something slightly different into emacs-25, to take care of a few other related bits at the same time: --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el @@ -35,15 +35,19 @@ ;; * Support connections to HOST/PORT, generally for debugging and the like. ;; In other words, for doing much the same thing as "telnet HOST PORT", and ;; then typing commands. -;; -;; PATHS -;; -;; On some systems, some of these programs are not in normal user path, -;; but rather in /sbin, /usr/sbin, and so on. - ;;; Code: +;; On some systems, programs like ifconfig are not in normal user +;; path, but rather in /sbin, /usr/sbin, etc (but non-root users can +;; still use them for queries). Actually the trend these +;; day is for /sbin to be a symlink to /usr/sbin, but we still need to +;; search both for older systems. +(defun net-utils--executable-find-sbin (command) + "Return absolute name of COMMAND if found in an sbin directory." + (let ((exec-path '("/sbin" "/usr/sbin" "/usr/local/sbin"))) + (executable-find command))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Customization Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -85,10 +89,13 @@ These options can be used to limit how many ICMP packets are emitted." (define-obsolete-variable-alias 'ipconfig-program 'ifconfig-program "22.2") (defcustom ifconfig-program - (if (eq system-type 'windows-nt) - "ipconfig" - "ifconfig") + (cond ((eq system-type 'windows-nt) "ipconfig") + ((executable-find "ifconfig") "ifconfig") + ((net-utils--executable-find-sbin "ifconfig")) + ((net-utils--executable-find-sbin "ip")) + (t "ip")) "Program to print network configuration information." + :version "25.1" ; add ip :group 'net-utils :type 'string) @@ -96,10 +103,12 @@ These options can be used to limit how many ICMP packets are emitted." 'ifconfig-program-options "22.2") (defcustom ifconfig-program-options - (list - (if (eq system-type 'windows-nt) - "/all" "-a")) + (cond ((string-match "ipconfig\\'" ifconfig-program) '("/all")) + ((string-match "ifconfig\\'" ifconfig-program) '("-a")) + ((string-match "ip\\'" ifconfig-program) '("addr"))) "Options for the ifconfig program." + :version "25.1" + :set-after '(ifconfig-program) :group 'net-utils :type '(repeat string)) @@ -126,7 +135,7 @@ These options can be used to limit how many ICMP packets are emitted." :group 'net-utils :type '(repeat string)) -(defcustom arp-program "arp" +(defcustom arp-program (or (net-utils--executable-find-sbin "arp") "arp") "Program to print IP to address translation tables." :group 'net-utils :type 'string)