From 09a338ae72d2f9dd8e9372669a2ebb2f4652a905 Mon Sep 17 00:00:00 2001 From: Nicola Vetrini Date: Mon, 30 Jun 2025 10:06:54 +0200 Subject: [PATCH] xen: fix unspecified behavior in tr invocation The result of the command is undefined according to the specification if the "string2" argument in tr is shorter than "string1". GNU tr behaves correctly by extending "string2" to repeat the last character. Fixes: eb61a4fb14d2 ("xen: fix header guard generation for asm-generic headers") Reported-by: Jan Beulich Signed-off-by: Nicola Vetrini Reviewed-by: Jan Beulich --- xen/scripts/Makefile.asm-generic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/scripts/Makefile.asm-generic b/xen/scripts/Makefile.asm-generic index f6850758c5..4e628e116a 100644 --- a/xen/scripts/Makefile.asm-generic +++ b/xen/scripts/Makefile.asm-generic @@ -34,7 +34,7 @@ unwanted := $(filter-out $(generic-y) $(generated-y),$(old-headers)) quiet_cmd_wrap = WRAP $@ cmd_wrap = \ arch=$$(echo $@ | sed -n 's:.*arch/\([^/]*\)/.*:\1:p' | tr a-z A-Z); \ - upper=$$(echo $*.h | tr a-z A-Z | tr '/.-' '__'); \ + upper=$$(echo $*.h | tr a-z A-Z | tr '/.-' '___'); \ echo "\#ifndef $${arch}_GENERIC_$${upper}" > $@.new; \ echo "\#define $${arch}_GENERIC_$${upper}" >> $@.new; \ echo "\#include " >> $@.new; \