From patchwork Thu Feb 26 20:00:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1939 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136101; bh=T1i8rd6Aam4rByKSN7nGeJpSpcasvszD646nXjXk5Ok=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=umCU+kqpfuReo3Cta91gL5u0abI5r/gD7J+bf/nXPGqT2v/oS5L8aFJMBUxNdHoLX FTUqpQTZvz+qxtqz7Xr2D1rsYkj8sGvu+wjw9FKTnxakSd9oMNbqH2M619YgfPFdtl B7JMEAqYVSrj+rI6TSrKbzCjstnN9GQhkKo/yWlyIp4j2Sf5QaxWkmdhd/T7Ht/l4p yiP0/mE+Mm5ZSZEEyIgFh3Q7mCgWusvJPzqBC9nt4eO+uc9SVNX3Uh5lYSyL7OH7zc Jc9yEGsNtFrd9r64UbjQL4ZzfJAOjZTXAE2hx6lNLI5RkmV4DTWlAesCPizkJH+px6 gWMmQKcw4RORA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B4DDA69E36 for ; Thu, 26 Feb 2026 13:01:41 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id eiZIOnpXRNxd for ; Thu, 26 Feb 2026 13:01:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136101; bh=T1i8rd6Aam4rByKSN7nGeJpSpcasvszD646nXjXk5Ok=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=umCU+kqpfuReo3Cta91gL5u0abI5r/gD7J+bf/nXPGqT2v/oS5L8aFJMBUxNdHoLX FTUqpQTZvz+qxtqz7Xr2D1rsYkj8sGvu+wjw9FKTnxakSd9oMNbqH2M619YgfPFdtl B7JMEAqYVSrj+rI6TSrKbzCjstnN9GQhkKo/yWlyIp4j2Sf5QaxWkmdhd/T7Ht/l4p yiP0/mE+Mm5ZSZEEyIgFh3Q7mCgWusvJPzqBC9nt4eO+uc9SVNX3Uh5lYSyL7OH7zc Jc9yEGsNtFrd9r64UbjQL4ZzfJAOjZTXAE2hx6lNLI5RkmV4DTWlAesCPizkJH+px6 gWMmQKcw4RORA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A3E6369DAB for ; Thu, 26 Feb 2026 13:01:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136099; bh=msMgIEUdsVAD9SIfTiuRV/OfLAPuAFXkrjmDrd4W/Ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S5QSh9qOK9SBN5gFW8nvmUL0C/ey3ojx4Ta0qFyxJzRpFvMqMaZlpOtv2TAAHoplD u9Qo+t9fXHNfF1QSBNlVGvA0c8t5ikCKas/jyxtoIF597WKWJVCMIBHcFLjBqpwhTl t7fWZp5lGrewQbpqJPdcyrQVLS2WHfQd2uzYNtN+p0b92wRvcHHpzGSam5zqgPw18g 9uO/rr/xoTInCyfCynWKuZj/1vYEoYvSQJUMcg2udx5mec+N3JEMka0te9jYZxeMai 65lmBhc6zo7UYTBhsEcmJcxndlaoCFyh8H5wgc6Z8/YG0nyqBxNNKUh1DbyjXocIs+ +C/snpj8z6WHw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CC22669D79; Thu, 26 Feb 2026 13:01:39 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 7_qRTd2wjXUH; Thu, 26 Feb 2026 13:01:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136095; bh=n3jA2J7yJNxMAbhxweHX5aM2CpI9rQbJTFQhx3AyNt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MR4WO0HX7CXp+/M70W73UJRlixqwTlVW5CNpTwoxWCajsQG4Ijf51R0RYe6YppZAL sMG9z0h2LhgdvauMvVNO8NY78FF9EXenUI/6CBF5Z0n/aWnrdqLQgIBmjmhWokJ46L LX33TK22xryeM+s14PSytO49Ut/mefRQfqiIXWyLG2VWlcyzCpv5Vq0prB5kZxGEGm go0tKCfTM+Kqd4qKuPSP6UWfzhVVI4+OjLm7uMJXnCqcJS8tSbIrCIQn6xVk5yM2Sf L5TNUq6rQzm5r/vr8K31NxhYzAq1E1+VWoAlituuWyjqTdl/KtyELMYI8jRBVXa9zA dyVn8Rvvjrelg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B46D669D4A; Thu, 26 Feb 2026 13:01:35 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 26 Feb 2026 13:00:08 -0700 Message-ID: <20260226200106.1727176-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260226200106.1727176-1-sjg@u-boot.org> References: <20260226200106.1727176-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: CZVKMTW2NXMIMGIAUMMH5WOTRRW4NICJ X-Message-ID-Hash: CZVKMTW2NXMIMGIAUMMH5WOTRRW4NICJ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/32] patman: Reject database versions newer than supported List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass If a newer version of patman has upgraded the database schema beyond what the current patman understands, it goes into an infinite loop, trying to migrate. Exit with an error message instead. Signed-off-by: Simon Glass --- tools/patman/database.py | 6 ++++++ tools/patman/test_cseries.py | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/tools/patman/database.py b/tools/patman/database.py index e6684f990da..4557c4ff3fc 100644 --- a/tools/patman/database.py +++ b/tools/patman/database.py @@ -86,6 +86,12 @@ class Database: # pylint:disable=R0904 def start(self): """Open the database read for use, migrate to latest schema""" self.open_it() + old_version = self.get_schema_version() + if old_version > LATEST: + self.close() + tout.fatal( + f'Database version {old_version} is too new (max' + f' {LATEST}); please update patman') self.migrate_to(LATEST) def open_it(self): diff --git a/tools/patman/test_cseries.py b/tools/patman/test_cseries.py index 11724b1378f..3a9411033a6 100644 --- a/tools/patman/test_cseries.py +++ b/tools/patman/test_cseries.py @@ -3318,6 +3318,23 @@ Date: .* self.assertEqual(version, db.get_schema_version()) self.assertEqual(4, database.LATEST) + def test_migrate_future_version(self): + """Test that a database newer than patman is rejected""" + db = database.Database(f'{self.tmpdir}/.patman.db') + with terminal.capture(): + db.start() + + # Set the schema version beyond what patman supports + db.cur.execute( + f'UPDATE schema_version SET version = {database.LATEST + 1}') + db.commit() + db.close() + + with self.assertRaises(SystemExit): + with terminal.capture() as (_, err): + db.start() + self.assertIn('is too new', err.getvalue()) + def test_series_scan(self): """Test scanning a series for updates""" cser, _ = self.setup_second()