[PATCH] small test for Bug 12558
vl at samba.org
vl at samba.org
Mon Apr 10 12:40:23 UTC 2017
Hi!
Before we enter a flamewar about 80 cols vs proper shell coding style
I think we could also opt to just not use this patch and cross fingers
that next time this bug does not happen.
Volker
On Mon, Apr 10, 2017 at 09:59:14PM +1000, Martin Schwenke via samba-technical wrote:
> On Sun, 9 Apr 2017 10:37:03 +0200, vl--- via samba-technical
> <samba-technical at lists.samba.org> wrote:
>
> > If someone know the shell quoting magic to get this under 80 columns,
> > I'll be happy to change this :-)
>
> Not in the way it is currently done. The eval is there to expand "$@",
> which just seems crazy. In other places the only reason the command is
> assigned to a variable is so it can be printed before running it.
> You're not doing that in this case so you could just put the command in
> the sub-shell.
>
> However, if you want to print the command then doing something like
> the following seems like a reasonable approximation:
>
> out=$(set -x; \
> $SMBCLIENT "$@" \
> -U$USERNAME%$PASSWORD //$SERVER/msdfs-share \
> -I $SERVER_IP $ADDARGS -m nt1 -c dir 2>&1)
>
> You get sane quoting (in fact you can sensibly quote whatever you like,
> such as "$SMBCLIENT") and the "set -x" causes the command to be printed
> with leading "+ ".
>
> If you don't want the leading "+ " then you can set PS4="" in the
> sub-shell before the "set -x":
>
> out=$(PS4=""; set -x; \
> $SMBCLIENT "$@" \
> -U$USERNAME%$PASSWORD //$SERVER/msdfs-share \
> -I $SERVER_IP $ADDARGS -m nt1 -c dir 2>&1)
>
> PS4 could be set globally for the whole script... but that might
> confuse anyone who runs the script with an explicit "sh -x ..." for
> debugging. :-)
>
> peace & happiness,
> martin
>
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
Samba eXPerience 2017, Hotel Freizeit In
2nd-4th of May 2017, http://sambaXP.org
More information about the samba-technical
mailing list