On August 10, 2017 3:02:03 PM GMT+03:00, Kilian Krause <kil...@debian.org> 
wrote:
>Hi Dmitriy,
>
>since your bug actually breaks non-VERBOSE mode, I'd suggest using as
>patch:
>--(snip)--
># diff -u /etc/wpa_supplicant/functions.sh /tmp/functions.sh 
>--- /etc/wpa_supplicant/functions.sh    2017-02-20 11:55:11.000000000
>+0100
>+++ /tmp/functions.sh   2017-08-10 13:58:58.532248148 +0200
>@@ -49,7 +49,7 @@
> 
> # verbosity variables
> if [ -n "$IF_WPA_VERBOSITY" ] || [ "$VERBOSITY" = "1" ]; then
>-       TO_NULL="/dev/stdout"
>+       TO_NULL="&1"
>        DAEMON_VERBOSITY="--verbose"
> else
>        TO_NULL="/dev/null"
>@@ -117,7 +117,7 @@
>                        ;;
>                "stderr")
>                        shift
>-                       echo "$WPA_SUP_PNAME: $@" >/dev/stderr
>+                       echo "$WPA_SUP_PNAME: $@" >&2
>                        ;;
>                *)
>                        ;;
># 
>--(snip)--
>
>That one works for me and does maintain the current feature set.
>
>Best,
>Kilian

Hi.

I don't understand your patch. Following constructs do not work for me:

$ sh -c '( v="&1"; echo abc >$v; )'
$ sh -c '( v="/dev/null"; echo abc >$v; )'
$ bash -c '( v="&1"; echo abc >$v; )'
$ bash -c '( v="/dev/null"; echo abc >$v; )'
$

Only this one does:

$ sh -c '( v="&1"; eval "echo abc >$v"; )'
abc
$ sh -c '( v="/dev/null"; eval "echo abc >$v"; )'
$

In other words, as far as i understand, your patch breaks verbose mode.

But mine seems breaking non-verbose mode, yes, i see that now. I'm not sure,
whether using `eval` is a good fix. If not, `echo` lines may be rewritten
to
use separate function, which will log appropriately. And `wpa_cli`.. also
may
be rewritten as function. E.g.

run_and_log wpa_cli $WPACLISET_VARIABLE "$WPACLISET_VALUE"

which will just treat its first argument as command, or (may be safer) as

wpa_cli_wlog $WPACLISET_VARIABLE "$WPACLISET_VALUE"

which will just handle verbosity as appropriate.

(i didn't test this, just speculating and may be wrong.)

Reply via email to