From c6fdfa6adc5fcf80dd42ae9601485813a086ce4d Mon Sep 17 00:00:00 2001 From: Wei Jihui Date: Wed, 23 Jun 2021 10:45:00 +0800 Subject: [PATCH] lib/job2sh.rb: fix rewrite define_files [why] use cat or echo direct input strings to files are unaccurately. [how] read define files --> val val encode by base64 echo decode val to files at testbox Signed-off-by: Wei Jihui --- lib/job2sh.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/job2sh.rb b/lib/job2sh.rb index e2d66bb42..78b501ae8 100755 --- a/lib/job2sh.rb +++ b/lib/job2sh.rb @@ -5,6 +5,7 @@ require "#{LKP_SRC}/lib/job" require "#{LKP_SRC}/lib/lkp_path" require 'shellwords' +require 'base64' TMP ||= ENV['TMP'] || '/tmp' @@ -352,8 +353,9 @@ def sh_define_files out_line out_line "\texport define_files='#{define_files.keys.join ' '}'" define_files.each do |file, val| + val = Base64.encode64(val) out_line "\tmkdir -p $LKP_SRC/$(dirname #{file})" - out_line "\techo \'#{val}\' > $LKP_SRC/#{file}" + out_line "\techo \"#{val}\" | base64 -d > $LKP_SRC/#{file}" if File::executable?("#{ENV['LKP_SRC']}/#{file}") out_line "\tchmod +x $LKP_SRC/#{file}" end