-
Notifications
You must be signed in to change notification settings - Fork 480
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: #1690 unable to identify shebang when it has initial spaces #1697
Conversation
utils/utils.h
Outdated
@@ -327,6 +327,31 @@ static inline char *has_kernel_filter(char *buf) | |||
return NULL; | |||
} | |||
|
|||
// this code is copy from event-utils.h | |||
static inline char *str_trim(char *string) |
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.
Please make it not inlined, and move it to utils.c file. Also I prefer a short name like 'str' or just 's' instead of 'string'.
utils/utils.h
Outdated
break; | ||
string++; | ||
} | ||
ret = string; |
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.
Actually the trim function can have two separate siblings like 'ltrim' and 'rtrim'. The above is ltrim which works for beginning of the input string (the left part). While the rtrim would work for the end of the input string (the right part).
What we actually need here is 'ltrim'. So please add both ltrim and rtrim and use ltrim here.
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.
copy that, thanks
cmds/record.c
Outdated
@@ -1608,7 +1608,8 @@ static void check_binary(struct uftrace_opts *opts) | |||
pr_err("Cannot read '%s'", opts->exename); | |||
|
|||
if (memcmp(elf_ident, ELFMAG, SELFMAG)) { | |||
char *script = check_script_file(opts->exename); | |||
// for issue 1690 unable to identify shebang when it has initial spaces |
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 prefer C-style comments (with /* ... */
) over C++ (with // ...
). But I think we can just get rid of it.
@namhyung fixed thank you very much for your kind review |
Hi @yihong0618, thanks for working on this.
Could you please write your real name in your git author name instead of |
813d6f7
to
d9c9031
Compare
sorry I changed it but DCO failed |
Maybe can I ask you to do this way? For example, I assume your name is "Yi Hong". (sorry if not)
|
@honggyukim thanks for that, really learned a lot. |
It looks good now.
I'm sorry for asking another change again, but your description mentions
But it doesn't show the info at the BELOW. Could you rewrite it this way?
If you don't want to update again, then it's okay to skip it. |
will do this now. |
Python tracing won't work when the shebang line has a space like below: #! /usr/bin/env python3 This patch makes uftrace to understand the above shebang as well. Fixed: namhyung#1690 Signed-off-by: Yi Hong <[email protected]>
@honggyukim Done and thanks again |
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 your work!
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
Hmm.. Shouldn't we handle the trailing whitespaces? We may need another |
I'll try it. |
fix: #1690
Signed-off-by: Yi Hong [email protected]