Failing shell code under busybox 1.36.1 that worked with 1.31.1
David Laight
David.Laight at ACULAB.COM
Thu Feb 15 10:20:35 UTC 2024
From: Harvey
> Sent: 14 February 2024 18:18
> Sorry, posted the wrong version of the pack_args() funtion:
> I have payed with possible solutions for so long that I forgot the
> restore the original before posting -blush-
>
> Here is the original version:
> ------------------------------------------------------------------------
>
> # Packs arguments into a single string.
> #
> # Input:
> # $1 = name of variable receiving the arguments in such a way that
> # (re)evaluating them provides the original arguments
> # $2... = arguments
> # Example:
> # func() {
> # local args
> # pack_args args "$@"
> # send_rpc func_impl "$args"
> # }
> # # (in another process)
> # receive_rpc() {
> # local func="$1"
> # local args="$2"
> # eval $func "$args"
> # }
> pack_args()
> {
> local _p _resvar=$1 _result= _value
> shift
> for _p
> do
> _result="$_result '${_p//'/'\"'\"'}'"
> done
> eval $_resvar=\${_result\# }
> }
Try just splitting the quoting of the final '
Just adding "" before it might be enough.
Failing that add it on the next line.
Probably easier than trying to find the bug in ash.
(been there, done that...)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
More information about the busybox
mailing list