Re: [PATCH 1/2] selftests/ftrace: Force C locale for readelf in uprobe test

"Rui Qi" <[email protected]>
Newsgroups org.kernel.vger.linux-kselftest,org.kernel.vger.linux-kernel,org.kernel.vger.linux-trace-kernel
Message-ID <[email protected]>
On 8/7/26 9:47 AM, Masami Hiramatsu (Google) wrote:
> On Thu,  6 Aug 2026 16:31:00 +0800
> "Rui Qi" <[email protected]> wrote:
> 
>> The add_remove_uprobe test parses the entry point from readelf -h output
>> by looking for the English "Entry" field. readelf output is localized
>> via gettext, while the ftracetest runner does not force LC_ALL=C and the
>> top-level Makefile leaves LANG effective for child processes.
> 
> Hmm, to make it safer, I think we should force LC_ALL=C in the top level
> of ftracetest, instead of setting it in each test case.
> 
> Thank you,
> 

Thank you for the suggestion.

Agreed, setting LC_ALL=C in the ftracetest runner is better than fixing
this one readelf invocation. I will update ftracetest to export LC_ALL=C
so all test cases inherit the C locale, and send a v2.

Thanks,
Rui


>>
>> If readelf prints a translated field name, ENTRYPOINT becomes empty and
>> the uprobe_events write is rejected because the offset after PATH: is
>> missing.
>>
>> Run readelf with LC_ALL=C so the parsed header field remains stable
>> across locales.
>>
>> Signed-off-by: Rui Qi <[email protected]>
>> ---
>>  .../selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc       | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc
>> index f2048c244526..f33a863be68b 100644
>> --- a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc
>> +++ b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_uprobe.tc
>> @@ -12,7 +12,7 @@ echo 0 > events/enable
>>  echo > dynamic_events
>>  
>>  REALBIN=`readlink -f /bin/sh`
>> -ENTRYPOINT=`readelf -h ${REALBIN} | grep Entry | sed -e 's/[^0]*//'`
>> +ENTRYPOINT=`LC_ALL=C readelf -h ${REALBIN} | grep Entry | sed -e 's/[^0]*//'`
>>  
>>  echo "p:myevent ${REALBIN}:${ENTRYPOINT}" >> uprobe_events
>>  
>> -- 
>> 2.20.1
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.