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: Thu,  4 Jun 2026 15:09:29 +0000	[thread overview]
Message-ID: <20260604150929.4232-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260604142029.2077-1-always.starving0@gmail.com>

Hi Jinseok,

On Thu, 04 Jun 2026, 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.
> + */

> +	.needs_root = 1,

Ground Rule 4 requires that the reason for needing root is documented in
the test's doc comment. The test calls SAFE_MKNOD() to create block and
character device nodes, which requires CAP_MKNOD. Please add a note in
the /*\ ... */ block, e.g.:

  "Requires root to create block and character device nodes with mknod(2)."

> +	int flags = O_RDONLY | O_NONBLOCK;
> +
> +	if (tc->exp_type == S_IFDIR)
> +		flags |= O_DIRECTORY;
> +
> +	int fd = SAFE_OPEN(tc->path, flags);

For the block device case (BLK_DEV, makedev(7, 3) = loop3) this will
attempt to open the underlying block device via its driver. If the loop
module is not loaded -- which can happen in containers or minimal
environments -- SAFE_OPEN aborts with TBROK rather than skipping cleanly.

The test only needs the fd to call fstat(), not to perform I/O. Using
O_PATH avoids instantiating the driver entirely and is more appropriate
for a test focused on fstat() metadata. With O_PATH the branching on
S_IFDIR also becomes unnecessary since directories can be opened without
O_DIRECTORY through an O_PATH descriptor:

  int fd = SAFE_OPEN(tc->path, O_PATH | O_NOFOLLOW);

O_PATH + fstat() has been supported since Linux 3.6.

Verdict: Needs revision

---
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-04 15:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04 14:20 [LTP] [PATCH v8 1/2] open: remove O_DIRECTORY case (move to fstat test) Jinseok Kim
2026-06-04 14:20 ` [LTP] [PATCH v8 2/2] fstat: add test for multiple file types using fstat Jinseok Kim
2026-06-15 13:21   ` Andrea Cervesato via ltp
2026-06-04 15:09 ` linuxtestproject.agent [this message]

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=20260604150929.4232-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.