From: Jan Stancek <jstan...@redhat.com>

redhat/kernel.spec.template: avoid process substitution

Wang Yugui reports that the process substitution construct doesn't work
in old environments (e.g. rhel7 + devtoolsets-8):
  /var/tmp/rpm-tmp.mVZU4h: line 696: syntax error near unexpected token `<'

          while read -r kmod; do
              local 
target_file="$RPM_BUILD_ROOT/lib/modules/$KernelVer/$subdir_name/$kmod"
              local target_dir="${target_file%/*}"
              mkdir -p "$target_dir"
              mv "$RPM_BUILD_ROOT/lib/modules/$KernelVer/kernel/$kmod" 
"$target_dir"
  L696:   done < <(sed -e 's|^kernel/||' "$module_list")
          set -x

Simplify it using a temp file.

Fixes: ad0b8a853077 ("spec: rework filter-mods and mod-denylist")
Reported-by: Wang Yugui <wangyu...@e16-tech.com>
Signed-off-by: Jan Stancek <jstan...@redhat.com>

diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -2581,16 +2581,19 @@ BuildKernel() {
     {
         local module_list="$1"
         local subdir_name="$2"
+        local tmpfile=$(mktemp)
 
         mkdir -p "$RPM_BUILD_ROOT/lib/modules/$KernelVer/$subdirname"
 
+        sed -e 's|^kernel/||' "$module_list" > $tmpfile
         set +x
         while read -r kmod; do
             local 
target_file="$RPM_BUILD_ROOT/lib/modules/$KernelVer/$subdir_name/$kmod"
             local target_dir="${target_file%/*}"
             mkdir -p "$target_dir"
             mv "$RPM_BUILD_ROOT/lib/modules/$KernelVer/kernel/$kmod" 
"$target_dir"
-        done < <(sed -e 's|^kernel/||' "$module_list")
+        done < $tmpfile
+        rm -f $tmpfile
         set -x
     }
 

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/3087
--
_______________________________________________
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to