From: Aaron Merey <amerey@redhat.com>
To: elfutils-devel@sourceware.org
Cc: Aaron Merey <amerey@redhat.com>
Subject: [PATCH OB] debuginfod-client.c: Skip empty file creation for cancelled queries
Date: Fri, 17 Mar 2023 12:03:09 -0400 [thread overview]
Message-ID: <20230317160309.41211-1-amerey@redhat.com> (raw)
Committing as obvious.
Empty files in the client cache are used to indicate that contacted
servers could not find a requested resource. Future queries for this
resource will not be attempted until the cache_miss_s duration has
passed.
Currently these empty files are also created when a query is cancelled
through the client's progressfn. This can occur, for example, when a
user cancels a download with ctrl-c.
This prevents user-cancelled queries from being retried promptly without
having to modify cache_miss_s. Fix this by skipping the creation of an
empty cache file when progressfn cancels a query.
Signed-off-by: Aaron Merey <amerey@redhat.com>
---
debuginfod/ChangeLog | 5 +++++
debuginfod/debuginfod-client.c | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index f861eb72..5db5a753 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2023-03-17 Aaron Merey <amerey@redhat.com>
+
+ * debuginfod-client.c (debuginfod_query_server): Do not create an
+ empty file in the cache if the query was cancelled by the progressfn.
+
2023-02-07 Aaron Merey <amerey@redhat.com>
* debuginfod-client.c (cache_find_section): Avoid returning -ENOENT
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index ef4d47e3..b33408eb 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -1667,9 +1667,9 @@ debuginfod_query_server (debuginfod_client *c,
}
} while (num_msg > 0);
- /* Create an empty file named as $HOME/.cache if the query fails
- with ENOENT.*/
- if (rc == -ENOENT)
+ /* Create an empty file in the cache if the query fails with ENOENT and
+ it wasn't cancelled early. */
+ if (rc == -ENOENT && !c->progressfn_cancel)
{
int efd = open (target_cache_path, O_CREAT|O_EXCL, DEFFILEMODE);
if (efd >= 0)
--
2.39.2
reply other threads:[~2023-03-17 16:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230317160309.41211-1-amerey@redhat.com \
--to=amerey@redhat.com \
--cc=elfutils-devel@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).