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\# } } ------------------------------------------------------------------------ Harvey Am 14.02.24 um 19:06 schrieb Harvey:
Hello, I am part of the team of a small router distribution called fli4l: https://www.fli4l.de/doku.php?id=start. We use buildroot to generate our images. Due to a hardware crash and the leaving of our main developer we are facing the dead of our project. But there are still some people left and at least we want to try to keep it alive 😉 That said - the first we have to try is the update of our buildroot base. A lot of work is already done and but we struggle with the busybox update, especially with the ash shell contained. When updating to Version 1.36.1 we are facing script failures in places that did work until busybox 1.31.1. I have tried to debug the code and it seems that the error is contained in a helper include for string handling. The code is: ------------------------------------------------------------------------ # 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\# } } ------------------------------------------------------------------------ The debug trace (using set -x) in V1.31.1 looks like this: + pack_args exit_trap_0 sync_unlock_all_resources + local _p '_resvar=exit_trap_0' '_result=' _value + shift + _result=' '"'"'sync_unlock_all_resources'"'" + eval 'exit_trap_0=${_result#' '}' + exit_trap_0=''"'"'sync_unlock_all_resources'"'" + exit_trap_num=1 + return 0 ------------------------------------------------------------------------ while in V1.36.1 it looks like this: + pack_args exit_trap_0 sync_unlock_all_resources + local _p '_resvar=exit_trap_0' '_result=' _value + shift + _result=' '"'"'sync_unlock_all_resources'                                          ^^^^ missing quote + eval 'exit_trap_0=${_result#' '}' + exit_trap_0=''"'"'sync_unlock_all_resources'                                             ^^^^ missing quote + exit_trap_num=1 + return 0 The eval line then fails with 'Unterminated quoted string' Unfortunately I can't tell where the difference lies. I hope someone can help or at least point me in the right direction. Greetings Harvey _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox