GNU bug report logs - #34683
regression in file tree walker

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: idutils; Reported by: Mike Gulick <mgulick@HIDDEN>; dated Thu, 28 Feb 2019 15:36:02 UTC; Maintainer for idutils is bug-idutils@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 28 Feb 2019 15:35:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 28 10:35:10 2019
Received: from localhost ([127.0.0.1]:55383 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gzNiI-0004lD-2A
	for submit <at> debbugs.gnu.org; Thu, 28 Feb 2019 10:35:10 -0500
Received: from eggs.gnu.org ([209.51.188.92]:47675)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mgulick@HIDDEN>) id 1gzNgK-0004hk-Gi
 for submit <at> debbugs.gnu.org; Thu, 28 Feb 2019 10:33:10 -0500
Received: from lists.gnu.org ([209.51.188.17]:60552)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <mgulick@HIDDEN>) id 1gzNgB-0002Zt-2F
 for submit <at> debbugs.gnu.org; Thu, 28 Feb 2019 10:33:01 -0500
Received: from eggs.gnu.org ([209.51.188.92]:33770)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mgulick@HIDDEN>) id 1gzNg5-0005E3-3b
 for bug-idutils@HIDDEN; Thu, 28 Feb 2019 10:32:58 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mgulick@HIDDEN>) id 1gzNfz-0002US-35
 for bug-idutils@HIDDEN; Thu, 28 Feb 2019 10:32:49 -0500
Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]:34699)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <mgulick@HIDDEN>) id 1gzNfx-0002R6-0v
 for bug-idutils@HIDDEN; Thu, 28 Feb 2019 10:32:45 -0500
Received: by mail-qt1-x834.google.com with SMTP id w4so23994230qtc.1
 for <bug-idutils@HIDDEN>; Thu, 28 Feb 2019 07:32:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=to:from:subject:message-id:date:user-agent:mime-version
 :content-language:content-transfer-encoding;
 bh=yZeYTjnyD/gNECPZnPKyT0fO5tUmLT2CHjQ26vwffB0=;
 b=pc8paORXTDFEaVLT41Lb63RTqs6ZSyOVXBPLG9vGbrObj9iRN4QkL/SOkEVmVf2yzz
 rTb711aYIVntNOUYFkOV6okAry3a3JqNHJQnz+fPLXCIAKEsIOq+6bz2+CKiwksLtxGo
 ct+DnKyuaYTJwpSlaxlg1m64y7ADb17+thkPhYDzYEcFEf+UiGbm5GBP2zNoDJFfUQJ9
 LIwDMQSETNIU6cEDQoba/UazjZR2RxUr2Y9DTcs/wDNJOGqBGkLOo2s9QhMAgVVmkIhF
 2eL9BTM1yqlLoD6nifvXz2PUJ69sgDe3XFUhwnYdkAI9U62a+knt1N3QNrq33gyXQtlj
 XoNQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:to:from:subject:message-id:date:user-agent
 :mime-version:content-language:content-transfer-encoding;
 bh=yZeYTjnyD/gNECPZnPKyT0fO5tUmLT2CHjQ26vwffB0=;
 b=QILb5YWxR7CiQ4qzaYL0u/Cp486ltLYIAFncgAliirM3gAHi/49YhAINO/Fd5UL+9G
 qxHZN4IHR6c/Aw2eKoko6JSw/9C64XGD2MKYJXiSA2/D2cLqiMqKCd/Gz4FhxBZq2jGB
 IaNLMOj90CaRpMXDP/relAPOXEerB/9SY5TbPpyUFljvv9KqX07P9GEMzrFMDwW98L6w
 sc7aLEp7ea4VC6nkNiEj5d6ss2Pla07rUGQarXXdqkFg6udKG1D4Yoi6qAzFDq+8zqMz
 OvAULT7oPsYU8/Cuv0jcjbubXb7ZzIUMEoFOJnKErlt9SAmYLnGhrioQQEbldhVP1nzc
 aipQ==
