From e848ce768e34e547b3db449557485e101c0c0b50 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Sun, 15 Jan 2017 10:52:14 -0800 Subject: [PATCH] Fix `copy_host_file` for files containing quotes (I hope) `man printf` says \" is treated as a quote, but not \'. So let's have the command use double quotes to wrap the format, and escape any double quotes in the text. Hope this works. --- lib/fedorabase.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/fedorabase.pm b/lib/fedorabase.pm index acbee6d0..0382901f 100644 --- a/lib/fedorabase.pm +++ b/lib/fedorabase.pm @@ -88,7 +88,9 @@ sub clone_host_file { while (<$fh>) { $text .= $_; } - assert_script_run "printf '$text' > $file"; + # escape any ' characters in the text... + $text =~ s/"/\\"/g; + assert_script_run "printf \"$text\" > $file"; # for debugging... assert_script_run "cat $file"; }