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 76D6A3858409 for ; Tue, 29 Aug 2023 18:33:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76D6A3858409 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=1693333991; 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: in-reply-to:in-reply-to:references:references; bh=nnDI/vcrsQu/JUR5ZUMFEhEnq5JT403w4P/wEY9qlw0=; b=JIJHBScfzi6RJ+rpYQv+D+zQI/jilnj9L8Vj8up699Hx/Pyof/VW/oyvFJtd3b6SrlpgDD l7maeDO2oFyXhV3eUnilUB5kC1FusC90b3KXJWBwAhv2mhQXNkxwK6WmF2RC9X0q95soKb 7kVwd/XSM0/KBAsYTjJnCOMHUUym/YY= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-392-tXRDaOv2MzSwW4qmai36RA-1; Tue, 29 Aug 2023 14:33:09 -0400 X-MC-Unique: tXRDaOv2MzSwW4qmai36RA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C58101C07561; Tue, 29 Aug 2023 18:33:08 +0000 (UTC) Received: from redhat.com (unknown [10.22.8.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6E2D492C13; Tue, 29 Aug 2023 18:33:08 +0000 (UTC) Received: from fche by redhat.com with local (Exim 4.94.2) (envelope-from ) id 1qb3WV-0000KG-Oq; Tue, 29 Aug 2023 14:33:07 -0400 Date: Tue, 29 Aug 2023 14:33:07 -0400 From: "Frank Ch. Eigler" To: Mark Wielaard Cc: lilydjwg , elfutils-devel@sourceware.org Subject: PR30809, was Re: [PATCH v2 2/2] debuginfod-client.c: Fix x-debuginfod-size counts differently than CURLINFO_SIZE_DOWNLOAD_T Message-ID: <20230829183307.GE24480@redhat.com> References: <20230329150237.896092-1-lilydjwg@gmail.com> <20230329150237.896092-2-lilydjwg@gmail.com> <20230329191443.GB30778@redhat.com> <20230330172413.GG30778@redhat.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.12.0 (2019-05-25) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-13.6 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_H4,RCVD_IN_MSPIKE_WL,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: Hi - > What is the status of this patch/discussion? Ummmm forgot about it. But that's OK, filed PR30809, and wrote & tested this little patch: commit 3ef3fab0d64c89a52dd6e2ce0d01dd5e713d7b5a Author: Frank Ch. Eigler Date: Tue Aug 29 14:08:04 2023 -0400 PR30809: improve debuginfod client progress-callback parameters * debuginfod-client.c (debuginfod_query_server): Use fstat(3) of the file handle being downloaded into as the preferred source of download progress. Tested by hand, as the testsuite doesn't have enough machinery to simulate compressed vs. uncompressed service. Hand testing with (unmodified) fedora-38 gdb and debuginfod-find shows dramatically improved progress displays: all have quantitative figures when fetching from real (unmodified) upstream servers. Signed-off-by: Frank Ch. Eigler diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index d92d8d62c982..6882cb190d3c 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -1533,6 +1533,20 @@ debuginfod_query_server (debuginfod_client *c, long pa = loops; /* default param for progress callback */ if (target_handle) /* we've committed to a server; report its download progress */ { + /* PR30809: Check actual size of cached file. This same + fd is shared by all the multi-curl handles (but only + one will end up writing to it). Another way could be + to tabulate totals in debuginfod_write_callback(). */ + struct stat cached; + int statrc = fstat(fd, &cached); + if (statrc == 0) + pa = (long) cached.st_size; + else + { + /* Otherwise, query libcurl for its tabulated total. + However, that counts http body length, not + decoded/decompressed content length, so does not + measure quite the same thing as dl. */ CURLcode curl_res; #if CURL_AT_LEAST_VERSION(7, 55, 0) curl_off_t dl; @@ -1549,7 +1563,7 @@ debuginfod_query_server (debuginfod_client *c, if (curl_res == 0) pa = (dl >= (double)(LONG_MAX+1UL) ? LONG_MAX : (long)dl); #endif - + } } if ((*c->progressfn) (c, pa, dl_size == -1 ? 0 : dl_size))