X-Gm-Message-State: AHQUAuY7cIqUGbhFLcBrbXnUVZe9JjDVFlF5SmQ8KOVPcIWCuplOsk7/
 VNP0b+mpxBTL6f3M7XabNv/GcHzM
X-Google-Smtp-Source: AHgI3IYydk2dSvWBW7vV65UovZXpug/G1TiaRMIQy5Ch3mx/M+bQmCiK1K2WOy51e0qMneTa7+XvSg==
X-Received: by 2002:aed:35c6:: with SMTP id d6mr6947235qte.320.1551367959310; 
 Thu, 28 Feb 2019 07:32:39 -0800 (PST)
Received: from [172.20.132.217] ([144.212.128.4])
 by smtp.gmail.com with ESMTPSA id s76sm6645598qki.42.2019.02.28.07.32.38
 for <bug-idutils@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 28 Feb 2019 07:32:38 -0800 (PST)
To: bug-idutils@HIDDEN
From: Mike Gulick <mgulick@HIDDEN>
Subject: regression in file tree walker
Message-ID: <4f5815f9-52e4-70ab-d72c-7b5311e6e066@HIDDEN>
Date: Thu, 28 Feb 2019 10:32:37 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.5.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Language: en-US-large
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::834
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 28 Feb 2019 10:35:07 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Hi,

I was testing the tip of the idutils, and I saw that a bunch of files
were getting left out of my idutils database.  I also see a bunch of
warnings about files being the same but different.  E.g.

$ ./src/mkid -m libidu/id-lang.map -o test_db.ID /usr/include/
./mkid: warning: `/usr/include/wireless.h' and `/usr/include/pugiconfig.hpp' are the same file, but yield different scans!
./mkid: warning: `/usr/include/c++/8.2.1/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp' and `/usr/include/sodium.h' are the same file, but yield different scans!
./mkid: warning: `/usr/include/c++/8.2.1/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp' and `/usr/include/neaacdec.h' are the same file, but yield different scans!
./mkid: warning: `/usr/include/c++/8.2.1/ext/pb_ds/detail/rb_tree_map_/traits.hpp' and `/usr/include/faad.h' are the same file, but yield different scans!
./mkid: warning: `/usr/include/c++/8.2.1/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp' and `/usr/include/git2.h' are the same file, but yield different scans!
./mkid: warning: `/usr/include/guile/2.0/readline.h' and `/usr/include/c++/8.2.1/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp' are the same file, but yield different scans!
...

The issue seems to be in the last commit that changes
dev_ino_hash_compare.  This function is returning 1 (true) when the
dev_ino structs are identical and 0 (false) when different.  However
the hash table expects traditional comparator behavior (i.e. x - y).
The following patch fixes the issue for me.

Thanks,
Mike

--

diff --git a/libidu/walker.c b/libidu/walker.c
index b6a6109..e43f3f5 100644
--- a/libidu/walker.c
+++ b/libidu/walker.c
@@ -1141,9 +1141,16 @@ DEV_INO_HASH_DEFUN(dev_ino_hash_2, xform_NOT)
 static int
 dev_ino_hash_compare (void const *xv, void const *yv)
 {
+  int result;
   struct dev_ino const *x = xv;
   struct dev_ino const *y = yv;
-  return x->di_ino == y->di_ino && x->di_dev == y->di_dev;
+
+  result = (x->di_ino > y->di_ino) - (x->di_ino < y->di_ino);
+  if (result)
+    return result;
+
+  result = (x->di_dev > y->di_dev) - (x->di_dev < y->di_dev);
+  return result;
 }
 
 #endif





Acknowledgement sent to Mike Gulick <mgulick@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-idutils@HIDDEN. Full text available.
Report forwarded to bug-idutils@HIDDEN:
bug#34683; Package idutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.