From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6584 invoked by alias); 30 Jan 2013 21:57:55 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31014 Received: (qmail 26271 invoked from network); 30 Jan 2013 21:57:42 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DOS_RCVD_IP_TWICE_B, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at lorien.comfychair.org designates 173.8.144.98 as permitted sender) Date: Wed, 30 Jan 2013 13:40:24 -0800 From: Danek Duvall To: Peter Stephenson Cc: "Zsh Hackers' List" Subject: Re: PATCH: compaudit allows owner of executable Message-ID: <20130130214024.GC24366@lorien.comfychair.org> Mail-Followup-To: Danek Duvall , Peter Stephenson , Zsh Hackers' List References: <20130130211148.6365d1f2@pws-pc.ntlworld.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130130211148.6365d1f2@pws-pc.ntlworld.com> User-Agent: Mutt/1.5.20 (2010-04-22) On Wed, Jan 30, 2013 at 09:11:48PM +0000, Peter Stephenson wrote: > I couldn't think of a reasonably safe, standard way of finding out who > owns the executable, however. So I've done it using the /proc file > system. I've also assumed zstat is available from zsh/stat. > Suggestions for improvements welcome. On Solaris, the path would be /proc/$$/object/a.out. From the code, I think that'll work as far back as Solaris 2.6, but I don't have any old machines to verify that on. Solaris also has a "getexecname()" library call, also introduced in 2.6, but that would require writing C code, and making it available from shell code, which seems like it's more work (if slightly more stable an interface). There also are ways to get this information on Solaris with dlinfo(), which may be more portable on other systems than getexecname(). http://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe has more, if you hadn't already gone looking. Danek