|
|
256ebe |
From a577dd0a3cbf435681f10d095a0dca0595c6a354 Mon Sep 17 00:00:00 2001
|
|
|
256ebe |
From: Milind Changire <mchangir@redhat.com>
|
|
|
256ebe |
Date: Sat, 9 Feb 2019 14:01:28 +0530
|
|
|
256ebe |
Subject: [PATCH 38/52] spec: avoid creation of temp file in lua script
|
|
|
256ebe |
|
|
|
256ebe |
Avoiding creation of temporary file to execute bash shell script from a
|
|
|
256ebe |
lua scriptlet increases install time security.
|
|
|
256ebe |
|
|
|
256ebe |
Label: DOWNSTREAM ONLY
|
|
|
256ebe |
|
|
|
256ebe |
Change-Id: Ie5b9035f292402b18dea768aca8bc82a1e7fa615
|
|
|
256ebe |
Signed-off-by: Milind Changire <mchangir@redhat.com>
|
|
|
256ebe |
Reviewed-on: https://code.engineering.redhat.com/gerrit/162621
|
|
|
256ebe |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
256ebe |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
256ebe |
---
|
|
|
256ebe |
glusterfs.spec.in | 120 ++++++------------------------------------------------
|
|
|
256ebe |
1 file changed, 12 insertions(+), 108 deletions(-)
|
|
|
256ebe |
|
|
|
256ebe |
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
|
|
|
256ebe |
index 9db5a34..df8d116 100644
|
|
|
256ebe |
--- a/glusterfs.spec.in
|
|
|
256ebe |
+++ b/glusterfs.spec.in
|
|
|
256ebe |
@@ -1542,15 +1542,7 @@ if [ $? -eq 0 ]; then
|
|
|
256ebe |
fi
|
|
|
256ebe |
]]
|
|
|
256ebe |
|
|
|
256ebe |
--- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
256ebe |
--- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
256ebe |
--- platforms which are server platforms.
|
|
|
256ebe |
-tmpname = os.tmpname()
|
|
|
256ebe |
-tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
-tmpfile:write(script)
|
|
|
256ebe |
-tmpfile:close()
|
|
|
256ebe |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
-os.remove(tmpname)
|
|
|
256ebe |
+ok, how, val = os.execute(script)
|
|
|
256ebe |
if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
@@ -1584,15 +1576,7 @@ if [ $? -eq 0 ]; then
|
|
|
256ebe |
fi
|
|
|
256ebe |
]]
|
|
|
256ebe |
|
|
|
256ebe |
--- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
256ebe |
--- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
256ebe |
--- platforms which are server platforms.
|
|
|
256ebe |
-tmpname = os.tmpname()
|
|
|
256ebe |
-tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
-tmpfile:write(script)
|
|
|
256ebe |
-tmpfile:close()
|
|
|
256ebe |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
-os.remove(tmpname)
|
|
|
256ebe |
+ok, how, val = os.execute(script)
|
|
|
256ebe |
if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
@@ -1626,15 +1610,7 @@ if [ $? -eq 0 ]; then
|
|
|
256ebe |
fi
|
|
|
256ebe |
]]
|
|
|
256ebe |
|
|
|
256ebe |
--- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
256ebe |
--- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
256ebe |
--- platforms which are server platforms.
|
|
|
256ebe |
-tmpname = os.tmpname()
|
|
|
256ebe |
-tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
-tmpfile:write(script)
|
|
|
256ebe |
-tmpfile:close()
|
|
|
256ebe |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
-os.remove(tmpname)
|
|
|
256ebe |
+ok, how, val = os.execute(script)
|
|
|
256ebe |
if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
@@ -1668,15 +1644,7 @@ if [ $? -eq 0 ]; then
|
|
|
256ebe |
fi
|
|
|
256ebe |
]]
|
|
|
256ebe |
|
|
|
256ebe |
--- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
256ebe |
--- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
256ebe |
--- platforms which are server platforms.
|
|
|
256ebe |
-tmpname = os.tmpname()
|
|
|
256ebe |
-tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
-tmpfile:write(script)
|
|
|
256ebe |
-tmpfile:close()
|
|
|
256ebe |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
-os.remove(tmpname)
|
|
|
256ebe |
+ok, how, val = os.execute(script)
|
|
|
256ebe |
if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
@@ -1709,15 +1677,7 @@ if [ $? -eq 0 ]; then
|
|
|
256ebe |
fi
|
|
|
256ebe |
]]
|
|
|
256ebe |
|
|
|
256ebe |
--- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
256ebe |
--- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
256ebe |
--- platforms which are server platforms.
|
|
|
256ebe |
-tmpname = os.tmpname()
|
|
|
256ebe |
-tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
-tmpfile:write(script)
|
|
|
256ebe |
-tmpfile:close()
|
|
|
256ebe |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
-os.remove(tmpname)
|
|
|
256ebe |
+ok, how, val = os.execute(script)
|
|
|
256ebe |
if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
@@ -1750,15 +1710,7 @@ if [ $? -eq 0 ]; then
|
|
|
256ebe |
fi
|
|
|
256ebe |
]]
|
|
|
256ebe |
|
|
|
256ebe |
--- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
256ebe |
--- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
256ebe |
--- platforms which are server platforms.
|
|
|
256ebe |
-tmpname = os.tmpname()
|
|
|
256ebe |
-tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
-tmpfile:write(script)
|
|
|
256ebe |
-tmpfile:close()
|
|
|
256ebe |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
-os.remove(tmpname)
|
|
|
256ebe |
+ok, how, val = os.execute(script)
|
|
|
256ebe |
if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
@@ -1792,15 +1744,7 @@ if [ $? -eq 0 ]; then
|
|
|
256ebe |
fi
|
|
|
256ebe |
]]
|
|
|
256ebe |
|
|
|
256ebe |
--- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
256ebe |
--- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
256ebe |
--- platforms which are server platforms.
|
|
|
256ebe |
-tmpname = os.tmpname()
|
|
|
256ebe |
-tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
-tmpfile:write(script)
|
|
|
256ebe |
-tmpfile:close()
|
|
|
256ebe |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
-os.remove(tmpname)
|
|
|
256ebe |
+ok, how, val = os.execute(script)
|
|
|
256ebe |
if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
@@ -1835,15 +1779,7 @@ if [ $? -eq 0 ]; then
|
|
|
256ebe |
fi
|
|
|
256ebe |
]]
|
|
|
256ebe |
|
|
|
256ebe |
--- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
256ebe |
--- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
256ebe |
--- platforms which are server platforms.
|
|
|
256ebe |
-tmpname = os.tmpname()
|
|
|
256ebe |
-tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
-tmpfile:write(script)
|
|
|
256ebe |
-tmpfile:close()
|
|
|
256ebe |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
-os.remove(tmpname)
|
|
|
256ebe |
+ok, how, val = os.execute(script)
|
|
|
256ebe |
if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
@@ -1878,15 +1814,7 @@ if [ $? -eq 0 ]; then
|
|
|
256ebe |
fi
|
|
|
256ebe |
]]
|
|
|
256ebe |
|
|
|
256ebe |
--- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
256ebe |
--- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
256ebe |
--- platforms which are server platforms.
|
|
|
256ebe |
-tmpname = os.tmpname()
|
|
|
256ebe |
-tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
-tmpfile:write(script)
|
|
|
256ebe |
-tmpfile:close()
|
|
|
256ebe |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
-os.remove(tmpname)
|
|
|
256ebe |
+ok, how, val = os.execute(script)
|
|
|
256ebe |
if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
@@ -1921,15 +1849,7 @@ if [ $? -eq 0 ]; then
|
|
|
256ebe |
fi
|
|
|
256ebe |
]]
|
|
|
256ebe |
|
|
|
256ebe |
--- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
256ebe |
--- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
256ebe |
--- platforms which are server platforms.
|
|
|
256ebe |
-tmpname = os.tmpname()
|
|
|
256ebe |
-tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
-tmpfile:write(script)
|
|
|
256ebe |
-tmpfile:close()
|
|
|
256ebe |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
-os.remove(tmpname)
|
|
|
256ebe |
+ok, how, val = os.execute(script)
|
|
|
256ebe |
if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
@@ -1965,15 +1885,7 @@ if [ $? -eq 0 ]; then
|
|
|
256ebe |
fi
|
|
|
256ebe |
]]
|
|
|
256ebe |
|
|
|
256ebe |
--- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
256ebe |
--- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
256ebe |
--- platforms which are server platforms.
|
|
|
256ebe |
-tmpname = os.tmpname()
|
|
|
256ebe |
-tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
-tmpfile:write(script)
|
|
|
256ebe |
-tmpfile:close()
|
|
|
256ebe |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
-os.remove(tmpname)
|
|
|
256ebe |
+ok, how, val = os.execute(script)
|
|
|
256ebe |
if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
@@ -2008,15 +1920,7 @@ if [ $? -eq 0 ]; then
|
|
|
256ebe |
fi
|
|
|
256ebe |
]]
|
|
|
256ebe |
|
|
|
256ebe |
--- Since we run pretrans scripts only for RPMs built for a server build,
|
|
|
256ebe |
--- we can now use os.tmpname() since it is available on RHEL6 and later
|
|
|
256ebe |
--- platforms which are server platforms.
|
|
|
256ebe |
-tmpname = os.tmpname()
|
|
|
256ebe |
-tmpfile = io.open(tmpname, "w")
|
|
|
256ebe |
-tmpfile:write(script)
|
|
|
256ebe |
-tmpfile:close()
|
|
|
256ebe |
-ok, how, val = os.execute("/bin/bash " .. tmpname)
|
|
|
256ebe |
-os.remove(tmpname)
|
|
|
256ebe |
+ok, how, val = os.execute(script)
|
|
|
256ebe |
if not (ok == 0) then
|
|
|
256ebe |
error("Detected running glusterfs processes", ok)
|
|
|
256ebe |
end
|
|
|
256ebe |
--
|
|
|
256ebe |
1.8.3.1
|
|
|
256ebe |
|