Skip to contentSkip to conversation

package/systemd: fix build with old toolchains

PATCH Superseded Yann E. MORIN 3 participants 4 messages Aug 30, 2016 – Sep 18, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/systemd: fix build with old toolchains

Toolchains using glibc-2.18 or older do not define O_TMPFILE, which causes build failures on some archs.

systemd has a definition for O_TMPFILE if it is missing, but only defines it for i386 or x86_64. Furthermore, the header defining it is not included everywhere O_TMPFILE is used.

Fix that with three patches backported from upstream:
- include the needed header where it is needed (he!),
- define O_TMPFILE for all archs, according to linux-4.8rc3,
- no longer guard against undefined O_TMPFILE in fileio.

Upstream merge commit:

    https://github.com/systemd/systemd/commit/4a13100c6a5a0a4b793e90bd43d21c3696c42d46

---
Changes v1 -> v2:
- backport patches as upstreamed

---
 ...-export-raw-needs-missing.h-for-O_TMPFILE.patch | 30 +++++++++++
 ...h-add-missing-definitions-for-__O_TMPFILE.patch | 62 +++++++++++++++++++++
 ...basic-fileio-we-always-have-O_TMPFILE-now.patch | 63 ++++++++++++++++++++++
 3 files changed, 155 insertions(+)
 create mode 100644 package/systemd/0004-importd-export-raw-needs-missing.h-for-O_TMPFILE.patch
 create mode 100644 package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch
 create mode 100644 package/systemd/0006-basic-fileio-we-always-have-O_TMPFILE-now.patch
package/systemd/0004-importd-export-raw-needs-missing.h-for-O_TMPFILE.patch new file +30 -0
new file mode 100644
index 0000000..0232248
@@ -0,0 +1,30 @@
+From 4a6d35237f96d07f3a783c874933f87bf14f93e0 Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <[email protected]>
+Date: Sun, 28 Aug 2016 16:26:04 +0200
+Subject: [PATCH] importd/export-raw: needs missing.h for O_TMPFILE
+
+O_TMPFILE may be missing from the system headers, so use our fallback
+definition.
+
+---
+Backported from upstream:
+    https://github.com/systemd/systemd/commit/4a6d35237f96d07f3a783c874933f87bf14f93e0
+---
+ src/import/export-raw.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/import/export-raw.c b/src/import/export-raw.c
+index db06e11..6136b67 100644
+--- a/src/import/export-raw.c
++++ b/src/import/export-raw.c
+@@ -34,6 +34,7 @@
+ #include "fd-util.h"
+ #include "fileio.h"
+ #include "import-common.h"
++#include "missing.h"
+ #include "ratelimit.h"
+ #include "string-util.h"
+ #include "util.h"
+-- 
+2.7.4
+
package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch new file +62 -0

62 lines not on this page · raw message

package/systemd/0006-basic-fileio-we-always-have-O_TMPFILE-now.patch new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 package/systemd: fix build with old toolchains

Hi Yann,

Quoted 11 lines · Yann E. MORIN

Toolchains using glibc-2.18 or older do not define O_TMPFILE, which causes build failures on some archs.

systemd has a definition for O_TMPFILE if it is missing, but only defines it for i386 or x86_64. Furthermore, the header defining it is not included everywhere O_TMPFILE is used.

Fix that with three patches backported from upstream:
- include the needed header where it is needed (he!),
- define O_TMPFILE for all archs, according to linux-4.8rc3,
- no longer guard against undefined O_TMPFILE in fileio.

This last patch is not a pure build fix, but more of a feature enhancement. Don't know if it fits in master.

Also, your patches are missing sign-off.

An autobuild reference in the commit log would also be nice.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#2 lore raw

PATCH v2 1/1 package/systemd: fix build with old toolchains

Baruch, All,

On 2016-08-30 12:35 +0300, Baruch Siach spake thusly:

Quoted 10 lines

Hi Yann,

Quoted 7 lines · Yann E. MORIN

Toolchains using glibc-2.18 or older do not define O_TMPFILE, which causes build failures on some archs.

systemd has a definition for O_TMPFILE if it is missing, but only defines it for i386 or x86_64. Furthermore, the header defining it is not included everywhere O_TMPFILE is used.

Quoted 7 lines
Quoted 4 lines

Fix that with three patches backported from upstream:
- include the needed header where it is needed (he!),
- define O_TMPFILE for all archs, according to linux-4.8rc3,
- no longer guard against undefined O_TMPFILE in fileio.

This last patch is not a pure build fix, but more of a feature enhancement. Don't know if it fits in master.

Well, it's indeed not a _pure_ bug fix, but given that O_TMPFILE is now always defined, the guards are no longer needed at all: they will never be guarding anything now.

Besides, using O_TMPFILE is way better than not using it; it makes the thing a little bit more secure.

Quoted 1 line

Also, your patches are missing sign-off.

Damn. Upstream is not using SoB lines (Lennart asked me to remove them
[0] and I fiorgot to re-add them when adding them in Buildroot; the previosu iteration did have my SoB lines).

Quoted 1 line

An autobuild reference in the commit log would also be nice.

Damn, I also forgot that... :-/

Thanks!

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v2 1/1 package/systemd: fix build with old toolchains

In reply to Yann E. MORIN

Hello,

Quoted 20 lines · Yann E. MORIN

Toolchains using glibc-2.18 or older do not define O_TMPFILE, which causes build failures on some archs.

systemd has a definition for O_TMPFILE if it is missing, but only defines it for i386 or x86_64. Furthermore, the header defining it is not included everywhere O_TMPFILE is used.

Fix that with three patches backported from upstream:
- include the needed header where it is needed (he!),
- define O_TMPFILE for all archs, according to linux-4.8rc3,
- no longer guard against undefined O_TMPFILE in fileio.

Upstream merge commit:

    https://github.com/systemd/systemd/commit/4a13100c6a5a0a4b793e90bd43d21c3696c42d46

---
Changes v1 -> v2:
- backport patches as upstreamed

Quoted 8 lines
---
 ...-export-raw-needs-missing.h-for-O_TMPFILE.patch | 30 +++++++++++
 ...h-add-missing-definitions-for-__O_TMPFILE.patch | 62 +++++++++++++++++++++
 ...basic-fileio-we-always-have-O_TMPFILE-now.patch | 63 ++++++++++++++++++++++
 3 files changed, 155 insertions(+)
 create mode 100644 package/systemd/0004-importd-export-raw-needs-missing.h-for-O_TMPFILE.patch
 create mode 100644 package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch
 create mode 100644 package/systemd/0006-basic-fileio-we-always-have-O_TMPFILE-now.patch

I've applied, after adding the autobuild failure reference, and re-adding your SoB lines from the patches (they were here in the previous iteration).

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com