From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 425DB385B523 for ; Fri, 17 Mar 2023 16:03:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 425DB385B523 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679069000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XQ8euKj5v+tfkFHfCREncmtubNUks6O/XpTES/8ylDM=; b=fEZs4mp2N1z83e4GVVEI2zaCg88izCRfOOfoGaBvqL7JNTHCTchupvm1Km9jFHjMXNdAU4 udqrfy1BXhbEZQVQh0DCwvjOOjeZzIuPNcoEtV73S7kflyCfT2GblYcrMF8G3L96L/VFtD 9L1x0pa8kFnumFILIyXNBpM6qZ/CeYA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-252-JFauMim6MPGbMDiG7O5dlA-1; Fri, 17 Mar 2023 12:03:11 -0400 X-MC-Unique: JFauMim6MPGbMDiG7O5dlA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9C349185A791 for ; Fri, 17 Mar 2023 16:03:11 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.34.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6CF302166B26; Fri, 17 Mar 2023 16:03:11 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [PATCH OB] debuginfod-client.c: Skip empty file creation for cancelled queries Date: Fri, 17 Mar 2023 12:03:09 -0400 Message-Id: <20230317160309.41211-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 --- 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 + + * 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 * 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