[PATCH] selftests/ftrace: Drop invalid top-level local in test_ownership

CaoRuichuang posted 1 patch 2 months, 1 week ago
tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] selftests/ftrace: Drop invalid top-level local in test_ownership
Posted by CaoRuichuang 2 months, 1 week ago
From: Cao Ruichuang <create0818@163.com>

test_ownership.tc is sourced by ftracetest under /bin/sh.

The script currently declares mount_point with local at file scope,
which makes /bin/sh abort with "local: not in a function" before the
test can reach the eventfs ownership checks.

Replace the top-level local declaration with a normal shell variable so
kernels that support the gid= tracefs mount option can run the test at
all.

Signed-off-by: Cao Ruichuang <create0818@163.com>
---
 tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc b/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
index e71cc3ad0..6d00d3c0f 100644
--- a/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
+++ b/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
@@ -6,7 +6,7 @@
 original_group=`stat -c "%g" .`
 original_owner=`stat -c "%u" .`
 
-local mount_point=$(get_mount_point)
+mount_point=$(get_mount_point)
 
 mount_options=$(get_mnt_options "$mount_point")
 
-- 
2.39.5 (Apple Git-154)
Re: [PATCH] selftests/ftrace: Drop invalid top-level local in test_ownership
Posted by Steven Rostedt 2 months, 1 week ago
Shuah,

Care to take this through your tree. Probably could even add:

Cc: stable@vger.kernel.org
Fixes: 8b55572e51805 ("tracing/selftests: Add tracefs mount options test")

As well as:

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve


On Tue,  7 Apr 2026 18:26:13 +0800
CaoRuichuang <create0818@163.com> wrote:

> From: Cao Ruichuang <create0818@163.com>
> 
> test_ownership.tc is sourced by ftracetest under /bin/sh.
> 
> The script currently declares mount_point with local at file scope,
> which makes /bin/sh abort with "local: not in a function" before the
> test can reach the eventfs ownership checks.
> 
> Replace the top-level local declaration with a normal shell variable so
> kernels that support the gid= tracefs mount option can run the test at
> all.
> 
> Signed-off-by: Cao Ruichuang <create0818@163.com>
> ---
>  tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc b/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
> index e71cc3ad0..6d00d3c0f 100644
> --- a/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
> +++ b/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
> @@ -6,7 +6,7 @@
>  original_group=`stat -c "%g" .`
>  original_owner=`stat -c "%u" .`
>  
> -local mount_point=$(get_mount_point)
> +mount_point=$(get_mount_point)
>  
>  mount_options=$(get_mnt_options "$mount_point")
>
Re: [PATCH] selftests/ftrace: Drop invalid top-level local in test_ownership
Posted by Masami Hiramatsu (Google) 1 week, 6 days ago
On Tue, 7 Apr 2026 20:37:27 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> 
> Shuah,
> 
> Care to take this through your tree. Probably could even add:
> 
> Cc: stable@vger.kernel.org
> Fixes: 8b55572e51805 ("tracing/selftests: Add tracefs mount options test")
> 
> As well as:
> 
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> 

Shuah, here is my ack too.

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

BTW, to avoid similar issue, 

Thanks, 

> -- Steve
> 
> 
> On Tue,  7 Apr 2026 18:26:13 +0800
> CaoRuichuang <create0818@163.com> wrote:
> 
> > From: Cao Ruichuang <create0818@163.com>
> > 
> > test_ownership.tc is sourced by ftracetest under /bin/sh.
> > 
> > The script currently declares mount_point with local at file scope,
> > which makes /bin/sh abort with "local: not in a function" before the
> > test can reach the eventfs ownership checks.
> > 
> > Replace the top-level local declaration with a normal shell variable so
> > kernels that support the gid= tracefs mount option can run the test at
> > all.
> > 
> > Signed-off-by: Cao Ruichuang <create0818@163.com>
> > ---
> >  tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc b/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
> > index e71cc3ad0..6d00d3c0f 100644
> > --- a/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
> > +++ b/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
> > @@ -6,7 +6,7 @@
> >  original_group=`stat -c "%g" .`
> >  original_owner=`stat -c "%u" .`
> >  
> > -local mount_point=$(get_mount_point)
> > +mount_point=$(get_mount_point)
> >  
> >  mount_options=$(get_mnt_options "$mount_point")
> >  
> 
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>
Re: [PATCH] selftests/ftrace: Drop invalid top-level local in test_ownership
Posted by Steven Rostedt 1 month ago
Shuah,

