All of lore.kernel.org
 help / color / mirror / Atom feed
From: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>
To: "qi.fuli@fujitsu.com" <qi.fuli@fujitsu.com>
Cc: "ltp@lists.linux.it" <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v3 4/5] syscalls/dup2/dup205: Convert to new API
Date: Fri, 17 Sep 2021 09:59:23 +0000	[thread overview]
Message-ID: <61446711.4020101@fujitsu.com> (raw)
Message-ID: <20210917095923.qJja2D9qI5aLaS_9PGywxNb10StuoCbJL6hGzDTjrvM@z> (raw)
In-Reply-To: <OSZPR01MB64547BE94AEC979C8E0AFF1FF7DD9@OSZPR01MB6454.jpnprd01.prod.outlook.com>

Hi All
>> Subject: Re: [LTP] [PATCH v3 4/5] syscalls/dup2/dup205: Convert to new API

>>> +
>>> +	if (TST_ERR != EBADF)
>>> +		tst_res(TFAIL, "bad errno on dup2 failure");
>>
>> Hi Qi,
>>
>> Why do you only check EBADF? The old test checks three errno.
>
> Thanks for the comments.
> Both Xu and I got the failures with EBADF,
> so I think that checking EINVAL and ENFILE is not necessary.
Yes, My machine fails with EBADF.
Look this case history, it said nothing about why need three checks.
But kernel code in 4e1e018ecc6f ("PATCH] fix RLIM_NOFILE handling
") ,

it seems old kernel will return EINVAL when rlimit set to 0.
Then will return ENFILE when rlimit set to 0.


And now it looks only fails with EBADF from kernel fs/file.c code.

> I wonder your opinion.
>>
>>> +
>>> +	if (ifile<  min)
>>> +		tst_res(TFAIL, "Not enough files duped");
>>> +	else if (ifile>  min)
>>> +		tst_res(TFAIL, "Too many files duped");
>>> +	else
>>> +		tst_res(TPASS, "Test passed.");
>>> +
>>> +	SAFE_CLOSE(fildes[0]);
>>
>> Why do you close only fildes[0]?
>
> I did try close all fildes[ifile], and it occurred close(-1).
> After talking with Xu, we think that close oldfd is enough.
I think we don't need to close all filedes because dup2 can close newfd
before reuse.  We should close them in cleanup function.

Best Regards
Yang Xu
>
> Best,
> QI
>
>>
>> Best Regards,
>>
>> Xiao Yang
>>
>>> +	SAFE_UNLINK(pfilname);
>>> +}
>>> +
>>> +static struct tst_test test = {
>>> +	.needs_tmpdir = 1,
>>> +	.test_all = run,
>>> +	.setup = setup,
>>> +	.cleanup = cleanup,
>>> +};
>

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

  reply	other threads:[~2021-09-17  9:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 10:49 [LTP] [PATCH v3 0/5] Convert syscalls/dup2/dup2{01...05} to new API QI Fuli
2021-09-16 10:49 ` QI Fuli
2021-09-16 10:49   ` [LTP] [PATCH v3 1/5] syscalls/dup2/dup201: Convert " QI Fuli
2021-09-16 10:49     ` QI Fuli
2021-09-17  7:04       ` Xiao Yang
2021-09-17  7:04         ` Xiao Yang
2021-09-16 10:49   ` [LTP] [PATCH v3 2/5] syscalls/dup2/dup202: Convert to new API and merge dup204 into dup202 QI Fuli
2021-09-16 10:49     ` QI Fuli
2021-09-17  7:27       ` Xiao Yang
2021-09-17  7:27         ` Xiao Yang
2021-09-16 10:49   ` [LTP] [PATCH v3 3/5] syscalls/dup2/dup203: Convert to new API QI Fuli
2021-09-16 10:49     ` QI Fuli
2021-09-17  8:16       ` Xiao Yang
2021-09-17  8:16         ` Xiao Yang
2021-09-16 10:49   ` [LTP] [PATCH v3 4/5] syscalls/dup2/dup205: " QI Fuli
2021-09-16 10:49     ` QI Fuli
2021-09-17  8:37       ` Xiao Yang
2021-09-17  8:37         ` Xiao Yang
2021-09-17  9:20           ` qi.fuli
2021-09-17  9:20             ` qi.fuli
2021-09-17  9:59               ` xuyang2018.jy [this message]
2021-09-17  9:59                 ` xuyang2018.jy
2021-09-16 10:49   ` [LTP] [PATCH v3 5/5] syscalls/dup2: rename dup205 to dup204 QI Fuli
2021-09-16 10:49     ` QI Fuli
2021-09-17  3:20       ` xuyang2018.jy
2021-09-17  3:20         ` xuyang2018.jy
2021-09-17  4:29           ` qi.fuli
2021-09-17  4:29             ` qi.fuli

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=61446711.4020101@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.com \
    --cc=ltp@lists.linux.it \
    --cc=qi.fuli@fujitsu.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 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.