From: Wei Gao via ltp <ltp@lists.linux.it>
To: Petr Vorel <pvorel@suse.cz>
Cc: Richard Palethorpe <rpalethorpe@suse.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3] getcwd01: Use syscall directly check invalid argument
Date: Thu, 30 Nov 2023 22:52:33 -0500 [thread overview]
Message-ID: <ZWlYgRH7/I2aNKI+@wegao> (raw)
In-Reply-To: <20231128105242.GA362098@pevik>
On Tue, Nov 28, 2023 at 11:52:42AM +0100, Petr Vorel wrote:
> > Fixes: #1084
>
> You haven't written the reason for switching to raw syscall syscall(__NR_getcwd, ...).
> (Adding https://github.com/linux-test-project/ltp/issues/1084 is not enough, the
> reason for the change is important enough to write to the commit message).
>
> Also, raw syscall obviously returns a different errnos than glibc wrapper.
> But again, it would be better to document in the commit message the reason for
> the errno change.
I add more comments in patchv4 for improvement.
> > - if (res) {
> > - tst_res(TFAIL, "getcwd() succeeded unexpectedly");
> > - return;
> > - }
> > -
> > - if (TST_ERR != tc->exp_err) {
> > - tst_res(TFAIL | TTERRNO, "getcwd() failed unexpectedly, expected %s",
> > - tst_strerrno(tc->exp_err));
> > - return;
> > - }
>
> > - tst_res(TPASS | TTERRNO, "getcwd() failed as expected");
> > + TST_EXP_FAIL2(syscall(__NR_getcwd, tc->buf, tc->size), tc->exp_err);
>
> If the reason is that getcwd() wrapper in musl is not easily fixable (we
> probably don't want #ifdef __GLIBC__), I'm ok for this.
>
> OTOH if test would be easily fixable for musl, we could consider testing both
> raw syscall and libc wrapper via .test_variants (separate effort).
I think we can add extra variant such as LIB_TYPE into t_case and use it to go different check logic.
But we can not completely avoid use macro to identify musl or not if i understand correctly.
>
> Kind regards,
> Petr
>
> > }
>
> > static struct tst_test test = {
Regards
Gao Wei
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-12-01 3:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-28 1:08 [LTP] [PATCH v1] getcwd01: Only check buffer NULL on glibc Wei Gao via ltp
2023-09-28 7:06 ` Richard Palethorpe
2023-09-28 8:44 ` [LTP] [PATCH v2] getcwd01: Use syscall directly check invalid argument Wei Gao via ltp
2023-09-28 17:55 ` Petr Vorel
2023-09-29 0:49 ` Wei Gao via ltp
2023-09-29 0:45 ` [LTP] [PATCH v3] " Wei Gao via ltp
2023-11-28 10:52 ` Petr Vorel
2023-12-01 3:52 ` Wei Gao via ltp [this message]
2023-11-28 10:53 ` Petr Vorel
2023-12-01 3:15 ` [LTP] [PATCH v4] " Wei Gao via ltp
2023-12-01 10:14 ` Petr Vorel
2023-12-04 0:06 ` Wei Gao 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=ZWlYgRH7/I2aNKI+@wegao \
--to=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
--cc=rpalethorpe@suse.com \
--cc=wegao@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