Avoid opening /dev/stdout when printing
This fixes a test failure during build in ppc64le arch Related: RHEL-111239 Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
This commit is contained in:
parent
9ae48db98c
commit
6f0ec89584
37
0012-keylime-policy-avoid-opening-dev-stdout.patch
Normal file
37
0012-keylime-policy-avoid-opening-dev-stdout.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From e9a6615ea3ab60b9248377071ea2f5cc7b45dfda Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Correia <scorreia@redhat.com>
|
||||
Date: Thu, 28 Aug 2025 14:33:59 +0100
|
||||
Subject: [PATCH] policy/sign: use print() when writing to /dev/stdout
|
||||
|
||||
Signed-off-by: Sergio Correia <scorreia@redhat.com>
|
||||
---
|
||||
keylime/policy/sign_runtime_policy.py | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/keylime/policy/sign_runtime_policy.py b/keylime/policy/sign_runtime_policy.py
|
||||
index 87529065d..316ee15aa 100644
|
||||
--- a/keylime/policy/sign_runtime_policy.py
|
||||
+++ b/keylime/policy/sign_runtime_policy.py
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import argparse
|
||||
import json
|
||||
+import sys
|
||||
from json.decoder import JSONDecodeError
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
@@ -191,8 +192,12 @@ def sign_runtime_policy(args: argparse.Namespace) -> Optional[str]:
|
||||
return None
|
||||
|
||||
try:
|
||||
- with open(args.output_file, "wb") as f:
|
||||
- f.write(signed_policy.encode("UTF-8"))
|
||||
+ if args.output_file == "/dev/stdout":
|
||||
+ # Let's simply print to stdout the regular way.
|
||||
+ print(signed_policy, file=sys.stdout)
|
||||
+ else:
|
||||
+ with open(args.output_file, "wb") as f:
|
||||
+ f.write(signed_policy.encode("UTF-8"))
|
||||
except Exception as exc:
|
||||
logger.error("Unable to write signed policy to destination file '%s': %s", args.output_file, exc)
|
||||
return None
|
||||
@ -45,6 +45,8 @@ Patch: 0010-mba-normalize-vendor_db-in-EV_EFI_VARIABLE_AUTHORITY.patch
|
||||
|
||||
# Backported from https://github.com/keylime/keylime/pull/1794
|
||||
Patch: 0011-fix-malformed-certs-workaround.patch
|
||||
# Backported from https://github.com/keylime/keylime/pull/1795
|
||||
Patch: 0012-keylime-policy-avoid-opening-dev-stdout.patch
|
||||
|
||||
# Main program: Apache-2.0
|
||||
# Icons: MIT
|
||||
|
||||
Loading…
Reference in New Issue
Block a user