public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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
>  

...

  reply	other threads:[~2026-04-09 17:00 UTC|newest]

Thread overview: 4+ 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]
  -- strict thread matches above, loose matches on Subject: below --
2026-04-05 19:57 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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox