From: Simon Horman <horms@kernel.org>
To: CaoRuichuang <create0818@163.com>
Cc: Stefano Garzarella <sgarzare@redhat.com>,
Shuah Khan <shuah@kernel.org>,
virtualization@lists.linux.dev, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] selftests: vsock: avoid mktemp -u for Unix socket paths
Date: Thu, 9 Apr 2026 18:00:03 +0100 [thread overview]
Message-ID: <20260409170003.GQ469338@kernel.org> (raw)
In-Reply-To: <20260405195733.86043-1-create0818@163.com>
On Mon, Apr 06, 2026 at 03:57:33AM +0800, CaoRuichuang wrote:
> The namespace tests create temporary Unix socket paths with mktemp -u and
> then hand them to socat. That only prints an unused pathname and leaves
> a race before the socket is created.
>
> Create a private temporary directory with mktemp -d and place the Unix
> socket inside it instead. This keeps the path unique without relying on
> mktemp -u for filesystem socket names.
>
> Signed-off-by: CaoRuichuang <create0818@163.com>
I think the subject could be improved a bit.
More along the lines of the problem being solved,
less on how it is achieved.
...
> @@ -845,7 +850,7 @@ test_ns_diff_global_vm_connect_to_global_host_ok() {
> if ! vm_start "${pidfile}" "${ns0}"; then
> log_host "failed to start vm (cid=${cid}, ns=${ns0})"
> terminate_pids "${pids[@]}"
> - rm -f "${unixfile}"
> + rm -rf "${unixdir}"
rm -rf makes me feel queasy.
Can rmdir, and rm, ideally without the -f, be used instead?
rm "$unixfile"
rmdir "$unixdir"
> return "${KSFT_FAIL}"
> fi
>
...
next prev parent reply other threads:[~2026-04-09 17:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-05 19:57 [PATCH 1/1] selftests: vsock: avoid mktemp -u for Unix socket paths CaoRuichuang
2026-04-09 17:00 ` Simon Horman [this message]
2026-04-10 3:52 ` [PATCH v2] selftests: vsock: avoid races creating " Cao Ruichuang
2026-04-10 8:33 ` Stefano Garzarella
2026-04-10 9:06 ` Stefano Garzarella
2026-04-10 10:05 ` Cao Ruichuang
2026-04-10 10:07 ` [PATCH v3] " Cao Ruichuang
2026-04-10 20:47 ` Jakub Kicinski
2026-04-11 0:33 ` Cao Ruichuang
-- strict thread matches above, loose matches on Subject: below --
2026-04-05 19:57 [PATCH 1/1] selftests: vsock: avoid mktemp -u for " CaoRuichuang
2026-04-09 17:02 ` Simon Horman
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=20260409170003.GQ469338@kernel.org \
--to=horms@kernel.org \
--cc=create0818@163.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sgarzare@redhat.com \
--cc=shuah@kernel.org \
--cc=virtualization@lists.linux.dev \
/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.