-
Notifications
You must be signed in to change notification settings - Fork 500
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
record: Find the execution binary in PATH #741
Conversation
Hi @namhyung, I think we better find the executable file in
I thought that giving a full pathname or using |
4f81f84
to
5a24e7f
Compare
cmds/record.c
Outdated
|
||
/* search opts->exename in PATH one by one */ | ||
p = strchr(path, ':'); | ||
while (p) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'd better using strv
for this kind of string handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied.
cmds/record.c
Outdated
@@ -1510,14 +1553,11 @@ static void check_binary(struct opts *opts) | |||
}; | |||
|
|||
again: | |||
pr_dbg3("checking binary %s\n", opts->exename); | |||
pr_dbg("checking binary %s\n", opts->exename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about moving this under the find_in_path()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I move this message inside find_in_path
, then it will not print anything when the user gives the full pathname. The first is_regular_executable
check will be successful so doesn't call find_in_path
in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I meant the callsite - as find_in_path()
can change the exename, it'd be nice to print the final name IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I think it's enough to place after the searching the binary as I updated. Thanks.
@namhyung I just updated it again based on your feedback. Thanks! |
Currently uftrace explicitly requires to have a correct pathname, so it has to be used with full pathname as follows: $ uftrace --force /usr/bin/python -c '' This patch allows the user can provide the command name, which is placed one of directories in PATH environment. So uftrace can be simply used as follows: $ uftrace --force python -c '' It'd be helpful especially when tracing with -P option and it will make easier to use full dynamic tracing feature as follows: $ uftrace -P. -a python -c 'print("Hi, Python")' Closes: namhyung#474 Signed-off-by: Honggyu Kim <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for merging this. Let's modify documents that includes the absolute path and |
You can file an issue for that. :) |
Currently uftrace explicitly requires to have a correct pathname, so it
has to be used with full pathname as follows:
This patch allows the user can provide the command name, which is placed
one of directories in PATH environment.
So uftrace can be simply used as follows:
It'd be helpful especially when tracing with -P option and it will make
easier to use full dynamic tracing feature as follows:
Closes: #474
Signed-off-by: Honggyu Kim [email protected]