From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11343 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 23:10:18 +0200 Message-ID: <20170517211018.GN6320@example.net> References: <20170517070115.GL6320@example.net> <20170517162428.GH17319@brightrain.aerifal.cx> <20170517190705.GM6320@example.net> 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 1495055449 29166 195.159.176.226 (17 May 2017 21:10:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 17 May 2017 21:10:49 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-11358-gllmg-musl=m.gmane.org@lists.openwall.com Wed May 17 23:10:42 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 1dB6DS-0007Pp-0E for gllmg-musl@m.gmane.org; Wed, 17 May 2017 23:10:42 +0200 Original-Received: (qmail 24560 invoked by uid 550); 17 May 2017 21:10:45 -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 24541 invoked from network); 17 May 2017 21:10:45 -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=1495055434; x=1496869835; bh=GlLDfHbsk hmACEKwYbJO6mPrDxTkMGCfrmhHYYHbmRI=; b=QfVQyNbNqDoWOVICUed5P/ODR HC4BQk1EdWU4bRpljY2QfDX/IXqNubEd5L0rfzDn+oQP75knGuRP8MqBLsPSKWwF oVbMIIPcnoKT0H6rHQWMvr9Ccg/VcmFjBHRTBBaD9rFlv9lBNQhfaSf219nC1JRj thLVkuPtbYTCyqE4tQ= X-Virus-Scanned: Debian amavisd-new at fripost.org Content-Disposition: inline In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:11343 Archived-At: On Wed, May 17, 2017 at 02:16:09PM -0500, John Regan wrote: > On Wed, May 17, 2017 at 2:07 PM, wrote: > > 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]. > I wrote and compiled a short program that just dumps the elements in argv, > then a wrapper program that figures out the needed paths for libc, real > binary, etc, but it seems like argv[0] gets reset by the dynamic loader. Oh, here you caught me. Apologies. Indeed the program does not see argv[0] because the linker shifts the arguments. Please disregard my statement above. It is "correct" to the point that it works but yes we have to do unpleasant tricks for the programs analyzing argv[0], I just happened to have repressed that pain. (We do also reset argv[0] but for an unrelated purpose, I confused the two cases and posted without verifying). Rich is right, there is indeed no good alternative to --argv0=foo. It would be welcome. Sorry for the noise! Rune