]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
patchelf: replace a rejected patch with an equivalent uninative.bbclass tweak
authorAlexander Kanavin <alex.kanavin@gmail.com>
Thu, 11 Aug 2022 19:58:05 +0000 (21:58 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 14 Aug 2022 07:11:14 +0000 (08:11 +0100)
This was the original reason to add the patch:
https://git.openembedded.org/openembedded-core/commit/?id=18efcbcb896239c64fedd009ce57f3f0c668cbc0

and this is the upstream discussion which suggests handling
read-only files explicitly outside of patchelf:
https://github.com/NixOS/patchelf/pull/89

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-global/uninative.bbclass
meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch [deleted file]
meta/recipes-devtools/patchelf/patchelf_0.15.0.bb

index 4b7fb3644980ea4781604f961c4e36ea43adec30..42c5f8fdf2e6d13ac202bc6046f9d86bbbea88db 100644 (file)
@@ -173,5 +173,7 @@ python uninative_changeinterp () {
             if not elf.isDynamic():
                 continue
 
+            os.chmod(f, s[stat.ST_MODE] | stat.S_IWUSR)
             subprocess.check_output(("patchelf-uninative", "--set-interpreter", d.getVar("UNINATIVE_LOADER"), f), stderr=subprocess.STDOUT)
+            os.chmod(f, s[stat.ST_MODE])
 }
diff --git a/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch b/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch
deleted file mode 100644 (file)
index 76ad8d9..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-From 38b3d65f4a79d39ad9cdf841f2b3b29fd0c961ca Mon Sep 17 00:00:00 2001
-From: Fabio Berton <fabio.berton@ossystems.com.br>
-Date: Fri, 9 Sep 2016 16:00:42 -0300
-Subject: [PATCH] handle read-only files
-
-Patch from:
-https://github.com/darealshinji/patchelf/commit/40e66392bc4b96e9b4eda496827d26348a503509
-
-Upstream-Status: Denied [https://github.com/NixOS/patchelf/pull/89]
-
-Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
----
- src/patchelf.cc | 18 +++++++++++++-----
- 1 file changed, 13 insertions(+), 5 deletions(-)
-
-diff --git a/src/patchelf.cc b/src/patchelf.cc
-index 49accae..fb6c7ed 100644
---- a/src/patchelf.cc
-+++ b/src/patchelf.cc
-@@ -378,8 +378,16 @@ void ElfFile<ElfFileParamNames>::sortShdrs()
- static void writeFile(const std::string & fileName, const FileContents & contents)
- {
-+    struct stat st;
-+
-     debug("writing %s\n", fileName.c_str());
-+    if (stat(fileName.c_str(), &st) != 0)
-+        error("stat");
-+
-+    if (chmod(fileName.c_str(), 0600) != 0)
-+        error("chmod");
-+
-     int fd = open(fileName.c_str(), O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0777);
-     if (fd == -1)
-         error("open");
-@@ -395,8 +403,6 @@ static void writeFile(const std::string & fileName, const FileContents & content
-         bytesWritten += portion;
-     }
--    if (close(fd) >= 0)
--        return;
-     /*
-      * Just ignore EINTR; a retry loop is the wrong thing to do.
-      *
-@@ -405,9 +411,11 @@ static void writeFile(const std::string & fileName, const FileContents & content
-      * http://utcc.utoronto.ca/~cks/space/blog/unix/CloseEINTR
-      * https://sites.google.com/site/michaelsafyan/software-engineering/checkforeintrwheninvokingclosethinkagain
-      */
--    if (errno == EINTR)
--        return;
--    error("close");
-+    if ((close(fd) < 0) && errno != EINTR)
-+        error("close");
-+
-+    if (chmod(fileName.c_str(), st.st_mode) != 0)
-+        error("chmod");
- }
--- 
-2.30.2
-
index 389a0a9f4059c58b2a3fd49b5517528325f637f6..e07775f57409ce6e9497fde629155b1f4623d9f0 100644 (file)
@@ -5,7 +5,6 @@ HOMEPAGE = "https://github.com/NixOS/patchelf"
 LICENSE = "GPL-3.0-only"
 
 SRC_URI = "git://github.com/NixOS/patchelf;protocol=https;branch=master \
-           file://handle-read-only-files.patch \
            "
 SRCREV = "49008002562355b0e35075cbc1c42c645ff04e28"