[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should I send a v2 patch?

From: Pádraig Brady
Subject: Re: Should I send a v2 patch?
Date: Tue, 7 Mar 2023 15:40:17 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Thunderbird/109.0

On 07/03/2023 12:07, Matheus Afonso Martins Moreira wrote:
In response to feedback I received in another thread:

I am prepared to write an updated patch if necessary.

Addressing the following concerns:

  - Bash already supports setting argv0

    It does and it almost worked. Unfortunately it introduces new variables,
    negating the use of env -i. Although I managed to unset the PWD variable,
    the SHLVL variable still persists. In the following example, program prints
    all arguments and environment variables:

        $ env -i bash -c 'exec -a program ./program'

        $ env -i bash -c 'unset SHLVL; unset PWD; exec -a program ./program'

    I am not sure if this would be better addressed in bash or env.
    Please let me know if I should submit a patch to bash instead.

  - Using --title instead of --name

    I chose --name in order to be consistent with bash's functionality.

        exec [-a name] [command [arguments]]

        If -a is supplied, the shell passes name as the zeroth argument
        to the executed command.

    I am prepared to change the option if necessary.
    I also suggest -a and --argv0, the former being consistent with bash.

  - NULL argv[0]

    I would be glad to add support for this.
    I feel like an additional --null-argv0 option is the best implementation.
    Given that program arguments can be arbitrary NUL-terminated strings,
    if env were to parse a literal "NULL" as a directive to set argv[0] to 0,
    it would preclude the user from setting argv[0] to "NULL".
    An additional option would explicitly denote the special value.

  - zsh supports ARGV0

    I did find that possible solution in my searches.
    However, it suffers from the same problem as the bash solution:
    variables still persist despite env -i, many more than bash,
    even after being unset:

        $ env -i zsh -c 'unset _ HOME PWD LOGNAME SHLVL OLDPWD; ARGV0=program 

For these reasons I think this would be a good feature for env.
I apologize for any mistakes, I'm still getting used to using mailing lists.

Thank you for your consideration,

No need for a V2 patch.
We're still considering and will adjust as needed.
Thanks for taking the time to analyze / summarize the points so far.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]