Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Avinesh Kumar <avinesh.kumar@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] landlock04: Fix false TFAIL in _test_truncate() deny path
Date: Tue, 25 Aug 2026 06:38:16 +0200	[thread overview]
Message-ID: <20260825043816.GA22725@pevik> (raw)
In-Reply-To: <20260824135722.200152-1-avinesh.kumar@suse.com>

Hi Avinesh,

Thanks for the fix, merged!

I'm sorry for introducing the regression (I tested whole landlock part, but
obviously wrongly when this one slipped in).
...
>  	TST_EXP_PASS_OR_FAIL(truncate(FILE_TRUNCATE, 10), exp_err);
> -	fd = TST_EXP_FD_OR_FAIL(open(FILE_TRUNCATE, O_WRONLY, PERM_MODE), exp_err);
> +
> +	if (!exp_err) {
> +		fd = SAFE_OPEN(FILE_TRUNCATE, O_WRONLY, PERM_MODE);
> +	} else {
> +		fd = open(FILE_TRUNCATE, O_WRONLY, PERM_MODE);
> +		if (fd == -1 && errno != EACCES)
> +			 tst_res(TFAIL | TERRNO, "open(%s, O_WRONLY) failed unexpectedly", FILE_TRUNCATE);

nit: there still could have been TST_EXP_FD_OR_FAIL() for else part:

fd = TST_EXP_FD_OR_FAIL(open(FILE_TRUNCATE, O_WRONLY, PERM_MODE), exp_err);

I personally prefer these shortening macros, but maybe they aren't that much
readable when others don't use it. Therefore merged as is.

Kind regards,
Petr

> +	}
>  	if (fd != -1) {
>  		TST_EXP_PASS_OR_FAIL(ftruncate(fd, 10), exp_err);
>  		SAFE_CLOSE(fd);
> @@ -262,7 +269,7 @@ static void _test_truncate(const int exp_err)

>  	fd = TST_EXP_FD_OR_FAIL(open(FILE_TRUNCATE, O_WRONLY | O_TRUNC, PERM_MODE), exp_err);
>  	if (fd != -1)
> -		SAFE_CLOSE(TST_RET);
> +		SAFE_CLOSE(fd);
>  }

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

      parent reply	other threads:[~2026-08-25  4:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 10:15 [LTP] [PATCH] landlock04: Fix false TFAIL in _test_truncate() deny path Avinesh Kumar via ltp
2026-08-24 10:38 ` [LTP] " linuxtestproject.agent
2026-08-24 13:57   ` [LTP] [PATCH v2] " Avinesh Kumar via ltp
2026-08-24 14:04     ` Andrea Cervesato via ltp
2026-08-24 14:42     ` [LTP] " linuxtestproject.agent
2026-08-25  4:38     ` Petr Vorel [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=20260825043816.GA22725@pevik \
    --to=pvorel@suse.cz \
    --cc=avinesh.kumar@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox