summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/patchelf
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2022-08-11 21:58:05 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-14 08:13:32 +0100
commitfd65379613ad0ee7b1077ba95399884727095a75 (patch)
treec4b763378e43b3b082cd409756d26f4967fbea4a /meta/recipes-devtools/patchelf
parent51aa1c66ddedf3a6b915a464fe3f70924fd5a480 (diff)
downloadpoky-fd65379613ad0ee7b1077ba95399884727095a75.tar.gz
patchelf: replace a rejected patch with an equivalent uninative.bbclass tweak
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 (From OE-Core rev: 728775c87a7e35a03408675ce1c7a8cd061b2fda) 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>
Diffstat (limited to 'meta/recipes-devtools/patchelf')
-rw-r--r--meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch63
-rw-r--r--meta/recipes-devtools/patchelf/patchelf_0.15.0.bb1
2 files changed, 0 insertions, 64 deletions
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
index 76ad8d9d4d..0000000000
--- a/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch
+++ /dev/null
@@ -1,63 +0,0 @@
1From 38b3d65f4a79d39ad9cdf841f2b3b29fd0c961ca Mon Sep 17 00:00:00 2001
2From: Fabio Berton <fabio.berton@ossystems.com.br>
3Date: Fri, 9 Sep 2016 16:00:42 -0300
4Subject: [PATCH] handle read-only files
5
6Patch from:
7https://github.com/darealshinji/patchelf/commit/40e66392bc4b96e9b4eda496827d26348a503509
8
9Upstream-Status: Denied [https://github.com/NixOS/patchelf/pull/89]
10
11Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
12---
13 src/patchelf.cc | 18 +++++++++++++-----
14 1 file changed, 13 insertions(+), 5 deletions(-)
15
16diff --git a/src/patchelf.cc b/src/patchelf.cc
17index 49accae..fb6c7ed 100644
18--- a/src/patchelf.cc
19+++ b/src/patchelf.cc
20@@ -378,8 +378,16 @@ void ElfFile<ElfFileParamNames>::sortShdrs()
21
22 static void writeFile(const std::string & fileName, const FileContents & contents)
23 {
24+ struct stat st;
25+
26 debug("writing %s\n", fileName.c_str());
27
28+ if (stat(fileName.c_str(), &st) != 0)
29+ error("stat");
30+
31+ if (chmod(fileName.c_str(), 0600) != 0)
32+ error("chmod");
33+
34 int fd = open(fileName.c_str(), O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0777);
35 if (fd == -1)
36 error("open");
37@@ -395,8 +403,6 @@ static void writeFile(const std::string & fileName, const FileContents & content
38 bytesWritten += portion;
39 }
40
41- if (close(fd) >= 0)
42- return;
43 /*
44 * Just ignore EINTR; a retry loop is the wrong thing to do.
45 *
46@@ -405,9 +411,11 @@ static void writeFile(const std::string & fileName, const FileContents & content
47 * http://utcc.utoronto.ca/~cks/space/blog/unix/CloseEINTR
48 * https://sites.google.com/site/michaelsafyan/software-engineering/checkforeintrwheninvokingclosethinkagain
49 */
50- if (errno == EINTR)
51- return;
52- error("close");
53+ if ((close(fd) < 0) && errno != EINTR)
54+ error("close");
55+
56+ if (chmod(fileName.c_str(), st.st_mode) != 0)
57+ error("chmod");
58 }
59
60
61--
622.30.2
63
diff --git a/meta/recipes-devtools/patchelf/patchelf_0.15.0.bb b/meta/recipes-devtools/patchelf/patchelf_0.15.0.bb
index 389a0a9f40..e07775f574 100644
--- a/meta/recipes-devtools/patchelf/patchelf_0.15.0.bb
+++ b/meta/recipes-devtools/patchelf/patchelf_0.15.0.bb
@@ -5,7 +5,6 @@ HOMEPAGE = "https://github.com/NixOS/patchelf"
5LICENSE = "GPL-3.0-only" 5LICENSE = "GPL-3.0-only"
6 6
7SRC_URI = "git://github.com/NixOS/patchelf;protocol=https;branch=master \ 7SRC_URI = "git://github.com/NixOS/patchelf;protocol=https;branch=master \
8 file://handle-read-only-files.patch \
9 " 8 "
10SRCREV = "49008002562355b0e35075cbc1c42c645ff04e28" 9SRCREV = "49008002562355b0e35075cbc1c42c645ff04e28"
11 10