All of lore.kernel.org
 help / color / mirror / Atom feed
From: linuxtestproject.agent@gmail.com
To: Jinseok Kim <always.starving0@gmail.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] open: remove O_DIRECTORY case (move to fstat test)
Date: Sun, 21 Jun 2026 10:08:01 +0000	[thread overview]
Message-ID: <20260621100801.4003-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260621090403.2236-1-always.starving0@gmail.com>

Hi Jinseok,

On Sun, 21 Jun 2026 18:03:59 +0900, Jinseok Kim wrote:
> open: remove O_DIRECTORY case (move to fstat test)

--- [PATCH 2/2] ---

> +/*\
> + * Verify that :manpage:`fstat(2)` correctly identifies various
> + * file types.
> + */

The test uses .needs_root = 1 for mknod() to create device nodes, but
the doc comment does not mention why root is required.

> +	switch (tc->exp_type) {
> +	case S_IFREG:
> +		TST_EXP_EXPR(S_ISREG(buf.st_mode));
> +		break;
> +	case S_IFDIR:
> +		TST_EXP_EXPR(S_ISDIR(buf.st_mode));
> +		break;
> +	case S_IFIFO:
> +		TST_EXP_EXPR(S_ISFIFO(buf.st_mode));
> +		break;
> +	case S_IFCHR:
> +		TST_EXP_EXPR(S_ISCHR(buf.st_mode));
> +		break;
> +	case S_IFBLK:
> +		TST_EXP_EXPR(S_ISBLK(buf.st_mode));
> +		break;
> +	}

Each S_IS*() macro is equivalent to (st_mode & S_IFMT) == S_IF*, and
tc->exp_type already holds the expected S_IF* value. Could the whole
switch be replaced with a single check?

  TST_EXP_EXPR((buf.st_mode & S_IFMT) == tc->exp_type,
      "fstat on %s", tc->path);

This would also give more informative output on failure by
identifying the file being tested.

Verdict - Needs revision

Pre-existing issues in open01.c (not introduced by this series):

- static int fd; should be static int fd = -1;
- cleanup() uses if (fd > 0) which should be if (fd != -1)

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

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

  parent reply	other threads:[~2026-06-21 10:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-21  9:03 [LTP] [PATCH v9 1/2] open: remove O_DIRECTORY case (move to fstat test) Jinseok Kim
2026-06-21  9:04 ` [LTP] [PATCH v9 2/2] fstat: add test for multiple file types using fstat Jinseok Kim
2026-06-21 10:08 ` linuxtestproject.agent [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-06-04 14:20 [LTP] [PATCH v8 1/2] open: remove O_DIRECTORY case (move to fstat test) Jinseok Kim
2026-06-04 15:09 ` [LTP] " linuxtestproject.agent

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=20260621100801.4003-1-linuxtestproject.agent@gmail.com \
    --to=linuxtestproject.agent@gmail.com \
    --cc=always.starving0@gmail.com \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.