Skip to contentSkip to conversation

lttng-tools: Switch to alternative upstream submitted patch

PATCH New Khem Raj 1 participant 3 messages Jan 19, 2023

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/3 lttng-tools: Switch to alternative upstream submitted patch

---
 ...pat-Define-off64_t-as-off_t-on-linux.patch | 75 ++++++++++++++-----
 1 file changed, 56 insertions(+), 19 deletions(-)
meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch +56 -19
index e3d421f730..ef81703bc3 100644
@@ -1,35 +1,72 @@
-From cc3e1abaa1e7ad85c6a299fe30a36e0cb732e1c8 Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Thu, 15 Dec 2022 14:51:20 -0800
-Subject: [PATCH] compat: Define off64_t as off_t on linux
+From 74b3844737b03492756b4f896c938b504b069f14 Mon Sep 17 00:00:00 2001
+From: Jérémie Galarneau <[email protected]>
+Date: Tue, 17 Jan 2023 16:57:35 -0500
+Subject: [PATCH] compat: off64_t is not defined by musl
 
-This helps compile with latest musl, where off64_t is not defined
-unless _LARGEFILE64_SOURCE is defined, on glibc _LARGEFILE64_SOURCE is
-defined if _GNU_SOURCE is defined, so the problem is only seen with musl
+This helps compile with latest musl, where off64_t is not defined unless
+_LARGEFILE64_SOURCE is defined. On glibc, _LARGEFILE64_SOURCE is defined
+if _GNU_SOURCE is defined, so the problem is only seen with musl.
 