Can you pull this into your urgent branch?

Thanks,

-- Steve


On Tue, 7 Apr 2026 20:37:27 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Shuah,
> 
> Care to take this through your tree. Probably could even add:
> 
> Cc: stable@vger.kernel.org
> Fixes: 8b55572e51805 ("tracing/selftests: Add tracefs mount options test")
> 
> As well as:
> 
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> 
> -- Steve
> 
> 
> On Tue,  7 Apr 2026 18:26:13 +0800
> CaoRuichuang <create0818@163.com> wrote:
> 
> > From: Cao Ruichuang <create0818@163.com>
> > 
> > test_ownership.tc is sourced by ftracetest under /bin/sh.
> > 
> > The script currently declares mount_point with local at file scope,
> > which makes /bin/sh abort with "local: not in a function" before the
> > test can reach the eventfs ownership checks.
> > 
> > Replace the top-level local declaration with a normal shell variable so
> > kernels that support the gid= tracefs mount option can run the test at
> > all.
> > 
> > Signed-off-by: Cao Ruichuang <create0818@163.com>
> > ---
> >  tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc b/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
> > index e71cc3ad0..6d00d3c0f 100644
> > --- a/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
> > +++ b/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
> > @@ -6,7 +6,7 @@
> >  original_group=`stat -c "%g" .`
> >  original_owner=`stat -c "%u" .`
> >  
> > -local mount_point=$(get_mount_point)
> > +mount_point=$(get_mount_point)
> >  
> >  mount_options=$(get_mnt_options "$mount_point")
> >    
>
Re: [PATCH] selftests/ftrace: Drop invalid top-level local in test_ownership
Posted by Steven Rostedt 2 weeks, 2 days ago
Shuah,

Ping?

-- Steve


On Wed, 13 May 2026 11:02:08 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Shuah,
> 
> Can you pull this into your urgent branch?
> 
> Thanks,
> 
> -- Steve
> 
> 
> On Tue, 7 Apr 2026 20:37:27 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
> 
> > Shuah,
> > 
> > Care to take this through your tree. Probably could even add:
> > 
> > Cc: stable@vger.kernel.org
> > Fixes: 8b55572e51805 ("tracing/selftests: Add tracefs mount options test")
> > 
> > As well as:
> > 
> > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> > 
> > -- Steve
> > 
> > 
> > On Tue,  7 Apr 2026 18:26:13 +0800
> > CaoRuichuang <create0818@163.com> wrote:
> >   
> > > From: Cao Ruichuang <create0818@163.com>
> > > 
> > > test_ownership.tc is sourced by ftracetest under /bin/sh.
> > > 
> > > The script currently declares mount_point with local at file scope,
> > > which makes /bin/sh abort with "local: not in a function" before the
> > > test can reach the eventfs ownership checks.
> > > 
> > > Replace the top-level local declaration with a normal shell variable so
> > > kernels that support the gid= tracefs mount option can run the test at
> > > all.
> > > 
> > > Signed-off-by: Cao Ruichuang <create0818@163.com>
> > > ---
> > >  tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc b/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
> > > index e71cc3ad0..6d00d3c0f 100644
> > > --- a/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
> > > +++ b/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
> > > @@ -6,7 +6,7 @@
> > >  original_group=`stat -c "%g" .`
> > >  original_owner=`stat -c "%u" .`
> > >  
> > > -local mount_point=$(get_mount_point)
> > > +mount_point=$(get_mount_point)
> > >  
> > >  mount_options=$(get_mnt_options "$mount_point")
> > >      
> >   
>