-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix argument handling #578
Conversation
Signed-off-by: Konstantinos Kallas <[email protected]>
Signed-off-by: Konstantinos Kallas <[email protected]>
Pinging: if you can post a summary before hacking next week, I can promise to show up having thought about it. 😁 |
The goal is to correctly store input arguments separately (and not join them and resplit them), so that we can keep spaces between them. In addition, we want to restore the arguments without expanding them (so that things like I added a test file called $PASH_TOP/pa.sh test-star.sh foo '*' baz "hi there Michael" To resolve this, I came up with a partial solution that uses bash arrays to store the arguments. This would work out of the box if our unparser supported bash syntax, but since it does not, we have to do tricks like putting the bashism in a separate script and sourcing it (since the preprocessor can unparse a script that sources) (see https://github.com/binpash/pash/pull/578/files#diff-9117e6346fe0f0114b82710c6f433eccaeb3e07be02b26f00013024b1400af5a). This makes the preprocessed script look like this: { pash_previous_exit_status="${?}" ; }
{ { source /home/konstantinos/University/research/dish/runtime/save_args.sh "${@}" ; }
{ { pash_disable_parallel_pipelines=0 ; }
{ { source /home/konstantinos/University/research/dish/compiler/pash_runtime.sh /tmp/pash_iQnfOVm/tmpaf611ke8 /tmp/pash_iQnfOVm/tmpjqq8fmc4 --graphviz no --graphviz_dir /tmp --r_split_batch_size 1000000 --debug 1 --termination clean_up_graph --speculation no_spec --width 2 ; }
{ { set -- $(source /home/konstantinos/University/research/dish/runtime/restore_args.sh) ; }
{ ( exit "${pash_runtime_final_status}" ) ; } ; } ; } ; } ; }
{ pash_previous_exit_status="${?}" ; }
{ { source /home/konstantinos/University/research/dish/runtime/save_args.sh "${@}" ; }
{ { pash_disable_parallel_pipelines=1 ; }
{ { source /home/konstantinos/University/research/dish/compiler/pash_runtime.sh /tmp/pash_iQnfOVm/tmpqvb00t8a /tmp/pash_iQnfOVm/tmp1tey1ouu --graphviz no --graphviz_dir /tmp --r_split_batch_size 1000000 --debug 1 --termination clean_up_graph --speculation no_spec --width 2 ; }
{ { set -- $(source /home/konstantinos/University/research/dish/runtime/restore_args.sh) ; }
{ ( exit "${pash_runtime_final_status}" ) ; } ; } ; } ; } ; } while in the ## Store
export pash_input_args=( "$@" )
## Restore
set -- "${pash_input_args[@]}" Unfortunately, I can't find a way to restore using a separate script, i.e., $PASH_TOP/pa.sh test-star.sh foo '*' baz "hi there Michael"
foo
*
baz
hi there Michael
"foo"
"*"
"baz"
"hi
there
Michael" This shows that the first storing (in preprocessed script) and the first restoring (in Some ideas are:
|
Signed-off-by: Konstantinos Kallas <[email protected]>
Signed-off-by: Konstantinos Kallas <[email protected]>
Signed-off-by: Konstantinos Kallas <[email protected]>
Signed-off-by: Konstantinos Kallas <[email protected]>
Signed-off-by: Konstantinos Kallas <[email protected]>
@mgree I think this is done, we should review it on Thursday and merge it! |
OS:ubuntu-20.04 |
OS = Debian 10
|
OS:ubuntu-20.04 |
OS:ubuntu-18.04 |
OS = Debian 10
|
FYI, the solution involves:
|
Signed-off-by: Konstantinos Kallas <[email protected]>
OS:ubuntu-18.04 |
OS:ubuntu-20.04 |
OS = Debian 10
|
Working to fix issue: #570
Signed-off-by: Konstantinos Kallas [email protected]