From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9B31015838C for ; Tue, 16 Jan 2024 05:16:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 79998E2BAF; Tue, 16 Jan 2024 05:16:15 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 46B9FE2BAF for ; Tue, 16 Jan 2024 05:16:15 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5041134326C for ; Tue, 16 Jan 2024 05:16:14 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DF42812C8 for ; Tue, 16 Jan 2024 05:16:12 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1705382168.c9ed8136f9f0c56dc7b72d400eaa0acbd338778f.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/dbapi/vartree.py X-VCS-Directories: lib/portage/dbapi/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: c9ed8136f9f0c56dc7b72d400eaa0acbd338778f X-VCS-Branch: master Date: Tue, 16 Jan 2024 05:16:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7ba86bb5-defd-4fba-a8c6-9ae5cc898518 X-Archives-Hash: 53e59406dec879ae539af3524ef6642e commit: c9ed8136f9f0c56dc7b72d400eaa0acbd338778f Author: Konstantin Tokarev yandex ru> AuthorDate: Fri Jan 12 17:47:45 2024 +0000 Commit: Sam James gentoo org> CommitDate: Tue Jan 16 05:16:08 2024 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c9ed8136 vartree: _needs_move() should replace file if filecmp fails for whatever reason When trying to update I've got "OSError: [Errno 5] Input/output error" exception traceback from portage originating from _needs_move(). It turned out that 3 files in my root filesystem were corrupted, which caused filecmp to fail. This patch makes portage replace original file in this case. Bug: https://bugs.gentoo.org/722270 Signed-off-by: Konstantin Tokarev yandex.ru> Closes: https://github.com/gentoo/portage/pull/1233 Signed-off-by: Sam James gentoo.org> lib/portage/dbapi/vartree.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py index 5d39ca1965..a00c731c57 100644 --- a/lib/portage/dbapi/vartree.py +++ b/lib/portage/dbapi/vartree.py @@ -6283,7 +6283,19 @@ class dblink: if not _cmpxattr(src_bytes, dest_bytes, exclude=excluded_xattrs): return True - return not filecmp.cmp(src_bytes, dest_bytes, shallow=False) + try: + files_equal = filecmp.cmp(src_bytes, dest_bytes, shallow=False) + except Exception as e: + writemsg( + _( + "Exception '%s' happened when comparing files %s and %s, will replace the latter\n" + ) + % (e, mysrc, mydest), + noiselevel=-1, + ) + return True + + return not files_equal def merge(