-Upstream-Status: Submitted [https://github.com/lttng/lttng-tools/pull/164]
-Signed-off-by: Khem Raj <[email protected]>
+Since the project uses AC_SYS_LARGEFILE, which from the autoconf doc:
+"arrange for 64-bit file offsets, known as large-file support."
+
+As such, it is safe to assume off_t is 64-bit wide. This is checked by a
+static_assert to catch any platform where autoconf would let a 32-bit
+off_t slip.
+
+Upstream-Status: Submitted [https://review.lttng.org/c/lttng-tools/+/9268]
+Reported-by: Khem Raj <[email protected]>
+Signed-off-by: Jérémie Galarneau <[email protected]>
+Change-Id: If2c6007a8c85bc3f3065002af8a7538b882fb4a8
 ---
- src/common/compat/fcntl.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/src/common/compat/fcntl.h b/src/common/compat/fcntl.h
-index 5e566e50..d19a6ece 100644
+--- a/src/common/compat/compat-fcntl.c
++++ b/src/common/compat/compat-fcntl.c
+@@ -13,7 +13,7 @@
+ #ifdef __linux__
+ 
+ LTTNG_HIDDEN
+-int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
++int compat_sync_file_range(int fd, off_t offset, off_t nbytes,
+ 		unsigned int flags)
+ {
+ #ifdef HAVE_SYNC_FILE_RANGE
 --- a/src/common/compat/fcntl.h
 +++ b/src/common/compat/fcntl.h
-@@ -7,7 +7,6 @@
- 
+@@ -8,21 +8,21 @@
  #ifndef _COMPAT_FCNTL_H
  #define _COMPAT_FCNTL_H
--
+ 
++#include <assert.h>
  #include <fcntl.h>
  #include <sys/types.h>
  
-@@ -22,6 +21,7 @@ typedef off64_t loff_t;
+ #include <common/compat/errno.h>
+ 
+-#if (defined(__CYGWIN__))
+-typedef long long off64_t;
+-#endif
++static_assert(sizeof(off_t) == sizeof(int64_t),
++	      "Build system is misconfigured, off_t must be 64-bit wide");
+ 
+ #if (defined(__FreeBSD__) || defined(__sun__))
+ typedef off64_t loff_t;
  #endif
  
  #ifdef __linux__
-+typedef off_t off64_t;
- extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
+-extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
++extern int compat_sync_file_range(int fd, off_t offset, off_t nbytes,
  		unsigned int flags);
  #define lttng_sync_file_range(fd, offset, nbytes, flags) \
+ 	compat_sync_file_range(fd, offset, nbytes, flags)
+@@ -37,8 +37,8 @@ extern int compat_sync_file_range(int fd
+ #define SYNC_FILE_RANGE_WAIT_BEFORE   0
+ #define SYNC_FILE_RANGE_WRITE         0
+ 
+-static inline int lttng_sync_file_range(int fd, off64_t offset,
+-		off64_t nbytes, unsigned int flags)
++static inline int lttng_sync_file_range(int fd, off_t offset,
++		off_t nbytes, unsigned int flags)
+ {
+ 	return -ENOSYS;
+ }
Signature · 1 line
2.39.1
author
#1 lore raw

PATCH 2/3 libtirpc: Check if file exists before operating on it

In some cases (e.g. mingw) this file may not be installed

---
 meta/recipes-extended/libtirpc/libtirpc_1.3.3.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-extended/libtirpc/libtirpc_1.3.3.bb +1 -1
index 8c6c20733c..f55e0b0ed1 100644
@@ -22,7 +22,7 @@ inherit autotools pkgconfig
 EXTRA_OECONF = "--disable-gssapi"
 
 do_install:append() {
-	chown root:root ${D}${sysconfdir}/netconfig
+	test -e ${D}${sysconfdir}/netconfig && chown root:root ${D}${sysconfdir}/netconfig
 }
 
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.39.1
author
#2 lore raw

PATCH 3/3 ruby: Use C11 _Alignof to define ALIGN_OF when possible

In reply to Khem Raj
---
 ...Alignof-to-define-ALIGN_OF-when-poss.patch | 52 +++++++++++++++++++
 meta/recipes-devtools/ruby/ruby_3.2.0.bb      |  1 +
 2 files changed, 53 insertions(+)
 create mode 100644 meta/recipes-devtools/ruby/ruby/0001-fiddle-Use-C11-_Alignof-to-define-ALIGN_OF-when-poss.patch
meta/recipes-devtools/ruby/ruby/0001-fiddle-Use-C11-_Alignof-to-define-ALIGN_OF-when-poss.patch new file +52 -0
new file mode 100644
index 0000000000..30caf2c2de
@@ -0,0 +1,52 @@
+From 6b3c202b46b9312c5bb0789145f13d8086e70948 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sun, 15 Jan 2023 02:34:17 -0800
+Subject: [PATCH] fiddle: Use C11 _Alignof to define ALIGN_OF when possible
+
+WG14 N2350 made very clear that it is an UB having type definitions
+within "offsetof" [1]. This patch enhances the implementation of macro
+ALIGN_OF to use builtin "_Alignof" to avoid undefined behavior
+when using std=c11 or newer
+
+clang 16+ has started to flag this [2]
+
+Fixes build when using -std >= gnu11 and using clang16+
+
+Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it
+may support C11, exclude those compiler versions
+
+[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
+[2] https://reviews.llvm.org/D133574
+
+Upstream-Status: Submitted [https://ml.ruby-lang.org/mailman3/hyperkitty/list/[email protected]/thread/DLES4EPPXSPCHQMWJPPWMWXXS42AVPFA/]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ ext/fiddle/fiddle.h | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/ext/fiddle/fiddle.h b/ext/fiddle/fiddle.h
+index 10eb9ce..ffb395e 100644
+--- a/ext/fiddle/fiddle.h
++++ b/ext/fiddle/fiddle.h
+@@ -196,7 +196,17 @@
+ #endif
+ #define TYPE_UINTPTR_T (-TYPE_INTPTR_T)
+ 
+-#define ALIGN_OF(type) offsetof(struct {char align_c; type align_x;}, align_x)
++/* GCC releases before GCC 4.9 had a bug in _Alignof.  See GCC bug 52023
++   <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.
++   clang versions < 8.0.0 have the same bug.  */
++#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
++     || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
++         && !defined __clang__) \
++     || (defined __clang__ && __clang_major__ < 8))
++# define ALIGN_OF(type) offsetof(struct {char align_c; type align_x;}, align_x)
++#else
++# define ALIGN_OF(type) _Alignof(type)
++#endif
+ 
+ #define ALIGN_VOIDP  ALIGN_OF(void*)
+ #define ALIGN_CHAR   ALIGN_OF(char)
+-- 
+2.39.0
+
meta/recipes-devtools/ruby/ruby_3.2.0.bb +1 -0
index 1981a7524c..0e1336f5b0 100644
@@ -30,6 +30,7 @@ SRC_URI = "http://cache.ruby-lang.org/pub/ruby/${SHRT_VER}/ruby-${PV}.tar.gz \
            file://0005-Mark-Gemspec-reproducible-change-fixing-784225-too.patch \
            file://0006-Make-gemspecs-reproducible.patch \
            file://0001-vm_dump.c-Define-REG_S1-and-REG_S2-for-musl-riscv.patch \
+           file://0001-fiddle-Use-C11-_Alignof-to-define-ALIGN_OF-when-poss.patch \
            "
 UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/"
 
Signature · 1 line
2.39.1