NetBSD Problem Report #57319

From www@netbsd.org  Mon Apr  3 17:41:48 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A38C11A9239
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  3 Apr 2023 17:41:48 +0000 (UTC)
Message-Id: <20230403174146.F1DC91A923A@mollari.NetBSD.org>
Date: Mon,  3 Apr 2023 17:41:46 +0000 (UTC)
From: jspath55@gmail.com
Reply-To: jspath55@gmail.com
To: gnats-bugs@NetBSD.org
Subject: ATF test case kernel/t_magic_symlinks fails as non-root instead of showing expected fail message
X-Send-Pr-Version: www-1.0

>Number:         57319
>Category:       kern
>Synopsis:       ATF test case kernel/t_magic_symlinks fails as non-root instead of showing expected fail message
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gutteridge
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 03 17:45:00 +0000 2023
>Closed-Date:    Wed Apr 12 03:34:51 +0000 2023
>Last-Modified:  Wed Apr 12 03:34:51 +0000 2023
>Originator:     Jim Spath
>Release:        10.0_BETA
>Organization:
>Environment:
NetBSD nb 10.0_BETA NetBSD 10.0_BETA (GENERIC64) #0: Fri Jan 13 19:15:32 UTC 2023  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm
>Description:
In running the automated test framework suite, the kernel/t_magic_symlinks case reported a failure when run as non-root and succeeds as root.

The test case code shows a failure should be expected, but the test cases messages do not say that.

[code snippet]:
 atf_expect_fail "PR lib/55361"

Non-root user output:
[...]
tp-start: 1680543131.905392, kernel/t_magic_symlinks, 1
tc-start: 1680543131.905428, realpath
tc-so:Initialized vfs.generic.magiclinks=1
tc-se:cd: can't cd to link
tc-so:Restored vfs.generic.magiclinks=0
tc-end: 1680543132.27190, realpath, failed, kernel does not handle magic symlinks properly
tp-end: 1680543132.27436, kernel/t_magic_symlinks
info: time.end, Mon Apr 3 13:32:12 EDT 2023


Root user results:
[...]
tp-start: 1680534183.240759, kernel/t_magic_symlinks, 1
tc-start: 1680534183.240918, realpath
tc-so:Initialized vfs.generic.magiclinks=1
tc-so:/tmp/test-magic-symlink/@osrelease
tc-so:Restored vfs.generic.magiclinks=0
tc-end: 1680534183.353898, realpath, passed
tp-end: 1680534183.354233, kernel/t_magic_symlinks
info: time.end, Mon Apr 3 15:03:03 UTC 2023

I found 2 open PRs on record, including the referenced 55361

https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=55361
Subject: realpath(3) does not resolve magic symlinks

https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=30664
Subject: realpath and magic symlinks




>How-To-Repeat:
atf-run kernel/t_magic_symlinks:realpath as non-root user.

>Fix:
The earlier PR says:
> Log Message:
> Add basic checks for magic symlink(7)'s. These include a case for PR lib/55361,
> although it seems that realpath(3) has bigger problems with these symlinks.

If the issue is fixed, the message may be showing as error to then update the test case, according to the ATF-SH-API(3) manual.

"Whenever the developer fixes the bug later on, the test case will
start reporting a failure, signaling the developer that the test
case must be adjusted to the new conditions."


>Release-Note:

>Audit-Trail:
From: "David H. Gutteridge" <gutteridge@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57319 CVS commit: src/tests/kernel
Date: Mon, 3 Apr 2023 20:08:38 +0000

 Module Name:	src
 Committed By:	gutteridge
 Date:		Mon Apr  3 20:08:38 UTC 2023

 Modified Files:
 	src/tests/kernel: t_magic_symlinks.sh

 Log Message:
 t_magic_symlinks.sh: fix naming of head() of realpath test case

 Addresses part of PR kern/57319 from Jim Spath.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/t_magic_symlinks.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: kern-bug-people->gutteridge
Responsible-Changed-By: gutteridge@NetBSD.org
Responsible-Changed-When: Mon, 03 Apr 2023 20:54:32 +0000
Responsible-Changed-Why:
I'm looking at this.

From: "David H. Gutteridge" <david@gutteridge.ca>
To: Gnats Bugs <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: kern/57319: ATF test case kernel/t_magic_symlinks fails as
 non-root instead of showing expected fail message
Date: Mon, 03 Apr 2023 16:50:33 -0400

 Part of the test case was expressed incorrectly. It shouldn't be trying
 to run the realpath test case when not root, as it specifies
 atf_set "require.user" "root"
 but that evidently wasn't being triggered because of a copy-pasto, which
 I just fixed.

 Dave

From: "David H. Gutteridge" <david@gutteridge.ca>
To: Gnats Bugs <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: kern/57319: ATF test case kernel/t_magic_symlinks fails as
 non-root instead of showing expected fail message
Date: Tue, 11 Apr 2023 23:14:19 -0400

 On Mon Apr 03, 2023 at 17:45:00 +0000, Jim Spath wrote:
 >The test case code shows a failure should be expected, but the test
 >cases messages do not say that.

 Well, it's more that it shows a failure *may* occur, and if it does,
 it's expected. The test case itself does not actually reproduce what
 was reported in PR lib/55361. It will succeed under normal testing
 conditions. (I don't see that anything has been changed that would
 resolve PR lib/55361.)

 Dave

State-Changed-From-To: open->closed
State-Changed-By: gutteridge@NetBSD.org
State-Changed-When: Wed, 12 Apr 2023 03:34:51 +0000
State-Changed-Why:
Test case configuration was fixed. Thanks for the PR.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.