From: ludo@gnu.org (Ludovic Courtès)
To: Eric Bavier <ericbavier@openmailbox.org>
Cc: Help-Guix <help-guix-bounces+ericbavier=openmailbox.org@gnu.org>,
help-guix@gnu.org
Subject: Re: [UX] real names exposed
Date: Thu, 01 Sep 2016 10:59:02 +0200 [thread overview]
Message-ID: <87wpiwt2qx.fsf@gnu.org> (raw)
In-Reply-To: <b38f200f5083ed65d1813e281f9e8cd0@openmailbox.org> (Eric Bavier's message of "Wed, 31 Aug 2016 18:33:53 -0500")
Eric Bavier <ericbavier@openmailbox.org> skribis:
> On 2016-08-31 18:11, Leo Famulari wrote:
>> On Wed, Aug 31, 2016 at 02:25:49PM -0400, Troy Sankey wrote:
>>> I understand why this happens:
>>>
>>> % khal --help
>>> Usage: .khal-real [OPTIONS] COMMAND [ARGS]...
>>> [...]
>>>
>>> but I think it sorta sucks for user experience. Just thought I'd
>>> point this
>>> out, and I was wondering if there were any ideas to address this.
>>>
>>> Specifically, argv[0] references the name of the "real" executable,
>>> rather than
>>> the guix wrapper. This is almost always benign, but it looks ugly
>>> in help
>>> menus.
>>
>> I wonder if the Khal author (Christian) intends for users to rename the
>> executable. Otherwise, why use argv[0]? Is it some side-effect of a
>> documentation tool used by Khal?
>>
>> I would understand if khal and ikhal were the same executable, and
>> behavior was changed based on argv[0], but that's not the case.
>>
>> It does look ugly.
>
> It's not just khal. Most other executables and scripts that reference
> argv[0] or $0 end up with the *=real string.
>
> In our wrapper scripts, we pass -a to exec, which is supposed to
> address this issue, but for some reason it seems ineffective.
‘exec -a’ works as advertised:
--8<---------------cut here---------------start------------->8---
$ sh -c 'exec -a FOO guile -c "(pk (command-line))"'
;;; (("FOO"))
--8<---------------cut here---------------end--------------->8---
Yet:
--8<---------------cut here---------------start------------->8---
$ sh -c 'exec -a FOO /gnu/store/6vmniz83k46l8jpry50wdvwxsncz1r5w-khal-0.7.0/bin/.khal-wrap-01 --version'
.khal-real, version 0.7.0
--8<---------------cut here---------------end--------------->8---
And in fact:
--8<---------------cut here---------------start------------->8---
$ cat > t.py
import sys
print(sys.argv[0])
$ sh -c 'exec -a FOO python3 t.py'
t.py
--8<---------------cut here---------------end--------------->8---
… even though argv[0] is initially correct:
--8<---------------cut here---------------start------------->8---
$ sh -c 'exec -a FOO python3 --help' | head -1
usage: FOO [option] ... [-c cmd | -m mod | file | -] [arg] ...
--8<---------------cut here---------------end--------------->8---
So somewhere, Python finds out the real name, but it doesn’t seem to be
via /proc/cmdline or anything like that, and I couldn’t find the exact
hack in the source.
Ideas?
I would really like to fix it in ‘core-updates’.
Ludo’.
next prev parent reply other threads:[~2016-09-01 8:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-31 18:25 [UX] real names exposed Troy Sankey
2016-08-31 23:11 ` Leo Famulari
2016-08-31 23:33 ` Eric Bavier
2016-09-01 8:59 ` Ludovic Courtès [this message]
2016-09-03 15:30 ` Troy Sankey
2016-09-03 22:21 ` Troy Sankey
2016-09-04 19:38 ` Ludovic Courtès
2016-09-03 22:33 ` Ludovic Courtès
2016-09-04 19:41 ` Ludovic Courtès
2016-09-06 3:09 ` Eric Bavier
2016-09-07 22:04 ` Ludovic Courtès
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wpiwt2qx.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=ericbavier@openmailbox.org \
--cc=help-guix-bounces+ericbavier=openmailbox.org@gnu.org \
--cc=help-guix@gnu.org \
/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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).