Skip to content

Commit ab6429e

Browse files
authored
Merge pull request #255 from elfchief/enc_escape_fix
fix ENC 'echo' script template to prevent expansion
2 parents db0ea93 + dc8e691 commit ab6429e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/octocatalog-diff/catalog-util/builddir.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def install_enc(logger)
208208
enc_path = File.join(@tempdir, 'enc.sh')
209209
File.open(enc_path, 'w') do |f|
210210
f.write "#!/bin/sh\n"
211-
f.write "cat <<-EOF\n"
211+
f.write "cat <<-'EOF'\n"
212212
f.write enc_obj.content
213213
f.write "\nEOF\n"
214214
end

spec/octocatalog-diff/tests/catalog-util/builddir_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@
796796
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
797797
enc = File.join(testobj.tempdir, 'enc.sh')
798798
expect(File.file?(enc)).to eq(true)
799-
expect(File.read(enc)).to eq("#!/bin/sh\ncat <<-EOF\n---\n\nEOF\n")
799+
expect(File.read(enc)).to eq("#!/bin/sh\ncat <<-'EOF'\n---\n\nEOF\n")
800800
end
801801
end
802802

@@ -807,7 +807,7 @@
807807
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
808808
enc = File.join(testobj.tempdir, 'enc.sh')
809809
expect(File.file?(enc)).to eq(true)
810-
expect(File.read(enc)).to eq("#!/bin/sh\ncat <<-EOF\n---\n\nEOF\n")
810+
expect(File.read(enc)).to eq("#!/bin/sh\ncat <<-'EOF'\n---\n\nEOF\n")
811811
end
812812
end
813813

@@ -818,7 +818,7 @@
818818
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
819819
enc = File.join(testobj.tempdir, 'enc.sh')
820820
expect(File.file?(enc)).to eq(true)
821-
expect(File.read(enc)).to eq("#!/bin/sh\ncat <<-EOF\n---\n\nEOF\n")
821+
expect(File.read(enc)).to eq("#!/bin/sh\ncat <<-'EOF'\n---\n\nEOF\n")
822822
end
823823
end
824824

@@ -838,7 +838,7 @@
838838
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
839839
enc = File.join(testobj.tempdir, 'enc.sh')
840840
expect(File.file?(enc)).to eq(true)
841-
expect(File.read(enc)).to eq("#!/bin/sh\ncat <<-EOF\n---\nclasses:\n foo: {}\nparameters: {}\n\nEOF\n")
841+
expect(File.read(enc)).to eq("#!/bin/sh\ncat <<-'EOF'\n---\nclasses:\n foo: {}\nparameters: {}\n\nEOF\n")
842842
end
843843
end
844844
end

0 commit comments

Comments
 (0)