Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2 5/6] [gdb/testsuite] Extend gdb.testsuite/lock.exp
Date: Wed, 28 Oct 2026 09:11:35 -0700	[thread overview]
Message-ID: <b96d7499-d8fb-41d9-aac0-13282353fb41@redhat.com> (raw)
In-Reply-To: <20260929110921.1910094-5-tdevries@suse.de>

Hi,

I think this series looks good, I just have one question.

On 9/29/26 4:09 AM, Tom de Vries wrote:
> diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
> index 1277558170d..9ccde20634e 100644
> --- a/gdb/testsuite/lib/gdb-utils.exp
> +++ b/gdb/testsuite/lib/gdb-utils.exp
> @@ -180,10 +180,15 @@ proc version_compare { l1 op l2 } {
>       return 1
>   }
>   
> -# Acquire lock file LOCKFILE.  Tries forever until the lock file is
> -# successfully created.
> -
> -proc lock_file_acquire {lockfile} {
> +# Acquire lock file LOCKFILE.
> +# If the lock file:
> +# - doesn't exist, create it and return a file handle/file name pair.
> +# - does exist, and:
> +#   - ON_RETRY is empty, wait a bit and try again.
> +#   - ON_RETRY is non-empty, call it.  If it returns 0, don't retry and
> +#     return {} to indicate failure.
> +
> +proc lock_file_acquire {lockfile {on_retry ""}} {
>       verbose -log "acquiring lock file: $::subdir/${::gdb_test_file_name}.exp"
>   
>       while {![info exists fh]} {
> @@ -191,7 +196,11 @@ proc lock_file_acquire {lockfile} {
>   	    set fh [open $lockfile {WRONLY CREAT EXCL}]
>   	} trap "POSIX EEXIST" {} {
>   	    # Lock in use.  Ignore and try again.  Propagate all other errors.
> -	    after 10
> +	    if {$on_retry == ""} {
> +		after 10
> +	    } elseif {![$on_retry]} {
> +		return {}
> +	    }
>   	}
>       }
>   

The case where ON_RETRY is NOT empty and returns non-zero is not
particularly well documented, but I assume it is the same as ON_RETRY
being empty. That is, both cases should loop.

However, in the empty case, there is a 10ms delay. In the non-empty
case, there is no (default) delay. I see that the on_retry proc in
lock.exp does do a delay.

It seems it would be easy to introduce a really tight spin?

In any case, a note to document this responsibility might be in
order.

For the series:
Reviewed-By: Keith Seitz <keiths@redhat.com>

Keith


  reply	other threads:[~2026-10-28 16:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 11:09 [PATCH v2 1/6] [gdb/testsuite] Add gdb.testsuite/lock.exp Tom de Vries
2026-09-29 11:09 ` [PATCH v2 2/6] [gdb/testsuite] Improve variable names in lock_file_{acquire, release} Tom de Vries
2026-09-29 11:09 ` [PATCH v2 3/6] [gdb/testsuite] Simplify lock_file_acquire Tom de Vries
2026-09-29 11:09 ` [PATCH v2 4/6] [gdb/testsuite] Only retry on EEXIST in lock_file_acquire Tom de Vries
2026-09-29 11:09 ` [PATCH v2 5/6] [gdb/testsuite] Extend gdb.testsuite/lock.exp Tom de Vries
2026-10-28 16:11   ` Keith Seitz [this message]
2026-09-29 11:09 ` [PATCH v2 6/6] [gdb/testsuite] Extend gdb.testsuite/lock.exp a bit more Tom de Vries

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=b96d7499-d8fb-41d9-aac0-13282353fb41@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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