From unknown Sun Jun 15 09:01:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49298: [PATCH] df: do not print duplicated entires with NFS and bind mounts Resent-From: Kamil Dudka Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 30 Jun 2021 15:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49298 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: 49298@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162506842223567 (code B ref -1); Wed, 30 Jun 2021 15:54:01 +0000 Received: (at submit) by debbugs.gnu.org; 30 Jun 2021 15:53:42 +0000 Received: from localhost ([127.0.0.1]:58550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lycWz-000683-KN for submit@debbugs.gnu.org; Wed, 30 Jun 2021 11:53:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:35782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lycWx-00067u-3r for submit@debbugs.gnu.org; Wed, 30 Jun 2021 11:53:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lycWw-00074f-Qp for bug-coreutils@gnu.org; Wed, 30 Jun 2021 11:53:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58784) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lycWr-000141-W5 for bug-coreutils@gnu.org; Wed, 30 Jun 2021 11:53:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625068411; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iUXyGLtW+6qV+v8NddUwC/ENQKzay2srT0jg/BqByFY=; b=TrjuqOZnEH+frmTjf4zR3q7uvRlAeUhHmHgjWwe7Z08OSV6HOEQ1IjqKaAO3D+vW1RONNP iNvQW5D3sJId8KulcI8BHpUZm64/rt+vWUaqi2oOWME9ipuUb/xlN0++tL0pzQraDL1i0o CukXyjyZGYyzI1Kg4yJ7Eb1BqXdqSFc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-8xtNT4AvNGeBkeKkNgPhFA-1; Wed, 30 Jun 2021 11:53:28 -0400 X-MC-Unique: 8xtNT4AvNGeBkeKkNgPhFA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B9E1C100CEC2 for ; Wed, 30 Jun 2021 15:53:27 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.7.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id E49F519C79; Wed, 30 Jun 2021 15:53:23 +0000 (UTC) From: Kamil Dudka Date: Wed, 30 Jun 2021 17:53:22 +0200 Message-Id: <20210630155322.149629-1-kdudka@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kdudka@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=170.10.133.124; envelope-from=kdudka@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.435, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) As originally reported in , df invoked without -a printed duplicated entries for NFS mounts of bind mounts. This is a regression from commit v8.25-54-g1c17f61ef99, which introduced the use of a hash table. The proposed patch makes sure that the devlist entry seen the last time is used for comparison when eliminating duplicated mount entries. This way it worked before introducing the hash table. Patch co-authored by Roberto Bergantinos. * src/ls.c (struct devlist): Introduce the seen_last pointer. (devlist_for_dev): Return the devlist entry seen the last time if found. (filter_mount_list): Remember the devlist entry seen the last time for each hashed item. --- src/df.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/df.c b/src/df.c index aadc3483f22..16a7b5524df 100644 --- a/src/df.c +++ b/src/df.c @@ -54,6 +54,7 @@ struct devlist dev_t dev_num; struct mount_entry *me; struct devlist *next; + struct devlist *seen_last; /* valid for hashed devlist entries only */ }; /* Filled with device numbers of examined file systems to avoid @@ -681,7 +682,13 @@ devlist_for_dev (dev_t dev) return NULL; struct devlist dev_entry; dev_entry.dev_num = dev; - return hash_lookup (devlist_table, &dev_entry); + + struct devlist *found = hash_lookup (devlist_table, &dev_entry); + if (found == NULL) + return NULL; + + /* Return the last devlist entry we have seen with this dev_num */ + return found->seen_last; } static void @@ -799,8 +806,12 @@ filter_mount_list (bool devices_only) devlist->dev_num = buf.st_dev; devlist->next = device_list; device_list = devlist; - if (hash_insert (devlist_table, devlist) == NULL) + + struct devlist *inserted = hash_insert (devlist_table, devlist); + if (inserted == NULL) xalloc_die (); + /* Remember the last devlist entry we have seen with this dev_num */ + inserted->seen_last = devlist; me = me->me_next; } -- 2.31.1 From unknown Sun Jun 15 09:01:28 2025 X-Loop: help-debbugs@gnu.org Subject: bug#49298: [PATCH] df: do not print duplicated entires with NFS and bind mounts Resent-From: L A Walsh Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 02 Jul 2021 06:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49298 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch Cc: kdudka@redhat.com, 49298@debbugs.gnu.org X-Debbugs-Original-Cc: Kamil Dudka , Coreutils Received: via spool by submit@debbugs.gnu.org id=B.16252070839242 (code B ref -1); Fri, 02 Jul 2021 06:25:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Jul 2021 06:24:43 +0000 Received: from localhost ([127.0.0.1]:34040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzCbT-0002Oz-96 for submit@debbugs.gnu.org; Fri, 02 Jul 2021 02:24:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:56592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzCbR-0002Os-Ql for submit@debbugs.gnu.org; Fri, 02 Jul 2021 02:24:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzCbR-0007Jo-Hy for bug-coreutils@gnu.org; Fri, 02 Jul 2021 02:24:41 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:43232 helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzCbP-0000NN-F3 for bug-coreutils@gnu.org; Fri, 02 Jul 2021 02:24:41 -0400 Received: from [192.168.3.12] (Athenae [192.168.3.12]) by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id 1626OB13001632; Thu, 1 Jul 2021 23:24:13 -0700 Message-ID: <60DEB0D1.7090708@tlinx.org> Date: Thu, 01 Jul 2021 23:23:13 -0700 From: L A Walsh User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 References: <20210630155322.149629-1-kdudka@redhat.com> In-Reply-To: <20210630155322.149629-1-kdudka@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=173.164.175.65; envelope-from=coreutils@tlinx.org; helo=Ishtar.sc.tlinx.org X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, MISSING_HEADERS=1.021, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.1 (-) On 2021/06/30 08:53, Kamil Dudka wrote: > The proposed patch makes sure that the devlist entry seen the last time > is used for comparison when eliminating duplicated mount entries. --- I'm a bit surprised that the devlists exported for NFS are the same as for smb. How is that guaranteed? But more important, does it work with other network file systems? Mostly I'm thinking about mounts of NTFS from a win server. I've gotten different results over time, specifically, in regards to whether or not inode numbers are unique. Would it be possible for the network file systems to return different amounts for free+used space depending on the net-interface being used (I don't know -- I'd hope it wasn't likely, but ....) Another way of solving this issue, other than by special casing SMB+NFS, a switch that prohibits crossing over to another networked file system, and a different setting that prohibits crossing over to another device. I think there is a need for both as well as how initial args are treated -- as is done with 'find' in all its diversity! ;-) Patches to reintroduce behaviors that might result in non-deterministic behaviors are, at least, "worrisome". From unknown Sun Jun 15 09:01:28 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Kamil Dudka Subject: bug#49298: closed (Re: bug#49298: [PATCH] df: do not print duplicated entires with NFS and bind mounts) Message-ID: References: <20210630155322.149629-1-kdudka@redhat.com> X-Gnu-PR-Message: they-closed 49298 X-Gnu-PR-Package: coreutils X-Gnu-PR-Keywords: patch Reply-To: 49298@debbugs.gnu.org Date: Fri, 02 Jul 2021 15:08:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1625238482-10513-1" This is a multi-part message in MIME format... ------------=_1625238482-10513-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #49298: [PATCH] df: do not print duplicated entires with NFS and bind mounts which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 49298@debbugs.gnu.org. --=20 49298: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D49298 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1625238482-10513-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 49298-done) by debbugs.gnu.org; 2 Jul 2021 15:07:50 +0000 Received: from localhost ([127.0.0.1]:36872 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzKli-0002j9-EG for submit@debbugs.gnu.org; Fri, 02 Jul 2021 11:07:50 -0400 Received: from mail-wr1-f53.google.com ([209.85.221.53]:45736) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzKle-0002iv-Sc for 49298-done@debbugs.gnu.org; Fri, 02 Jul 2021 11:07:49 -0400 Received: by mail-wr1-f53.google.com with SMTP id j2so12825901wrs.12 for <49298-done@debbugs.gnu.org>; Fri, 02 Jul 2021 08:07:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=12zArSiA77AeftgvUmZqVWRYwuPLA0/Z3/MqsMv17lI=; b=mgn0JWGe1cOdJ2T0nmBfVyItDCrijgmeFKsblbjXfFsJODAzzsSaSBQqafJvIsFm/1 x1Oz92Zb5aXaBI4Fi0d4xN5pZFRhhfwMgYQUWXMCueJ0WqCfqbH5g3x+xv1p5CuMziJy DZZ2+dl7FQ4zyjS6NTaoTIRlEqDOtWhNKBBmScT7350Vo3o1s4SZK+eMD4zJ/jQDy/wA axLTw1uIKETlpFqVNm72kh7yJyGvbng32wok0BeKwqQNJtqEY+ngjKAjL+fDZDK2QUdY zoIFvWnDfTXSrpCOohWHvDvxiSVBtb8Mwct2WL8oaVsHuCA+o0VZ61U3NcloJRqzupIo hXHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=12zArSiA77AeftgvUmZqVWRYwuPLA0/Z3/MqsMv17lI=; b=hLUjIrkNEYCs1y+lXp9gEOEnXRW9pP4U70jIbqJ0WwhyR5DxzOXowHkCVQzbcF2FFx s93VtXX7zkdKYGUJTbzMt3C7uHtUyTFQwmDuIvmytNg1WHdBD0JYD8At+hA5zKU1y80y Z0YoWv8Zjj94nao8PEckxTXZVyCKKKnHgEseWA3pNl6o2MkKw0+YQqRH1Upexb5jb/5E 0n4zBStOFc2zlNfjmLIMyavaGnPRMWY3luggQxJu3iom6EMQaZIGkrURwefqsOj/svpK UNUfc4PfmoTxAYwt2cr0eiVOBQeOP/Fql3Ey0F/d2MLJPFL+4MF2l4uTiAah/iq8bzMR MmhQ== X-Gm-Message-State: AOAM532VBo0ubcoNMslMbG/fbKevVrwbqsIdjfOkTfdSdkEFBbAATyli gJxbuJOCTRkR6VUEjFZIUcUq8RN/XancSQ== X-Google-Smtp-Source: ABdhPJyi6TP0ZYm5W+OCgWHczXWntmZ3aQTmEt5Dug1tn+nqIXX/p3ZCKSSrcJdrSj9kCRDkRNmjhw== X-Received: by 2002:a5d:424d:: with SMTP id s13mr99964wrr.9.1625238460886; Fri, 02 Jul 2021 08:07:40 -0700 (PDT) Received: from localhost.localdomain (86-42-15-3-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.42.15.3]) by smtp.googlemail.com with UTF8SMTPSA id o11sm12698652wmc.2.2021.07.02.08.07.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Jul 2021 08:07:40 -0700 (PDT) Subject: Re: bug#49298: [PATCH] df: do not print duplicated entires with NFS and bind mounts To: Kamil Dudka , 49298-done@debbugs.gnu.org References: <20210630155322.149629-1-kdudka@redhat.com> From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: Date: Fri, 2 Jul 2021 16:07:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: <20210630155322.149629-1-kdudka@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 49298-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 30/06/2021 16:53, Kamil Dudka wrote: > As originally reported in , > df invoked without -a printed duplicated entries for NFS mounts > of bind mounts. This is a regression from commit v8.25-54-g1c17f61ef99, > which introduced the use of a hash table. > > The proposed patch makes sure that the devlist entry seen the last time > is used for comparison when eliminating duplicated mount entries. This > way it worked before introducing the hash table. > > Patch co-authored by Roberto Bergantinos. > > * src/ls.c (struct devlist): Introduce the seen_last pointer. > (devlist_for_dev): Return the devlist entry seen the last time if found. > (filter_mount_list): Remember the devlist entry seen the last time for > each hashed item. Indeed order is significant here as we can have multiple entries for the same dev nums. The patch looks good and restores the ordering from before commit 1c17f61ef. I'll will apply this. Marking as done. thanks! Pádraig ------------=_1625238482-10513-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 30 Jun 2021 15:53:42 +0000 Received: from localhost ([127.0.0.1]:58550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lycWz-000683-KN for submit@debbugs.gnu.org; Wed, 30 Jun 2021 11:53:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:35782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lycWx-00067u-3r for submit@debbugs.gnu.org; Wed, 30 Jun 2021 11:53:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lycWw-00074f-Qp for bug-coreutils@gnu.org; Wed, 30 Jun 2021 11:53:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58784) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lycWr-000141-W5 for bug-coreutils@gnu.org; Wed, 30 Jun 2021 11:53:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625068411; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iUXyGLtW+6qV+v8NddUwC/ENQKzay2srT0jg/BqByFY=; b=TrjuqOZnEH+frmTjf4zR3q7uvRlAeUhHmHgjWwe7Z08OSV6HOEQ1IjqKaAO3D+vW1RONNP iNvQW5D3sJId8KulcI8BHpUZm64/rt+vWUaqi2oOWME9ipuUb/xlN0++tL0pzQraDL1i0o CukXyjyZGYyzI1Kg4yJ7Eb1BqXdqSFc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-8xtNT4AvNGeBkeKkNgPhFA-1; Wed, 30 Jun 2021 11:53:28 -0400 X-MC-Unique: 8xtNT4AvNGeBkeKkNgPhFA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B9E1C100CEC2 for ; Wed, 30 Jun 2021 15:53:27 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.7.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id E49F519C79; Wed, 30 Jun 2021 15:53:23 +0000 (UTC) From: Kamil Dudka To: bug-coreutils@gnu.org Subject: [PATCH] df: do not print duplicated entires with NFS and bind mounts Date: Wed, 30 Jun 2021 17:53:22 +0200 Message-Id: <20210630155322.149629-1-kdudka@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kdudka@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=170.10.133.124; envelope-from=kdudka@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.435, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) As originally reported in , df invoked without -a printed duplicated entries for NFS mounts of bind mounts. This is a regression from commit v8.25-54-g1c17f61ef99, which introduced the use of a hash table. The proposed patch makes sure that the devlist entry seen the last time is used for comparison when eliminating duplicated mount entries. This way it worked before introducing the hash table. Patch co-authored by Roberto Bergantinos. * src/ls.c (struct devlist): Introduce the seen_last pointer. (devlist_for_dev): Return the devlist entry seen the last time if found. (filter_mount_list): Remember the devlist entry seen the last time for each hashed item. --- src/df.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/df.c b/src/df.c index aadc3483f22..16a7b5524df 100644 --- a/src/df.c +++ b/src/df.c @@ -54,6 +54,7 @@ struct devlist dev_t dev_num; struct mount_entry *me; struct devlist *next; + struct devlist *seen_last; /* valid for hashed devlist entries only */ }; /* Filled with device numbers of examined file systems to avoid @@ -681,7 +682,13 @@ devlist_for_dev (dev_t dev) return NULL; struct devlist dev_entry; dev_entry.dev_num = dev; - return hash_lookup (devlist_table, &dev_entry); + + struct devlist *found = hash_lookup (devlist_table, &dev_entry); + if (found == NULL) + return NULL; + + /* Return the last devlist entry we have seen with this dev_num */ + return found->seen_last; } static void @@ -799,8 +806,12 @@ filter_mount_list (bool devices_only) devlist->dev_num = buf.st_dev; devlist->next = device_list; device_list = devlist; - if (hash_insert (devlist_table, devlist) == NULL) + + struct devlist *inserted = hash_insert (devlist_table, devlist); + if (inserted == NULL) xalloc_die (); + /* Remember the last devlist entry we have seen with this dev_num */ + inserted->seen_last = devlist; me = me->me_next; } -- 2.31.1 ------------=_1625238482-10513-1--