|
|
887953 |
From f807b5dd999808a8e56061690da01420d3cb4cc5 Mon Sep 17 00:00:00 2001
|
|
|
887953 |
From: Milind Changire <mchangir@redhat.com>
|
|
|
887953 |
Date: Sat, 9 Feb 2019 14:01:28 +0530
|
|
|
887953 |
Subject: [PATCH 520/529] spec: avoid creation of temp file in lua script
|
|
|
887953 |
|
|
|
887953 |
Avoiding creation of temporary file to execute bash shell script from a
|
|
|
887953 |
lua scriptlet increases install time security.
|
|
|
887953 |
|
|
|
887953 |
Label: DOWNSTREAM ONLY
|
|
|
887953 |
|
|
|
887953 |
BUG: 1410145
|
|
|
887953 |
Change-Id: Ie5b9035f292402b18dea768aca8bc82a1e7fa615
|
|
|
887953 |
Signed-off-by: Milind Changire <mchangir@redhat.com>
|
|
|
887953 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/162621
|
|
|
887953 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
887953 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
887953 |
---
|
|
|
887953 |
glusterfs.spec.in | 87 ++++++++++---------------------------------------------
|
|
|
887953 |
1 file changed, 15 insertions(+), 72 deletions(-)
|
|
|
887953 |
|
|
|
887953 |
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
|
|
|
887953 |
index 0ad4ffc..2680bec 100644
|
|
|
887953 |
--- a/glusterfs.spec.in
|
|
|
887953 |
+++ b/glusterfs.spec.in
|
|
|
887953 |
@@ -1643,12 +1643,7 @@ fi
|
|
|
887953 |
-- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
887953 |
-- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
887953 |
-- platforms which are server platforms.
|
|
|
887953 |
-tmpname = os.tmpname()
|
|
|
887953 |
-tmpfile = io.open(tmpname, "w")
|
|
|
887953 |
-tmpfile:write(script)
|
|
|
887953 |
-tmpfile:close()
|
|
|
887953 |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
887953 |
-os.remove(tmpname)
|
|
|
887953 |
+ok, how, val = os.execute("/bin/bash -c \"" .. script .. "\"")
|
|
|
887953 |
if not (ok == 0) then
|
|
|
887953 |
error("Detected running glusterfs processes", ok)
|
|
|
887953 |
end
|
|
|
887953 |
@@ -1685,12 +1680,7 @@ fi
|
|
|
887953 |
-- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
887953 |
-- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
887953 |
-- platforms which are server platforms.
|
|
|
887953 |
-tmpname = os.tmpname()
|
|
|
887953 |
-tmpfile = io.open(tmpname, "w")
|
|
|
887953 |
-tmpfile:write(script)
|
|
|
887953 |
-tmpfile:close()
|
|
|
887953 |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
887953 |
-os.remove(tmpname)
|
|
|
887953 |
+ok, how, val = os.execute("/bin/bash -c \"" .. script .. "\"")
|
|
|
887953 |
if not (ok == 0) then
|
|
|
887953 |
error("Detected running glusterfs processes", ok)
|
|
|
887953 |
end
|
|
|
887953 |
@@ -1727,12 +1717,7 @@ fi
|
|
|
887953 |
-- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
887953 |
-- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
887953 |
-- platforms which are server platforms.
|
|
|
887953 |
-tmpname = os.tmpname()
|
|
|
887953 |
-tmpfile = io.open(tmpname, "w")
|
|
|
887953 |
-tmpfile:write(script)
|
|
|
887953 |
-tmpfile:close()
|
|
|
887953 |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
887953 |
-os.remove(tmpname)
|
|
|
887953 |
+ok, how, val = os.execute("/bin/bash -c \"" .. script .. "\"")
|
|
|
887953 |
if not (ok == 0) then
|
|
|
887953 |
error("Detected running glusterfs processes", ok)
|
|
|
887953 |
end
|
|
|
887953 |
@@ -1769,12 +1754,7 @@ fi
|
|
|
887953 |
-- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
887953 |
-- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
887953 |
-- platforms which are server platforms.
|
|
|
887953 |
-tmpname = os.tmpname()
|
|
|
887953 |
-tmpfile = io.open(tmpname, "w")
|
|
|
887953 |
-tmpfile:write(script)
|
|
|
887953 |
-tmpfile:close()
|
|
|
887953 |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
887953 |
-os.remove(tmpname)
|
|
|
887953 |
+ok, how, val = os.execute("/bin/bash -c \"" .. script .. "\"")
|
|
|
887953 |
if not (ok == 0) then
|
|
|
887953 |
error("Detected running glusterfs processes", ok)
|
|
|
887953 |
end
|
|
|
887953 |
@@ -1811,12 +1791,7 @@ fi
|
|
|
887953 |
-- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
887953 |
-- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
887953 |
-- platforms which are server platforms.
|
|
|
887953 |
-tmpname = os.tmpname()
|
|
|
887953 |
-tmpfile = io.open(tmpname, "w")
|
|
|
887953 |
-tmpfile:write(script)
|
|
|
887953 |
-tmpfile:close()
|
|
|
887953 |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
887953 |
-os.remove(tmpname)
|
|
|
887953 |
+ok, how, val = os.execute("/bin/bash -c \"" .. script .. "\"")
|
|
|
887953 |
if not (ok == 0) then
|
|
|
887953 |
error("Detected running glusterfs processes", ok)
|
|
|
887953 |
end
|
|
|
887953 |
@@ -1853,12 +1828,7 @@ fi
|
|
|
887953 |
-- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
887953 |
-- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
887953 |
-- platforms which are server platforms.
|
|
|
887953 |
-tmpname = os.tmpname()
|
|
|
887953 |
-tmpfile = io.open(tmpname, "w")
|
|
|
887953 |
-tmpfile:write(script)
|
|
|
887953 |
-tmpfile:close()
|
|
|
887953 |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
887953 |
-os.remove(tmpname)
|
|
|
887953 |
+ok, how, val = os.execute("/bin/bash -c \"" .. script .. "\"")
|
|
|
887953 |
if not (ok == 0) then
|
|
|
887953 |
error("Detected running glusterfs processes", ok)
|
|
|
887953 |
end
|
|
|
887953 |
@@ -1895,12 +1865,7 @@ fi
|
|
|
887953 |
-- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
887953 |
-- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
887953 |
-- platforms which are server platforms.
|
|
|
887953 |
-tmpname = os.tmpname()
|
|
|
887953 |
-tmpfile = io.open(tmpname, "w")
|
|
|
887953 |
-tmpfile:write(script)
|
|
|
887953 |
-tmpfile:close()
|
|
|
887953 |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
887953 |
-os.remove(tmpname)
|
|
|
887953 |
+ok, how, val = os.execute("/bin/bash -c \"" .. script .. "\"")
|
|
|
887953 |
if not (ok == 0) then
|
|
|
887953 |
error("Detected running glusterfs processes", ok)
|
|
|
887953 |
end
|
|
|
887953 |
@@ -1938,12 +1903,7 @@ fi
|
|
|
887953 |
-- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
887953 |
-- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
887953 |
-- platforms which are server platforms.
|
|
|
887953 |
-tmpname = os.tmpname()
|
|
|
887953 |
-tmpfile = io.open(tmpname, "w")
|
|
|
887953 |
-tmpfile:write(script)
|
|
|
887953 |
-tmpfile:close()
|
|
|
887953 |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
887953 |
-os.remove(tmpname)
|
|
|
887953 |
+ok, how, val = os.execute("/bin/bash -c \"" .. script .. "\"")
|
|
|
887953 |
if not (ok == 0) then
|
|
|
887953 |
error("Detected running glusterfs processes", ok)
|
|
|
887953 |
end
|
|
|
887953 |
@@ -1981,12 +1941,7 @@ fi
|
|
|
887953 |
-- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
887953 |
-- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
887953 |
-- platforms which are server platforms.
|
|
|
887953 |
-tmpname = os.tmpname()
|
|
|
887953 |
-tmpfile = io.open(tmpname, "w")
|
|
|
887953 |
-tmpfile:write(script)
|
|
|
887953 |
-tmpfile:close()
|
|
|
887953 |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
887953 |
-os.remove(tmpname)
|
|
|
887953 |
+ok, how, val = os.execute("/bin/bash -c \"" .. script .. "\"")
|
|
|
887953 |
if not (ok == 0) then
|
|
|
887953 |
error("Detected running glusterfs processes", ok)
|
|
|
887953 |
end
|
|
|
887953 |
@@ -2024,12 +1979,7 @@ fi
|
|
|
887953 |
-- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
887953 |
-- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
887953 |
-- platforms which are server platforms.
|
|
|
887953 |
-tmpname = os.tmpname()
|
|
|
887953 |
-tmpfile = io.open(tmpname, "w")
|
|
|
887953 |
-tmpfile:write(script)
|
|
|
887953 |
-tmpfile:close()
|
|
|
887953 |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
887953 |
-os.remove(tmpname)
|
|
|
887953 |
+ok, how, val = os.execute("/bin/bash -c \"" .. script .. "\"")
|
|
|
887953 |
if not (ok == 0) then
|
|
|
887953 |
error("Detected running glusterfs processes", ok)
|
|
|
887953 |
end
|
|
|
887953 |
@@ -2068,12 +2018,7 @@ fi
|
|
|
887953 |
-- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
887953 |
-- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
887953 |
-- platforms which are server platforms.
|
|
|
887953 |
-tmpname = os.tmpname()
|
|
|
887953 |
-tmpfile = io.open(tmpname, "w")
|
|
|
887953 |
-tmpfile:write(script)
|
|
|
887953 |
-tmpfile:close()
|
|
|
887953 |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
887953 |
-os.remove(tmpname)
|
|
|
887953 |
+ok, how, val = os.execute("/bin/bash -c \"" .. script .. "\"")
|
|
|
887953 |
if not (ok == 0) then
|
|
|
887953 |
error("Detected running glusterfs processes", ok)
|
|
|
887953 |
end
|
|
|
887953 |
@@ -2111,12 +2056,7 @@ fi
|
|
|
887953 |
-- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
887953 |
-- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
887953 |
-- platforms which are server platforms.
|
|
|
887953 |
-tmpname = os.tmpname()
|
|
|
887953 |
-tmpfile = io.open(tmpname, "w")
|
|
|
887953 |
-tmpfile:write(script)
|
|
|
887953 |
-tmpfile:close()
|
|
|
887953 |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
887953 |
-os.remove(tmpname)
|
|
|
887953 |
+ok, how, val = os.execute("/bin/bash -c \"" .. script .. "\"")
|
|
|
887953 |
if not (ok == 0) then
|
|
|
887953 |
error("Detected running glusterfs processes", ok)
|
|
|
887953 |
end
|
|
|
887953 |
@@ -2173,6 +2113,9 @@ fi
|
|
|
887953 |
%endif
|
|
|
887953 |
|
|
|
887953 |
%changelog
|
|
|
887953 |
+* Sat Feb 09 2019 Milind Changire <mchangir@redhat.com>
|
|
|
887953 |
+- Avoid creation of temporary file in lua script during install (#1410145)
|
|
|
887953 |
+
|
|
|
887953 |
* Wed Dec 19 2018 Milind Changire <mchangir@redhat.com>
|
|
|
887953 |
- Add explicit package dependencies (#1656357)
|
|
|
887953 |
- Remove absolute paths from spec file (#1350745)
|
|
|
887953 |
--
|
|
|
887953 |
1.8.3.1
|
|
|
887953 |
|