From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.user Subject: Re: guile-2.0 on mingw: the sequel Date: Sun, 25 Aug 2013 15:50:34 -0400 Message-ID: <874nada6t1.fsf@tines.lan> References: <83vc2wj4hz.fsf@gnu.org> <877gfccueo.fsf@tines.lan> <83d2p4ifow.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1377460270 22769 80.91.229.3 (25 Aug 2013 19:51:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Aug 2013 19:51:10 +0000 (UTC) Cc: guile-user@gnu.org To: Eli Zaretskii Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Aug 25 21:51:11 2013 Return-path: Envelope-to: guile-user@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 1VDgL9-0007UU-8Q for guile-user@m.gmane.org; Sun, 25 Aug 2013 21:51:11 +0200 Original-Received: from localhost ([::1]:47463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDgL8-0005og-Tg for guile-user@m.gmane.org; Sun, 25 Aug 2013 15:51:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDgKv-0005oQ-VL for guile-user@gnu.org; Sun, 25 Aug 2013 15:51:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VDgKo-0005cv-3r for guile-user@gnu.org; Sun, 25 Aug 2013 15:50:57 -0400 Original-Received: from world.peace.net ([96.39.62.75]:40266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDgKn-0005cp-Vx; Sun, 25 Aug 2013 15:50:50 -0400 Original-Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1VDgKg-0007nc-Ne; Sun, 25 Aug 2013 15:50:42 -0400 In-Reply-To: <83d2p4ifow.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 23 Aug 2013 18:34:39 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 96.39.62.75 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10700 Archived-At: Eli Zaretskii writes: >> From: Mark H Weaver >> Cc: Eli Zaretskii , "guile-user\@gnu.org" >> Date: Fri, 23 Aug 2013 11:13:19 -0400 >> >> Of course, ideally we would allow the entire Guile install to be freely >> relocatable, as Windows users have come to expect. This would require >> some help from a Windows developer. > > Why should this feature be limited to Windows builds of Guile? Why > not make it work for Posix platforms as well? Some other projects > already do, they use argv[0] and PATH search to find the place where > the executable is installed, and record relative file names from > there. Well, that's not generally how things are done on POSIX systems, and furthermore I don't see how this could be made to work reliably on POSIX. The location of the Guile executable is sometimes not found in either argv[0] or PATH. For example, if you run the following script: --8<---------------cut here---------------start------------->8--- #!/usr/local/bin/guile -s !# (format #t "~s~%" (program-arguments)) --8<---------------cut here---------------end--------------->8--- argv[0] will point to the script, not the Guile executable. I suppose we could detect if argv[0] points to a script and read the shebang (and iterate, if the shebang points to another script), but even that doesn't cover all cases. It's possible to pass any arbitrary value for argv[0] using the 'exec' family of system calls. Regards, Mark