argument parsing error for shell script
Please see below.
$ uftrace record --force python -c 'print("Hello")'
Hello
$ uftrace record --force python3 -c 'print("Hello")'
python3: invalid option -- 'c'
Try 'python3 --help' for more information.
$ python3 -c 'print("Hello")'
Hello
As shown above, python3 doesn't properly accept -c option with uftrace.
The problem is because my system python3 is a shell script, which is located in a different place.
$ which python3
/home/honggyu/src/depot_tools/git/depot_tools/python3
It's actually a shell script.
$ cat /home/honggyu/src/depot_tools/git/depot_tools/python3
#!/usr/bin/env bash
base_dir=$(dirname "$0")
PYTHON3_BIN_RELDIR="$(cat $base_dir/python3_bin_reldir.txt | xargs echo)"
PATH="bootstrap-3.8.0b1.chromium.1_bin/python3/bin":"bootstrap-3.8.0b1.chromium.1_bin/python3/bin/Scripts":"$PATH"
"$base_dir/bootstrap-3.8.0b1.chromium.1_bin/python3/bin/python3" "$@"
It works fine if the proper path is given.
$ uftrace record --force /usr/bin/python3 -c 'print("Hello")'
Hello
It seems that we better pass the arguments properly even to shell script.
There's another case that should work fine.
$ uftrace record -P. -la ninja chrome
ninja: ‘chrome’: No such file or directory
$ ninja chrome
[1/1] Regenerating ninja files
...
What's the type of the ninja file? Is it a (shell) script?
Right. ninja is also a shell script file. It may be the same issue.
Could I take this issue?
Thanks @keltion. Sure, please go ahead and let me know if you have some issues.