mailing list of musl libc
 help / color / mirror / code / Atom feed
From: mzpqnxow <musl@mzpqnxow.com>
To: musl@lists.openwall.com
Subject: Re: Question about setting argv[0] when manually using dynamic linker
Date: Wed, 17 May 2017 16:07:21 +0000	[thread overview]
Message-ID: <CA+qPFcLsZ8iEBxRrWYj82aEcKzeNYv7_kqMrjRnOROrgmkSupA@mail.gmail.com> (raw)
In-Reply-To: <CA+qPFcL4JzAbNXiL_0oFhTBfAH3+gBYfpeyc0Ved+ZmYMG1D=A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

BTW, the shell built-in "exec" has -a which can be used to set argv[0]

Again though, I'm not entire sure I understand your use, so ignore this if
it's irrelevant :>

On Wed, May 17, 2017 at 07:00 mzpqnxow <musl@mzpqnxow.com> wrote:

> Is there any reason you want to avoid simply statically linking the
> program(s) so that it needs no libc or other shared objects at all?
>
> Or did I misunderstand what you're trying to do?
>
> On Wed, May 17, 2017 at 05:05 <u-uy74@aetey.se> 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.
>>  ...
>> > I'd like to retain whatever was actually typed on the command line (in
>> this
>> > case, set argv[0] to "app"), since many apps look at argv[0] to change
>> > behavior, ie - gzip vs gunzip.
>> >
>> > I tried seeing if there was some switch I could pass to the linker, etc
>> -
>> > as far as I can tell, there's no easy way to do this.
>>
>> 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.
>>
>> There is imho hardly any incentive to put such functionalty into the
>> loader. I say this even though we are dependent here on such tricks,
>> to work around programs which insist on guessing things when not asked to.
>>
>> Regards,
>> Rune
>>
>>

[-- Attachment #2: Type: text/html, Size: 2138 bytes --]

  reply	other threads:[~2017-05-17 16:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17  0:38 John Regan
2017-05-17  9:01 ` u-uy74
2017-05-17 11:00   ` mzpqnxow
2017-05-17 16:07     ` mzpqnxow [this message]
2017-05-17 16:16       ` John Regan
2017-05-17 16:24         ` Rich Felker
2017-05-17 19:07           ` u-uy74
2017-05-17 19:16             ` John Regan
2017-05-17 21:10               ` u-uy74
2017-05-17 21:15               ` mzpqnxow
2017-05-17 21:22                 ` John Regan
2017-07-02 17:36           ` u-uy74
2017-07-04 20:58             ` Rich Felker
2017-07-05  6:01               ` u-uy74
2017-07-09  9:23               ` u-uy74
2017-07-09 12:23                 ` Rich Felker
2017-07-09 14:04                   ` u-uy74

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+qPFcLsZ8iEBxRrWYj82aEcKzeNYv7_kqMrjRnOROrgmkSupA@mail.gmail.com \
    --to=musl@mzpqnxow.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).