"Carlos O'Donell" <carlos(a)redhat.com> writes:
diff --git a/glibc-post_upgrade.patch b/glibc-post_upgrade.patch
deleted file mode 100644
This deletes one of the .c files and it's Makefile rules, ok.
diff --git a/glibc_post_upgrade.c b/glibc_post_upgrade.c
deleted file mode 100644
This deletes the other. Ok.
-Patch1: glibc-post_upgrade.patch
Ok.
-# We need to run ldconfig manually because ldconfig cannot handle
the
-# relative include path in the /etc/ld.so.conf file we gneerate.
+# We need to run ldconfig manually because __brp_ldconfig assumes that
+# glibc itself is always installed in $RPM_BUILD_ROOT, but with sysroots
+# we may be installed into a subdirectory of that path. Therefore we
+# unset __brp_ldconfig and run ldconfig by hand with the sysroots path
+# passed to -r.
Ok.
-# Install the upgrade program
-install -m 700 build-%{target}/elf/glibc_post_upgrade \
- %{glibc_sysroot}%{_prefix}/sbin/glibc_post_upgrade.%{_target_cpu}
-
Ok.
-# which is to at least keep the timestamp consistent. The choice of
using
-# glibc_post_upgrade.c is arbitrary.
+# which is to at least keep the timestamp consistent. The choice of using
+# %{SOURCE0} is arbitrary.
touch -r %{SOURCE0} %{glibc_sysroot}/etc/ld.so.conf
touch -r sunrpc/etc.rpc %{glibc_sysroot}/etc/rpc
Source0 was the .tar.gz file anyway, so this just corrects the comment.
OK, caveat Florian's comment about lint.
-# - The use of [^gi] is meant to exclude all files except
glibc_post_upgrade,
-# and iconvconfig, which we want in the main packages.
+# - We want iconvconfig in the main package.
- -e '%{_prefix}/sbin/[^gi]' \
+ -e '%{_prefix}/sbin/iconvconfig' \
These two are EXCLUDING files from glibc.filelist. The comment and code
are both consistent in that we go from "glibc_post_upgrade and
iconfconfig" to just "iconvconfig". Ok.
# All of the bin and certain sbin files go into the common package
except
-# glibc_post_upgrade.* and iconvconfig which need to go in glibc. Likewise
-# nscd is excluded because it goes in nscd.
+# iconvconfig which needs to go in glibc. Likewise nscd is excluded because
+# it goes in nscd.
Likewise.
grep '%{_prefix}/bin' master.filelist >>
common.filelist
-grep '%{_prefix}/sbin/[^gi]' master.filelist \
+grep '%{_prefix}/sbin/iconvconfig' master.filelist \
| grep -v 'nscd' >> common.filelist
The old source EXCLUDES iconvconfig, the new source REQUIRES it. Use
[^i] instead.
-
Er, OK. Or spurious whitespace changes. Your choice :-)
-%post -p %{_prefix}/sbin/glibc_post_upgrade.%{_target_cpu}
+%post -p <lua>
+-- (1) Remove multilib libraries from previous installs.
+-- In order to support in-place upgrades, we must immediately remove
+-- obsolete platform directories after installing a new glibc
+-- version. RPM only deletes files removed by updates near the end
+-- of the transaction. If we did not remove the obsolete platform
+-- directories here, they would be preferred by the dynamic linker
"may be"
+-- during the execution of subsequent RPM scriptlets, likely
+-- resulting in process startup failures. */
Ok.
+-- We are going to remove these libraries. Generally speaking we
remove
+-- all core libraries in the multilib directory.
+local remove_prefixes = { "libc-",
+ "libm-",
+ "librt-",
+ "libpthread-",
+ "librtkaio-",
+ "libthread_db-" }
+
+-- We are going to search these directories.
+local remove_dirs = { "/lib/i686",
+ "/lib/i686/nosegneg",
+ "/lib64/power6",
+ "/lib64/power7",
+ "/lib64/power8" }
+
+-- Walk all the directories with files we need to remove...
+for _, rdir in ipairs (remove_dirs) do
+ if posix.access (rdir) then
We're not accounting for $prefix but the original didn't either. So
this is a "if exists" check. Ok.
+ -- If the directory exists we look at all the files...
+ local remove_files = posix.files (rdir)
+ for rfile in remove_files do
+ for _, rprefix in ipairs (remove_prefixes) do
+ -- Does the literal prefix match?
+ local prefix = string.find (rfile, rprefix, 1, true)
+ -- Does it end with '*.so'?
+ local dso = string.match (rfile, "%.so$")
+ if (prefix == 1 and (dso ~= nil)) then
Ok.
+ -- Removing file...
+ os.remove (rdir .. '/' .. rfile)
+ end
+ end
+ end
+ end
+end
Ok.
+-- (2) Update /etc/ld.so.conf
+-- Next we update /etc/ld.so.conf to ensure that it starts with
+-- a literal "include ld.so.conf.d/*.conf".
+
+local ldsoconf = "/etc/ld.so.conf"
+local ldsoconf_tmp = "/etc/glibc_post_upgrade.ld.so.conf"
+
+local conf_fd = io.open (ldsoconf, "r")
+
+if conf_fd ~= nil then
+
+ -- We must have a "include ld.so.conf.d/*.conf" line.
+ local have_include = false
+ for line in conf_fd:lines () do
+ -- This must match, and we don't ignore whitespace.
+ if string.match (line, "^include ld.so.conf.d/%*%.conf$") ~= nil then
+ have_include = true
+ end
+ end
+ conf_fd:close ()
Ok.
+
+ if not have_include then
+ -- Insert "include ld.so.conf.d/*.conf" line at the start of the
+ -- file. We only support one of these post upgrades running at
+ -- a time (temporary file name is fixed).
+ local tmp_fd = io.open (ldsoconf_tmp, "w")
+ if tmp_fd ~= nil then
+ tmp_fd:write ("include ld.so.conf.d/*.conf\n")
+ for line in io.lines (ldsoconf) do
+ tmp_fd:write (line .. "\n")
+ end
+ tmp_fd:close ()
Ok.
+ local res = os.rename (ldsoconf_tmp, ldsoconf)
+ if res == nil then
+ io.stdout:write ("Error: Unable to update configuration file
(rename).\n")
+ end
+ else
+ io.stdout:write ("Error: Unable to update configuration file
(open).\n")
+ end
+ end
+end
+
Ok.
+-- (3) Rebuild ld.so.cache early.
+-- If the format of the cache changes then we need to rebuild
+-- the cache early to avoid any problems running binaries with
+-- the new glibc.
+
+if posix.access ("%{_prefix}/sbin/ldconfig", "x") then
Inconsistent use of ${prefix} ? The old script used /sbin/ldconfig, and
we're checking /etc not ${prefix}/etc, etc. If this is intentional,
needs explaining in the comment.
+ local pid = posix.fork ()
+ if pid == 0 then
+ posix.exec ("%{_prefix}/sbin/ldconfig")
+ elseif pid > 0 then
+ posix.wait (pid)
+ end
No error handling.
+-- (4) Update gconv modules cache.
+-- If the /usr/lib/gconv/gconv-modules.cache exists, then update it
+-- with the latest set of modules that were just installed.
+-- We assume that the cache is in %{_libdir}/gconv and called
+-- "gconv-modules.cache".
+
+local iconv_dir = "%{_libdir}/gconv"
+local iconv_cache = iconv_dir .. "/gconv-modules.cache"
Ok.
+if posix.utime (iconv_cache) == 0 then
+ local pid = posix.fork ()
+ if pid == 0 then
+ posix.exec ("%{_prefix}/sbin/iconvconfig",
+ "-o", iconv_cache,
+ "--nostdlib",
+ iconv_dir)
+ elseif pid > 0 then
+ posix.wait (pid)
+ end
Again, no error handling.
+else
+ io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n")
+end
Ok.
+* Thu May 16 2019 Carlos O'Donell <carlos(a)redhat.com> -
2.29.9000-20
Remember to tweak the timestamp as you go ;-)