Skip to contentSkip to conversation

open-vm-tools: Enable tirpc explicitly, fix build with 64bit time_t

PATCH New Khem Raj 1 participant 3 messages Nov 12, 2019

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/3 open-vm-tools: Enable tirpc explicitly, fix build with 64bit time_t

These patches ensure that 64bit time_t is printed correctly, and on x86 do not limit time_t to be 4byte long

---
 ...FromNtTimeNsec-aware-of-64-bit-time_.patch | 78 +++++++++++++++++++
 ...ux-Consider-64bit-time_t-possibility.patch | 41 ++++++++++
 .../open-vm-tools/open-vm-tools_11.0.1.bb     |  5 +-
 3 files changed, 123 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/open-vm-tools/open-vm-tools/0001-Make-HgfsConvertFromNtTimeNsec-aware-of-64-bit-time_.patch
 create mode 100644 meta-oe/recipes-support/open-vm-tools/open-vm-tools/0002-hgfsServerLinux-Consider-64bit-time_t-possibility.patch
meta-oe/recipes-support/open-vm-tools/open-vm-tools/0001-Make-HgfsConvertFromNtTimeNsec-aware-of-64-bit-time_.patch new file +78 -0
new file mode 100644
index 0000000000..61a681f17f
@@ -0,0 +1,78 @@
+From caf80e220b055dbce259078be96e899dc78ec1d2 Mon Sep 17 00:00:00 2001
+From: Bartosz Brachaczek <[email protected]>
+Date: Tue, 12 Nov 2019 14:31:08 +0100
+Subject: [PATCH] Make HgfsConvertFromNtTimeNsec aware of 64-bit time_t on i386
+
+I verified that this function behaves as expected on x86_64, i386 with
+32-bit time_t, and i386 with 64-bit time_t for the following values of
+ntTtime:
+
+UNIX_EPOCH-1, UNIX_EPOCH, UNIX_EPOCH+1, UNIX_S32_MAX-1, UNIX_S32_MAX,
+UNIX_S32_MAX+1, UNIX_S32_MAX*2+1
+
+I did not verify whether the use of Div643264 is optimal, performance
+wise.
+
+Upstream-Status: Submitted [https://github.com/vmware/open-vm-tools/pull/387]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ open-vm-tools/lib/hgfs/hgfsUtil.c | 34 +++++++++++++++++--------------
+ 1 file changed, 19 insertions(+), 15 deletions(-)
+
+diff --git a/open-vm-tools/lib/hgfs/hgfsUtil.c b/open-vm-tools/lib/hgfs/hgfsUtil.c
+index cc580ab8..49b10040 100644
+--- a/open-vm-tools/lib/hgfs/hgfsUtil.c
++++ b/open-vm-tools/lib/hgfs/hgfsUtil.c
+@@ -110,23 +110,21 @@ HgfsConvertFromNtTimeNsec(struct timespec *unixTime, // OUT: Time in UNIX format
+ 			  uint64 ntTime) // IN: Time in Windows NT format
+ {
+ #ifdef __i386__
+-   uint32 sec;
+-   uint32 nsec;
++   uint64 sec64;
++   uint32 sec32, nsec;
++#endif
+ 
+    ASSERT(unixTime);
+-   /* We assume that time_t is 32bit */
+-   ASSERT_ON_COMPILE(sizeof (unixTime->tv_sec) == 4);
+ 
+-   /* Cap NT time values that are outside of Unix time's range */
++   if (sizeof (unixTime->tv_sec) == 4) {
++      /* Cap NT time values that are outside of Unix time's range */
+ 
+-   if (ntTime >= UNIX_S32_MAX) {
+-      unixTime->tv_sec = 0x7FFFFFFF;
+-      unixTime->tv_nsec = 0;
+-      return 1;
++      if (ntTime >= UNIX_S32_MAX) {
++         unixTime->tv_sec = 0x7FFFFFFF;
++         unixTime->tv_nsec = 0;
++         return 1;
++      }
+    }
+-#else
+-   ASSERT(unixTime);
+-#endif
+ 
+    if (ntTime < UNIX_EPOCH) {
+       unixTime->tv_sec = 0;
+@@ -135,9 +133,15 @@ HgfsConvertFromNtTimeNsec(struct timespec *unixTime, // OUT: Time in UNIX format
+    }
+ 
+ #ifdef __i386__
+-   Div643232(ntTime - UNIX_EPOCH, 10000000, &sec, &nsec);
+-   unixTime->tv_sec = sec;
+-   unixTime->tv_nsec = nsec * 100;
++   if (sizeof (unixTime->tv_sec) == 4) {
++      Div643232(ntTime - UNIX_EPOCH, 10000000, &sec32, &nsec);
++      unixTime->tv_sec = sec32;
++      unixTime->tv_nsec = nsec * 100;
++   } else {
++      Div643264(ntTime - UNIX_EPOCH, 10000000, &sec64, &nsec);
++      unixTime->tv_sec = sec64;
++      unixTime->tv_nsec = nsec * 100;
++   }
+ #else
+    unixTime->tv_sec = (ntTime - UNIX_EPOCH) / 10000000;
+    unixTime->tv_nsec = ((ntTime - UNIX_EPOCH) % 10000000) * 100;
meta-oe/recipes-support/open-vm-tools/open-vm-tools/0002-hgfsServerLinux-Consider-64bit-time_t-possibility.patch new file +41 -0

41 lines not on this page · raw message

meta-oe/recipes-support/open-vm-tools/open-vm-tools_11.0.1.bb +4 -1
index e43a39b613..9e4aa4881a 100644
@@ -39,7 +39,10 @@ SRC_URI = "git://github.com/vmware/open-vm-tools.git;protocol=https \
     file://0012-Use-off64_t-instead-of-__off64_t.patch;patchdir=.. \
     file://0013-misc-Do-not-print-NULL-string-into-logs.patch;patchdir=.. \
     file://0001-GitHub-Issue-367.-Remove-references-to-deprecated-G_.patch;patchdir=.. \
+    file://0001-Make-HgfsConvertFromNtTimeNsec-aware-of-64-bit-time_.patch;patchdir=.. \
+    file://0002-hgfsServerLinux-Consider-64bit-time_t-possibility.patch;patchdir=.. \
 "
+
 SRCREV = "d3edfd142a81096f9f58aff17d84219b457f4987"
 
 S = "${WORKDIR}/git/open-vm-tools"
@@ -56,7 +59,7 @@ SYSTEMD_SERVICE_${PN} = "vmtoolsd.service"
 EXTRA_OECONF = "--without-icu --disable-multimon --disable-docs \
          --disable-tests --without-gtkmm --without-xerces --without-pam \
          --disable-vgauth --disable-deploypkg \
-         --without-root-privileges --without-kernel-modules"
+         --without-root-privileges --without-kernel-modules --with-tirpc"
 
 NO_X11_FLAGS = "--without-x --without-gtk2 --without-gtk3"
 X11_DEPENDS = "libxext libxi libxrender libxrandr libxtst gtk+ gdk-pixbuf"
Signature · 1 line
2.24.0
author
#1 lore raw

PATCH 2/3 tvheadend: Fix build with 64bit time_t

use intmax_t to print time_t, makes it portable across musl/glibc

---
 .../0001-adjust-for-64bit-time_t.patch        | 107 ++++++++++++++++++
 .../recipes-dvb/tvheadend/tvheadend_git.bb    |   4 +-
 2 files changed, 110 insertions(+), 1 deletion(-)
 create mode 100644 meta-multimedia/recipes-dvb/tvheadend/tvheadend/0001-adjust-for-64bit-time_t.patch
meta-multimedia/recipes-dvb/tvheadend/tvheadend/0001-adjust-for-64bit-time_t.patch new file +107 -0
new file mode 100644
index 0000000000..9c7294aefb
@@ -0,0 +1,107 @@
+From 81f29b028473a3d8ac0aaeb126fc0336a98bb077 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 12 Nov 2019 11:03:16 -0800
+Subject: [PATCH] adjust for 64bit time_t
+
+Break assumption about time_t being of certain size, and use intmax_t to
+print it where needed
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/cron.c                    | 4 ++--
+ src/epggrab/module/psip.c     | 2 +-
+ src/epggrab/otamux.c          | 2 +-
+ src/parsers/parser_teletext.c | 2 +-
+ src/tvheadend.h               | 6 +-----
+ src/webui/webui.c             | 4 ++--
+ 6 files changed, 8 insertions(+), 12 deletions(-)
+
+diff --git a/src/cron.c b/src/cron.c
+index b2484070f..4f7f54ba3 100644
+--- a/src/cron.c
++++ b/src/cron.c
+@@ -329,9 +329,9 @@ cron_next ( cron_t *c, const time_t now, time_t *ret )
+     *ret = mktime(&tmp);
+   if (*ret <= now) {
+ #ifndef CRON_TEST
+-    tvherror(LS_CRON, "invalid time, now %"PRItime_t", result %"PRItime_t, now, *ret);
++    tvherror(LS_CRON, "invalid time, now %"PRItime_t", result %"PRItime_t, (intmax_t)now, (intmax_t)*ret);
+ #else
+-    printf("ERROR: invalid time, now %"PRItime_t", result %"PRItime_t"\n", now, *ret);
++    printf("ERROR: invalid time, now %"PRItime_t", result %"PRItime_t"\n", (intmax_t)now, (intmax_t)*ret);
+ #endif
+     *ret = now + 600;
+   }
+diff --git a/src/epggrab/module/psip.c b/src/epggrab/module/psip.c
+index d979ba12c..4f8e41642 100644
+--- a/src/epggrab/module/psip.c
++++ b/src/epggrab/module/psip.c
+@@ -390,7 +390,7 @@ _psip_eit_callback_channel
+ 
+     ebc = epg_broadcast_find_by_time(ch, mod, start, stop, 1, &save2, &changes2);
+     tvhtrace(LS_PSIP, "  eid=%5d, start=%"PRItime_t", stop=%"PRItime_t", ebc=%p",
+-             eventid, start, stop, ebc);
++             eventid, (intmax_t)start, (intmax_t)stop, ebc);
+     if (!ebc) goto next;
+ 
+     save2 |= epg_broadcast_set_dvb_eid(ebc, eventid, &changes2);
+diff --git a/src/epggrab/otamux.c b/src/epggrab/otamux.c
+index 495354390..cdabb0cd7 100644
+--- a/src/epggrab/otamux.c
++++ b/src/epggrab/otamux.c
+@@ -719,7 +719,7 @@ epggrab_ota_start_cb ( void *p );
+ static void
+ epggrab_ota_next_arm( time_t next )
+ {
+-  tvhtrace(LS_EPGGRAB, "next ota start event in %li seconds", next - time(NULL));
++  tvhtrace(LS_EPGGRAB, "next ota start event in %jd seconds", (intmax_t)(next - time(NULL)));
+   gtimer_arm_absn(&epggrab_ota_start_timer, epggrab_ota_start_cb, NULL, next);
+   dbus_emit_signal_s64("/epggrab/ota", "next", next);
+ }
+diff --git a/src/parsers/parser_teletext.c b/src/parsers/parser_teletext.c
+index ff39eb6ac..5a07299c4 100644
+--- a/src/parsers/parser_teletext.c
++++ b/src/parsers/parser_teletext.c
+@@ -625,7 +625,7 @@ tt_construct_unix_time(uint8_t *buf)
+   r[2] = mktime(&tm);
+ 
+   for(i = 0; i < 3; i++)
+-    v[i] = labs(r[i] - t);
++    v[i] = (time_t)llabs((long long)(r[i] - t));
+   
+   if(v[0] < v[1] && v[0] < v[2])
+     return r[0];
+diff --git a/src/tvheadend.h b/src/tvheadend.h
+index 072391d3e..504c42253 100644
+--- a/src/tvheadend.h
++++ b/src/tvheadend.h
+@@ -332,11 +332,7 @@ void tvh_qsort_r(void *base, size_t nmemb, size_t size, int (*compar)(const void
+ # endif /* ULONG_MAX */
+ #endif /* __WORDSIZE */
+ 
+-#if __WORDSIZE == 32 && defined(PLATFORM_FREEBSD)
+-#define PRItime_t       "d"
+-#else
+-#define PRItime_t       "ld"
+-#endif
++#define PRItime_t       "jd"
+ 
+ /* transcoding */
+ #define TVH_NAME_LEN 32
+diff --git a/src/webui/webui.c b/src/webui/webui.c
+index 3e63aeacc..fb429acd3 100644
+--- a/src/webui/webui.c
++++ b/src/webui/webui.c
+@@ -944,9 +944,9 @@ http_dvr_playlist(http_connection_t *hc, int pltype, int urlauth, dvr_entry_t *d
+     strftime(buf, sizeof(buf), "%FT%T%z", localtime_r(&(de->de_start), &tm));
+ 
+     htsbuf_append_str(hq, "#EXTM3U\n");
+-    htsbuf_qprintf(hq, "#EXTINF:%"PRItime_t",%s\n", durration, lang_str_get(de->de_title, NULL));
++    htsbuf_qprintf(hq, "#EXTINF:%"PRItime_t",%s\n", (intmax_t)durration, lang_str_get(de->de_title, NULL));
+     
+-    htsbuf_qprintf(hq, "#EXT-X-TARGETDURATION:%"PRItime_t"\n", durration);
++    htsbuf_qprintf(hq, "#EXT-X-TARGETDURATION:%"PRItime_t"\n", (intmax_t)durration);
+     uuid = idnode_uuid_as_str(&de->de_id, ubuf);
+     htsbuf_qprintf(hq, "#EXT-X-STREAM-INF:PROGRAM-ID=%s,BANDWIDTH=%d\n", uuid, bandwidth);
+     htsbuf_qprintf(hq, "#EXT-X-PROGRAM-DATE-TIME:%s\n", buf);
meta-multimedia/recipes-dvb/tvheadend/tvheadend_git.bb +3 -1
index 5b3c469793..d7f749b647 100644
@@ -8,7 +8,9 @@ DEPENDS = "avahi cmake-native dvb-apps libdvbcsa libpcre2 openssl uriparser zlib
 LICENSE = "GPLv3+"
 LIC_FILES_CHKSUM = "file://LICENSE.md;md5=9cae5acac2e9ee2fc3aec01ac88ce5db"
 
-SRC_URI = "git://github.com/tvheadend/tvheadend.git"
+SRC_URI = "git://github.com/tvheadend/tvheadend.git \
+           file://0001-adjust-for-64bit-time_t.patch \
+           "
 
 SRCREV = "fda89e85e0b6ae796d8a09e178d3937aa7869270"
 PV = "4.3+git${SRCPV}"
Signature · 1 line
2.24.0
author
#2 lore raw

PATCH 3/3 python-systemd: Include endian.h for htobe16

In reply to Khem Raj

Fixes

| systemd/util.c:112:39: error: implicit declaration of function 'htobe16' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
|                 addr->in6.sin6_port = htobe16(port);
|                                       ^
---
 .../recipes-devtools/python/python-systemd.inc     |  2 ++
 .../python/python-systemd/endian.patch             | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python-systemd/endian.patch
meta-python/recipes-devtools/python/python-systemd.inc +2 -0
index 5be5de092a..f01165cf89 100644
@@ -15,4 +15,6 @@ SRC_URI[sha256sum] = "fd0e44bf70eadae45aadc292cb0a7eb5b0b6372cd1b391228047d33895
 # allow for common patches for python- and python3-systemd
 FILESEXTRAPATHS_prepend := "${THISDIR}/python-systemd:"
 
+SRC_URI += "file://endian.patch"
+
 SRC_URI_append_libc-musl = " file://0001-Provide-implementation-of-strndupa-for-musl.patch"
meta-python/recipes-devtools/python/python-systemd/endian.patch new file +14 -0
new file mode 100644
index 0000000000..e09aea7336
@@ -0,0 +1,14 @@
+Include endian.h for missing definitions of htobe16
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+--- a/systemd/util.c
++++ b/systemd/util.c
+@@ -28,6 +28,7 @@
+ #include <stdbool.h>
+ #include <assert.h>
+ #include <errno.h>
++#include <endian.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <net/if.h>
Signature · 1 line
2.24.0