Linux Test Project
 help / color / mirror / Atom feed
From: "Ricardo B. Marlière via ltp" <ltp@lists.linux.it>
To: "Petr Vorel" <pvorel@suse.cz>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v3 3/8] syscalls/mknod03: Convert to new API
Date: Tue, 22 Apr 2025 11:32:22 -0300	[thread overview]
Message-ID: <D9D8OH63B4ZM.EVMSEPDGCSJP@suse.com> (raw)
In-Reply-To: <20250422140211.GB934527@pevik>

On Tue Apr 22, 2025 at 11:02 AM -03, Petr Vorel wrote:
> Hi Ricardo,
>
>> +++ b/testcases/kernel/syscalls/mknod/mknod03.c
>
>> @@ -1,296 +1,64 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
> Text below shows "or (at your option) any later version" => it should be GPLv2+.
> // SPDX-License-Identifier: GPL-2.0-or-later
>
>>  /*
>> - *
>> - *   Copyright (c) International Business Machines  Corp., 2001
>> - *
>> - *   This program is free software;  you can redistribute it and/or modify
>> - *   it under the terms of the GNU General Public License as published by
>> - *   the Free Software Foundation; either version 2 of the License, or
>> - *   (at your option) any later version.
>> - *
>> - *   This program is distributed in the hope that it will be useful,
>> - *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
>> - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
>> - *   the GNU General Public License for more details.
>> - *
>> - *   You should have received a copy of the GNU General Public License
>> - *   along with this program;  if not, write to the Free Software
>> - *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>> + * Copyright (c) International Business Machines Corp., 2001
>> + *	07/2001 Ported by Wayne Boyer
>> + * Copyright (c) 2025 SUSE LLC Ricardo B. Marlière <rbm@suse.com>
>>   */
>
> ...
>> +/*\
>> + * Verify that mknod(2) succeeds when used to create a filesystem node with
>> + * set-group-ID bit set on a directory with set-group-ID bit set. The node
>> + * created should have set-group-ID bit set and its gid should be equal to
>> + * the "nobody" gid.
>>   */
> ...
>> -#define MODE_RWX	S_IFIFO | S_IRWXU | S_IRWXG | S_IRWXO
>> -#define MODE_SGID       S_IFIFO | S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO
>> -#define DIR_TEMP	"testdir_3"
>> -#define TNODE		"tnode_%d"
> ...
>> +#define MODE_RWX 0777
>> +#define MODE_SGID 2777
>
> The test fails on my VM (last minute change?):

Oof, yes that was indeed the last part I touched...

> mknod03.c:33: TFAIL: buf.st_mode & S_ISGID (0) != S_ISGID (1024)
> mknod03.c:38: TFAIL: buf.st_gid (65534) != free_gid (4)
>
> Why? S_ISGID is *not* 2000 but 02000 (octal number, 1535 in decimal).
> I actually find (S_ISGID | 0777) you had in v2 more readable, but maybe it's
> just me who needs to look up setuid bits (unlike typical rwx permission bits).
>

Agreed, I'll keep the octals only for permission modes. Good call :)

>> -char *TCID = "mknod03";
>> -int TST_TOTAL = 1;
>> -char node_name[PATH_MAX];	/* buffer to hold node name created */
>> +#define TEMP_DIR "testdir"
>> +#define TEMP_NODE TEMP_DIR "/testnode"
>
> ...
>> +static void run(void)
>>  {
> ...
>> +	struct stat buf;
>
>> +	SAFE_STAT(TEMP_DIR, &buf);
> I would keep this first SAFE_STAT() in the setup() as it was in the original
> code. We put things in the setup which are not related to the testing and thus
> it's a waste of time to repeat them, e.g. on repeated run:
> # ./mknod03 -i2000
>

Ack.

>> +	TST_EXP_EQ_LI(buf.st_mode & S_ISGID, S_ISGID);
> Also this original test should quit - use tst_brk(TBROK).
>
> NOTE: after Cyril's change [1] is merged, it will not need to be tst_brk(TBROK),
> but it makes sense to use TBROK (instead of TFAIL) in the test setup anyway.

I'll take a look!

>
> The rest LGTM.
>

Thanks for reviewing,
-	Ricardo.


> Kind regards,
> Petr
>
> [1] https://patchwork.ozlabs.org/project/ltp/patch/20250404143423.16268-1-chrubis@suse.cz/


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2025-04-22 14:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 20:09 [LTP] [PATCH v3 0/8] syscalls/mknod: Refactor all tests Ricardo B. Marlière via ltp
2025-04-14 20:09 ` [LTP] [PATCH v3 1/8] syscalls/mknod01: Fix checkpatch.pl warnings Ricardo B. Marlière via ltp
2025-04-22 10:52   ` Petr Vorel
2025-04-22 12:09     ` Ricardo B. Marlière via ltp
2025-04-14 20:09 ` [LTP] [PATCH v3 2/8] syscalls/mknod02: Use relative path to avoid use of SAFE_CHDIR Ricardo B. Marlière via ltp
2025-04-22 13:06   ` Petr Vorel
2025-05-15  2:49     ` Li Wang via ltp
2025-04-14 20:09 ` [LTP] [PATCH v3 3/8] syscalls/mknod03: Convert to new API Ricardo B. Marlière via ltp
2025-04-22 14:02   ` Petr Vorel
2025-04-22 14:32     ` Ricardo B. Marlière via ltp [this message]
2025-04-14 20:09 ` [LTP] [PATCH v3 4/8] syscalls/mknod04: " Ricardo B. Marlière via ltp
2025-04-22 14:06   ` Petr Vorel
2025-04-14 20:09 ` [LTP] [PATCH v3 5/8] syscalls/mknod05: " Ricardo B. Marlière via ltp
2025-04-25 15:30   ` Cyril Hrubis
2025-04-25 16:26     ` Ricardo B. Marlière via ltp
2025-04-14 20:09 ` [LTP] [PATCH v3 6/8] syscalls/mknod06: " Ricardo B. Marlière via ltp
2025-04-14 20:09 ` [LTP] [PATCH v3 7/8] syscalls/mknod07: " Ricardo B. Marlière via ltp
2025-04-14 20:09 ` [LTP] [PATCH v3 8/8] syscalls/mknod08: " Ricardo B. Marlière via ltp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D9D8OH63B4ZM.EVMSEPDGCSJP@suse.com \
    --to=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    --cc=rbm@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox