From patchwork Thu May 7 22:14:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2287 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=1778192136; bh=YfZHoxkNAXWNq3oPVidTLkjpX1986yfRpF2zYH0g4dM=; 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=df/Thi1qagPIUrPfMi/ugm5QPrkj2Fzauy4WaPUfCUbnehle/I6JRQFfGBRyIS8c2 /ApzzyiUMW/S3ke6lmMDZ4tQCp8IriG0xrpkgomCBWjq2l9YUHycBbCvPVs921f9II /m3JWNUSsUxy9nHBJXx9i/hl40f//bcME2SAiFRQ= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1D5736A9B0 for ; Thu, 7 May 2026 16:15:36 -0600 (MDT) 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 jN36dlFSQ5L6 for ; Thu, 7 May 2026 16:15:36 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1778192134; bh=YfZHoxkNAXWNq3oPVidTLkjpX1986yfRpF2zYH0g4dM=; 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=h0yGZMXdxFUk0WwqQhTkrNeNqHRYwuQJPuiGSoC/3RwZRubp25YkEabQk8a6+tHQc jsw6jABj7dTJA6rGzyU9Tw24PQTpu1XQBU49vQxjgLSrylXuyo+7WFdWfCoVMOALJt +2T0yZ7iDEalN0ydHWkyrMrFV+CwvqSHhU4UY7JY= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5B5E96A9B9 for ; Thu, 7 May 2026 16:15:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1778192132; bh=CdBk6WYSoXaYiRrY9stg3+DMuX9YPA89UCnvomyvV9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cRlCUdjgGkSXREiU4AragKl6rnFy/AvVQyV5qRAHt37kMogxuNx9f0ZPJk0Ci7Bcx H5C3LbeZgCbw2n530y87pLn3HLqTrdP+kkxoW1m1XZqaVOLzhGjj+ent4TlQ8YfasA et7HyiXLXoxHqIMxdth61QIN786ltZ+HV53zbg0E= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 351C06A9C2; Thu, 7 May 2026 16:15:32 -0600 (MDT) 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 qNZS7jcdLDSz; Thu, 7 May 2026 16:15:32 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1778192130; bh=saGB3TniDIbPNHYZML0fVQp6rDKWrnAwKtU7BktdYqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OT61DC/KZtAg9X/NIrnDN2hU9zpl3B2xIRgWT3F8qU0CkEjg3AIvzJPD31QfkSMgp VkdARy8jL0N8W93rKNhkojCDxpWHln4Nr5Ef6pHI9bB6UfEMt3R7yh/sVvFUK6JuZw v27QWnnAQbPkPsMgCSOQhuOSYkQW6oaM27AyqSOo= Received: from u-boot.org (unknown [174.51.25.52]) by mail.u-boot.org (Postfix) with ESMTPSA id 4DEAC6A959; Thu, 7 May 2026 16:15:30 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 7 May 2026 16:14:54 -0600 Message-ID: <20260507221507.505998-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260507221507.505998-1-sjg@u-boot.org> References: <20260507221507.505998-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: FAGBW5OCB3A6ZTK5XOAKERYCSKSMNRWF X-Message-ID-Hash: FAGBW5OCB3A6ZTK5XOAKERYCSKSMNRWF 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 09/13] scripts: ubuntu: Use command.run() in hash_password() 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 The rest of the script funnels every external invocation through u_boot_pylib's command.run(), so its CommandExc carries the captured output on failure and the -v/-quiet wiring keeps subprocess chatter out of the default run. hash_password() is the lone holdout, going straight to subprocess.run() to feed the plaintext password through stdin. command.run() takes the same data via stdin_data= and returns the captured stdout as a string when capture=True, so the conversion keeps the no-arg-on-the-command-line property of the password input and lets us drop the subprocess import altogether. Signed-off-by: Simon Glass --- scripts/ubuntu-iso-to-uboot.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/ubuntu-iso-to-uboot.py b/scripts/ubuntu-iso-to-uboot.py index 68ba4cd3d97..d43308676e3 100755 --- a/scripts/ubuntu-iso-to-uboot.py +++ b/scripts/ubuntu-iso-to-uboot.py @@ -66,7 +66,6 @@ import argparse import os import re import shutil -import subprocess import sys import tempfile from pathlib import Path @@ -339,11 +338,10 @@ def hash_password(password: str) -> str: password. Shelling out to openssl keeps the script's dependency list unchanged (Python's crypt module is gone in 3.13). """ - out = subprocess.run( - ['openssl', 'passwd', '-6', '-stdin'], - input=password, capture_output=True, text=True, check=True, - ) - return out.stdout.strip() + return command.run( + 'openssl', 'passwd', '-6', '-stdin', + capture=True, stdin_data=password, + ).strip() def autoinstall_yaml(