Skip to contentSkip to conversation

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

PATCH In review CaoRuichuang 4 participants 6 messages Apr 7 – Jun 17

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

From: Cao Ruichuang <[email protected]>

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.

---
 tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc +1 -1
index e71cc3ad0..6d00d3c0f 100644
@@ -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")
 
Signature · 1 line
2.39.5 (Apple Git-154)
maintainer Reviewed-by on v1 1/1
#1 lore raw

Shuah,

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

Fixes 8b55572e51805 ("tracing/selftests: Add tracefs mount options test")

As well as:

-- Steve

Quoted 30 lines · On Tue, 7 Apr 2026 18:26:13 +0800 CaoRuichuang <[email protected]> wrote:

From: Cao Ruichuang <[email protected]>

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.

---
 tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc +1 -1
index e71cc3ad0..6d00d3c0f 100644
@@ -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")
 
maintainer
#2 lore raw

Shuah,

Can you pull this into your urgent branch?

Thanks,

-- Steve

Quoted 48 lines · On Tue, 7 Apr 2026 20:37:27 -0400 Steven Rostedt <[email protected]> wrote:

Shuah,

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

Fixes 8b55572e51805 ("tracing/selftests: Add tracefs mount options test")

As well as:

-- Steve

Quoted 30 lines · On Tue, 7 Apr 2026 18:26:13 +0800 CaoRuichuang <[email protected]> wrote:

From: Cao Ruichuang <[email protected]>

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.

---
 tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc +1 -1
index e71cc3ad0..6d00d3c0f 100644
@@ -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")
 
maintainer
#3 lore raw

Shuah,

Ping?

-- Steve

Quoted 61 lines · On Wed, 13 May 2026 11:02:08 -0400 Steven Rostedt <[email protected]> wrote:

Shuah,

Can you pull this into your urgent branch?

Thanks,

-- Steve

Quoted 48 lines · On Tue, 7 Apr 2026 20:37:27 -0400 Steven Rostedt <[email protected]> wrote:

Shuah,

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

Fixes 8b55572e51805 ("tracing/selftests: Add tracefs mount options test")

As well as:

-- Steve

Quoted 30 lines · On Tue, 7 Apr 2026 18:26:13 +0800 CaoRuichuang <[email protected]> wrote:

From: Cao Ruichuang <[email protected]>

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.

---
 tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc +1 -1
index e71cc3ad0..6d00d3c0f 100644
@@ -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")
 
maintainer Acked-by
#4 lore raw
In reply to Steven Rostedt
Quoted 12 lines · On Tue, 7 Apr 2026 20:37:27 -0400 Steven Rostedt <[email protected]> wrote:

Shuah,

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

Fixes 8b55572e51805 ("tracing/selftests: Add tracefs mount options test")

As well as:

Shuah, here is my ack too.

BTW, to avoid similar issue,

Thanks,

Quoted 38 lines

-- Steve

Quoted 30 lines · On Tue, 7 Apr 2026 18:26:13 +0800 CaoRuichuang <[email protected]> wrote:

From: Cao Ruichuang <[email protected]>

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.

---
 tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc +1 -1
index e71cc3ad0..6d00d3c0f 100644
@@ -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")
 
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
maintainer
#5 lore raw
Quoted 11 lines · Masami Hiramatsu (Google)
Quoted 8 lines · On Tue, 7 Apr 2026 20:37:27 -0400 Steven Rostedt <[email protected]> wrote:

Shuah,

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

Fixes 8b55572e51805 ("tracing/selftests: Add tracefs mount options test")
Quoted 9 lines
Quoted 4 lines

As well as:

Shuah, here is my ack too.

Thanks - sorry for the delay. I will send this up for Linux 7.2-rc1

thanks,
-- Shuah