From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11341 Path: news.gmane.org!.POSTED!not-for-mail From: u-uy74@aetey.se Newsgroups: gmane.linux.lib.musl.general Subject: Re: Question about setting argv[0] when manually using dynamic linker Date: Wed, 17 May 2017 21:07:05 +0200 Message-ID: <20170517190705.GM6320@example.net> References: <20170517070115.GL6320@example.net> <20170517162428.GH17319@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1495048064 8455 195.159.176.226 (17 May 2017 19:07:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 17 May 2017 19:07:44 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-11356-gllmg-musl=m.gmane.org@lists.openwall.com Wed May 17 21:07:41 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dB4IM-00025k-Vi for gllmg-musl@m.gmane.org; Wed, 17 May 2017 21:07:39 +0200 Original-Received: (qmail 32172 invoked by uid 550); 17 May 2017 19:07:41 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 32151 invoked from network); 17 May 2017 19:07:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fripost.org; h= in-reply-to:content-disposition:content-type:content-type :mime-version:references:message-id:subject:subject:from:from :date:date; s=20140703; t=1495048049; x=1496862450; bh=2bYQWgObn Y000UG/rlCb+u9qLaqtz7O6K5fN9zn35iw=; b=EMikYfUIdqaK5MqWnMfMcnwJZ 8s4XHydT2bODv3HqMj2PRYLdIlb+iplQOYIcqG+zUn+eZgjBq6upS914NGxAPQNQ 8FFSh01ZiqAd1CW4uErsYNpPJkLdufqvwYKhpjopYNQgHwbjz7mP4Ym9KqB/HRY8 ufRVgCX7TG+Z/9bIM0= X-Virus-Scanned: Debian amavisd-new at fripost.org Content-Disposition: inline In-Reply-To: <20170517162428.GH17319@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:11341 Archived-At: On Wed, May 17, 2017 at 12:24:28PM -0400, Rich Felker wrote: > > >>> On Tue, May 16, 2017 at 08:38:56PM -0400, John Regan wrote: > > >>> > Hi there - I was wondering if it's possible to somehow set argv[0] when > > >>> > calling the dynamic linker to load a program. > > >>> Set argv[0] to whatever you need when you exec*() the dynamic loader, > > >>> which is straightforward with a binary wrapper (not with a shell). > > >>> > > >>> A binary wrapper also adds less overhead then going through a shell. > > >>> Rune > a completely reasonable and recommended way for deploying dynamic > linked apps in a self-contained way that doesn't depend on musl libc > on the host. Unfortunately there's no way to set argv[0] like you want We do deploy dynamic linked apps without any dependencies on the libraries on the host. It works just fine with musl-as-it-is, including the questionably designed applications like busybox and gcc who analyze argv[0]. > at this time. Perhaps adding an option like --argv0=foo would be > appropriate. What would be the justification for adding the supporting code (to every instance of the dynamic loader)? It looks like --argv0=foo is meant to overcome a specific limitation in bourne shell, in a specific context where the task can be solved easily and generally better without involving the bourne shell in the first hand. I would like to see an example of a situation where a wrapper in C (or any language allowing setting of argv[0]) is less appropriate? If one really has a reason to express the wrapper in sh, a one-liner in C and an extra exec from the shell (much cheaper than starting the shell itself was) is sufficient to make it work. Rune