bug-bash
[Top][All Lists]
Advanced

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

Re: >&"$var" broken in declare -f and exported functions


From: Namikaze Minato
Subject: Re: >&"$var" broken in declare -f and exported functions
Date: Mon, 6 Jun 2022 03:31:35 +0200

On Fri, 3 Jun 2022 at 23:24, Alexey <alukardd@alukardd.org> wrote:
>
> As I can see, problem exist only if we quote "$foo". Without quotes
> everything looks fine.
>
> > As a special case, if n is omitted, and word does not expand to one or
> > more digits or -, the standard output and standard error are redirected
> > as described previously.
> I guess this man line is related to this case, and explains why both
> stdin and stdout redirects occurs together (&>).


Hello Alexey.

Thank you for the workaround of removing the quotes.
And sorry for my being late to answer.

Please note however, that:

1 - n not being omited (and quotes being used) still produce the same bug:
$ f(){ printf test\\n 1>&"$foo"; }; declare -f f
f ()
{
    printf test\\n &> "$foo"
}

2 - Even if I somehow did misunderstand the manual, the bug really
existing is incontestable as 'declare -f' does not display the
function code being executed.
$ foo=1 test
test
$ # As you can see, it did not create a file named "1" but behaved
just as defined, like `printf test\\n 1>&1`
$ eval "$(declare -f f)"
$ foo=1 f
$ cat 1
test
$ # reading the code from 'declare -f' changed the function!

@everyone, please let me know if I need to do something else to
actually report the bug or if this thread is enough.

Regards,
Minato



reply via email to

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