From patchwork Fri Mar 24 00:48:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jan Alexander Steffens \\(heftig\\)" X-Patchwork-Id: 66826 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A8CEF3870899 for ; Fri, 24 Mar 2023 00:49:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A8CEF3870899 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679618942; bh=f4BEO4mS00N4zmA6l6q28zK8yri7m2VE6ZPAmgo5HYA=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Help:List-Subscribe:From:Reply-To:From; b=dyQfs/MRwViu0y3tVjRA5pJb3HrzAka+jedNzD4XgqROEDL4RL3RikLhIVBg133/N 6prDWhD1tUkLg95i5zPnR1pEgH/1r2loj4lcVCIz0aCIM4AwW9UFaiNyTIED3nHzlq U26qYd0mqIuNJJYEm67h5XBdnRr5RGGG2QKhc7yE= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by sourceware.org (Postfix) with ESMTPS id DB4F73858CDB for ; Fri, 24 Mar 2023 00:48:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB4F73858CDB Received: by mail-ed1-f49.google.com with SMTP id x3so1819620edb.10 for ; Thu, 23 Mar 2023 17:48:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679618929; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f4BEO4mS00N4zmA6l6q28zK8yri7m2VE6ZPAmgo5HYA=; b=kdjblJ+QrOicUS9PnQ93hiA7qsTcFNkXyn7BhBPWlhY7dqCEa6UAVia1pdssO2XeMs GgyFWSW7H39cFYlpuQqAcXO8+kEib6+MfrIzmkk0SWsHkCQeg4CnWC5evNl3YqBd6TsN dEpDFCJQ7ShEkKhnaxk5rXoI1BEjWTq0VXbUQGUSpxpu26e3OOnPi1JmyP1a517jBmSa CVGzDOlptf5lnwH7znCFLmXu+K0dYqhXU2aCgL7ne5OnSoaxT9HKSbXhcd+l1B0A+WJD YuiphMW6a11qxQHupUs59MHnsFDXbvHNxrxH5Cr6PXQ2PePkK8BImzwFFqmHJitJqUPk slDg== X-Gm-Message-State: AAQBX9f+e7YCbRYN3kwBGFEuKGi+bJgSOQanCNz6KmCPObHRty4MtzHc tMlq14JRkn2dnLuEvo8eKu7H5c/gdX8= X-Google-Smtp-Source: AKy350YeJgZcetTeyktboKY0JHsFmDzJDcHqVSVWlSAt+vobWKbOBt7SL7RWQrE4qS1YKsxhIj4vaA== X-Received: by 2002:aa7:c2d9:0:b0:4fa:315a:cb59 with SMTP id m25-20020aa7c2d9000000b004fa315acb59mr1315951edp.12.1679618929177; Thu, 23 Mar 2023 17:48:49 -0700 (PDT) Received: from ocellus.fritz.box (p200300eae71e29008ef8c5fffef034ee.dip0.t-ipconnect.de. [2003:ea:e71e:2900:8ef8:c5ff:fef0:34ee]) by smtp.gmail.com with ESMTPSA id u25-20020a50c2d9000000b004faf34064c8sm9824029edf.62.2023.03.23.17.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 17:48:48 -0700 (PDT) To: elfutils-devel@sourceware.org Cc: "Jan Alexander Steffens (heftig)" Subject: [PATCH 1/3] debuginfod: Replace futimes with futimens Date: Fri, 24 Mar 2023 01:48:03 +0100 Message-Id: <20230324004805.156080-1-heftig@archlinux.org> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Jan Alexander Steffens \(heftig\) via Elfutils-devel" From: "Jan Alexander Steffens \\(heftig\\)" Reply-To: "Jan Alexander Steffens \(heftig\)" Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Similar to what 8c4aa0ef998191ed828a37190dc179b91649938a did for ar and strip, replace the non-standard futimes with the POSIX futimens. Signed-off-by: Jan Alexander Steffens (heftig) --- debuginfod/debuginfod-client.c | 6 +++--- debuginfod/debuginfod.cxx | 13 ++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index b33408eb..460afd5c 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -1721,10 +1721,10 @@ debuginfod_query_server (debuginfod_client *c, if (curl_res != CURLE_OK) mtime = time(NULL); /* fall back to current time */ - struct timeval tvs[2]; + struct timespec tvs[2]; tvs[0].tv_sec = tvs[1].tv_sec = mtime; - tvs[0].tv_usec = tvs[1].tv_usec = 0; - (void) futimes (fd, tvs); /* best effort */ + tvs[0].tv_nsec = tvs[1].tv_nsec = 0; + (void) futimens (fd, tvs); /* best effort */ /* PR27571: make cache files casually unwriteable; dirs are already 0700 */ (void) fchmod(fd, 0400); diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 99b1f2b9..b39c0591 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -1635,13 +1635,12 @@ extract_section (int elf_fd, int64_t parent_mtime, throw libc_exception (errno, "cannot write to temporary file"); /* Set mtime to be the same as the parent file's mtime. */ - struct timeval tvs[2]; + struct timespec tvs[2]; if (fstat (elf_fd, &fs) != 0) throw libc_exception (errno, "cannot fstat file"); - tvs[0].tv_sec = tvs[1].tv_sec = fs.st_mtime; - tvs[0].tv_usec = tvs[1].tv_usec = 0; - (void) futimes (fd, tvs); + tvs[0] = tvs[1] = fs.st_mtim; + (void) futimens (fd, tvs); /* Add to fdcache. */ fdcache.intern (b_source, section, tmppath, data->d_size, true); @@ -1951,10 +1950,10 @@ handle_buildid_r_match (bool internal_req_p, // Set the mtime so the fdcache file mtimes, even prefetched ones, // propagate to future webapi clients. - struct timeval tvs[2]; + struct timespec tvs[2]; tvs[0].tv_sec = tvs[1].tv_sec = archive_entry_mtime(e); - tvs[0].tv_usec = tvs[1].tv_usec = 0; - (void) futimes (fd, tvs); /* best effort */ + tvs[0].tv_nsec = tvs[1].tv_nsec = archive_entry_mtime_nsec(e); + (void) futimens (fd, tvs); /* best effort */ if (r != 0) // stage 3 { From patchwork Fri Mar 24 00:48:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jan Alexander Steffens \\(heftig\\)" X-Patchwork-Id: 66828 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9DD0E3870889 for ; Fri, 24 Mar 2023 00:49:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DD0E3870889 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679618954; bh=6BCEsDBHQM0C/0TAmO2SGFuT2lOSc35jhDqLdXI31L4=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=s0uRowuyH1anEn4MBBWlbdDsFItqVlNPqehshPJR3ZNJq6CHoz++RRI2hWlvwphmK LHoQGYcjnEPRoO0B4FOz+lv2HNkIsjPsFd8FMCmMy4ecIP23SgIyxeh6CSA/p5wnOf Sr2HNPx+dPx0PNfgVo7N2GivcXNGRLGW5CMiDGsU= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by sourceware.org (Postfix) with ESMTPS id 360BD3858C50 for ; Fri, 24 Mar 2023 00:48:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 360BD3858C50 Received: by mail-ed1-f49.google.com with SMTP id r11so1910447edd.5 for ; Thu, 23 Mar 2023 17:48:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679618930; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6BCEsDBHQM0C/0TAmO2SGFuT2lOSc35jhDqLdXI31L4=; b=vXMFcapKG+pcE9+8P1hKxOUqSBx+qYByVRtymrFXQ98+4DpHlYPK9LegBHOFPH7Y/J bYBvQxNGs+r1MikWbYaC4IiLDeIXAbErKrCIv/BdfMdIcKSjk0I/LXcA+QuRp5JvC/uY CBAUhlG+BBQvEf4IdPuCXsvCaKd5Wlqkk0uoJ4P/ePlYT8QnQ0RrsNgUGDkM+XyinJjd 5vCEwtNb9L9kVUKlqD7Ho7L44XEsSSKFo5PN0NY2VrcFaWMCqrlTZ5trK5tzhibAGJ51 hecSDaMwOiykgyjTPXDpQQMAapUiurEAUXgJ3yq+XuWbZJGbdUpRUCAfvfK2XhRzfmcV heiw== X-Gm-Message-State: AAQBX9eTX8a9RyEk+HZhlqs7P7qnSF1Ugw4XmcwD3f6W7goQVasoHaLi uvZP9vIR45oPSsOsIViJ1nQ6cU5aJ1M= X-Google-Smtp-Source: AKy350a8koOruYiPZ3t4OElsihMJkX4NQVqtnCXyxqKhx68h80Z2g9/uXcHtGtw/MCJ499zjZfeUOA== X-Received: by 2002:a05:6402:4c:b0:4c0:1120:a15d with SMTP id f12-20020a056402004c00b004c01120a15dmr1169212edu.5.1679618929888; Thu, 23 Mar 2023 17:48:49 -0700 (PDT) Received: from ocellus.fritz.box (p200300eae71e29008ef8c5fffef034ee.dip0.t-ipconnect.de. [2003:ea:e71e:2900:8ef8:c5ff:fef0:34ee]) by smtp.gmail.com with ESMTPSA id u25-20020a50c2d9000000b004faf34064c8sm9824029edf.62.2023.03.23.17.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 17:48:49 -0700 (PDT) To: elfutils-devel@sourceware.org Cc: "Jan Alexander Steffens (heftig)" Subject: [PATCH 2/3] debuginfod: Don't touch access time of new files Date: Fri, 24 Mar 2023 01:48:04 +0100 Message-Id: <20230324004805.156080-2-heftig@archlinux.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230324004805.156080-1-heftig@archlinux.org> References: <20230324004805.156080-1-heftig@archlinux.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Jan Alexander Steffens \(heftig\) via Elfutils-devel" From: "Jan Alexander Steffens \\(heftig\\)" Reply-To: "Jan Alexander Steffens \(heftig\)" Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Instead of copying the mtime, which might be far in the past, don't touch the access time. This will prevent cache cleaning from considering the file as old immediately. Signed-off-by: Jan Alexander Steffens (heftig) --- debuginfod/debuginfod-client.c | 16 +++++++++------- debuginfod/debuginfod.cxx | 10 +++++++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index 460afd5c..1a2d7573 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -1718,13 +1718,15 @@ debuginfod_query_server (debuginfod_client *c, #else CURLcode curl_res = curl_easy_getinfo(verified_handle, CURLINFO_FILETIME, (void*) &mtime); #endif - if (curl_res != CURLE_OK) - mtime = time(NULL); /* fall back to current time */ - - struct timespec tvs[2]; - tvs[0].tv_sec = tvs[1].tv_sec = mtime; - tvs[0].tv_nsec = tvs[1].tv_nsec = 0; - (void) futimens (fd, tvs); /* best effort */ + if (curl_res == CURLE_OK) + { + struct timespec tvs[2]; + tvs[0].tv_sec = 0; + tvs[0].tv_nsec = UTIME_OMIT; + tvs[1].tv_sec = mtime; + tvs[1].tv_nsec = 0; + (void) futimens (fd, tvs); /* best effort */ + } /* PR27571: make cache files casually unwriteable; dirs are already 0700 */ (void) fchmod(fd, 0400); diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index b39c0591..5ef6cc32 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -1639,7 +1639,9 @@ extract_section (int elf_fd, int64_t parent_mtime, if (fstat (elf_fd, &fs) != 0) throw libc_exception (errno, "cannot fstat file"); - tvs[0] = tvs[1] = fs.st_mtim; + tvs[0].tv_sec = 0; + tvs[0].tv_nsec = UTIME_OMIT; + tvs[1] = fs.st_mtim; (void) futimens (fd, tvs); /* Add to fdcache. */ @@ -1951,8 +1953,10 @@ handle_buildid_r_match (bool internal_req_p, // Set the mtime so the fdcache file mtimes, even prefetched ones, // propagate to future webapi clients. struct timespec tvs[2]; - tvs[0].tv_sec = tvs[1].tv_sec = archive_entry_mtime(e); - tvs[0].tv_nsec = tvs[1].tv_nsec = archive_entry_mtime_nsec(e); + tvs[0].tv_sec = 0; + tvs[0].tv_nsec = UTIME_OMIT; + tvs[1].tv_sec = archive_entry_mtime(e); + tvs[1].tv_nsec = archive_entry_mtime_nsec(e); (void) futimens (fd, tvs); /* best effort */ if (r != 0) // stage 3 From patchwork Fri Mar 24 00:48:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jan Alexander Steffens \\(heftig\\)" X-Patchwork-Id: 66827 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0D49338708A7 for ; Fri, 24 Mar 2023 00:49:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D49338708A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679618950; bh=Mely0FVHSWMM9ivo7NEW8FjWIPNEYA+dXW6ePvayHGc=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=Ud+yDpYWwm3EiJcfgBCFYtf3Qe8M8FXb6gPea2urOWVWtieRyxuRXlgJIGd9vYPMf fmp9KnSa/oOquJ5IWb7kVkYc7OkiUYI5uv3lmuU0igebu5wiIdkQDSZSFNhiHWbmYg l72cTp5hhx7zsBtfx9SNG7r3BbE+ebwAuiRusk0k= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by sourceware.org (Postfix) with ESMTPS id 40A153858D28 for ; Fri, 24 Mar 2023 00:48:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 40A153858D28 Received: by mail-ed1-f46.google.com with SMTP id w9so1951238edc.3 for ; Thu, 23 Mar 2023 17:48:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679618931; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Mely0FVHSWMM9ivo7NEW8FjWIPNEYA+dXW6ePvayHGc=; b=4PwFlCY1ldyV86bA4GVOeL1FmKPssGK2w35N4xST/4A3u683Jh5IEYA8+h6N/F/+5w IawRyVNuIF/IRXDd94psPacTBt7hFc4uv6EpE2ahNq4ssRFHh6UsfoHmxeMYPVRb4Zr1 sp115sc9wYz3CqFvlgv7ndDtO7rYPuEULqsypvMXdyzM2QLEVpeD1J0gd+EJVD/m1W9r AWZh+HIMNMHr/aLygQ9uIfdbEoQt1ZQ4WG5djkAsn/GQrjrQZVKdiCSHx2a0nhH1knRa OMWmL4u5/V9F+gvZylmmqofANOLuaYoD829pEUB+1psjwSAbXvp++zmCiiXffx/g3f6j 6I3Q== X-Gm-Message-State: AAQBX9fRsUhTl/+kM83gOuZx97cXLRWKtxdCuj1TXDQiA2NJ22ZDBPMo 5VWy5bMVwBscRCv5slY8wIWekVMTtvs= X-Google-Smtp-Source: AKy350bLBCNdOfc9PpMcx3v/PSpqekoDiFDTE7aqoM7gsc4B5dgM+hvhxyL3uWJ9CBNh46RcjdKfQw== X-Received: by 2002:a17:906:ef90:b0:8b2:7567:9c30 with SMTP id ze16-20020a170906ef9000b008b275679c30mr1003783ejb.59.1679618930662; Thu, 23 Mar 2023 17:48:50 -0700 (PDT) Received: from ocellus.fritz.box (p200300eae71e29008ef8c5fffef034ee.dip0.t-ipconnect.de. [2003:ea:e71e:2900:8ef8:c5ff:fef0:34ee]) by smtp.gmail.com with ESMTPSA id u25-20020a50c2d9000000b004faf34064c8sm9824029edf.62.2023.03.23.17.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 17:48:50 -0700 (PDT) To: elfutils-devel@sourceware.org Cc: "Jan Alexander Steffens (heftig)" Subject: [PATCH 3/3] debuginfod: When retrieving files from cache, update atime manually Date: Fri, 24 Mar 2023 01:48:05 +0100 Message-Id: <20230324004805.156080-3-heftig@archlinux.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230324004805.156080-1-heftig@archlinux.org> References: <20230324004805.156080-1-heftig@archlinux.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Jan Alexander Steffens \(heftig\) via Elfutils-devel" From: "Jan Alexander Steffens \\(heftig\\)" Reply-To: "Jan Alexander Steffens \(heftig\)" Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" The cache cleaning logic requires atime to be correct (strictatime) but most users on Linux only have relatime or even noatime. Attempt to update the atime manually so that the cache works properly. Signed-off-by: Jan Alexander Steffens (heftig) --- debuginfod/debuginfod-client.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index 1a2d7573..484dc7b3 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -618,6 +618,19 @@ path_escape (const char *src, char *dest) dest[q] = '\0'; } +/* Attempt to update the atime */ +static void +update_atime (int fd) +{ + struct timespec tvs[2]; + + tvs[0].tv_sec = tvs[1].tv_sec = 0; + tvs[0].tv_nsec = UTIME_NOW; + tvs[1].tv_nsec = UTIME_OMIT; + + (void) futimens (fd, tvs); /* best effort */ +} + /* Attempt to read an ELF/DWARF section with name SECTION from FD and write it to a separate file in the debuginfod cache. If successful the absolute path of the separate file containing SECTION will be stored in USR_PATH. @@ -761,6 +774,7 @@ extract_section (int fd, const char *section, char *fd_path, char **usr_path) *usr_path = sec_path; else free (sec_path); + update_atime(fd); rc = sec_fd; goto out2; } @@ -1098,6 +1112,7 @@ debuginfod_query_server (debuginfod_client *c, } } /* Success!!!! */ + update_atime(fd); rc = fd; goto out; }