From owner-dev-commits-ports-all@freebsd.org Wed May 12 22:25:15 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FF0F64E43B; Wed, 12 May 2021 22:25:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgTrC47j3z3PW8; Wed, 12 May 2021 22:25:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80E401382A; Wed, 12 May 2021 22:25:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CMPF7j061073; Wed, 12 May 2021 22:25:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CMPFqs061072; Wed, 12 May 2021 22:25:15 GMT (envelope-from git) Date: Wed, 12 May 2021 22:25:15 GMT Message-Id: <202105122225.14CMPFqs061072@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org From: Jan Beich Subject: git: 012f31b59f04 - 2021Q2 - sysutils/lttng-tools: fix obtaining HOST_NAME_MAX MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jbeich X-Git-Repository: ports X-Git-Refname: refs/heads/2021Q2 X-Git-Reftype: branch X-Git-Commit: 012f31b59f04fabd0cc48121de8664b17f19fe4f Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 22:25:15 -0000 The branch 2021Q2 has been updated by jbeich: URL: https://cgit.FreeBSD.org/ports/commit/?id=012f31b59f04fabd0cc48121de8664b17f19fe4f commit 012f31b59f04fabd0cc48121de8664b17f19fe4f Author: Adam Wolk AuthorDate: 2021-04-30 15:16:05 +0000 Commit: Jan Beich CommitDate: 2021-05-12 22:23:22 +0000 sysutils/lttng-tools: fix obtaining HOST_NAME_MAX Using sysconf(3) API lead to accidental introduction of variable length arrays (VLA) in the port. Additionally one patch hardcoded 256 as the HOST_NAME_MAX even though the code doesn't expect an additional byte for the terminating NULL byte in the struct definition. Fall back to using _POSIX_HOST_NAME_MAX as the remaining code is not ready for introducing sysconf(3) as a patch. Remove #ifdef FreeBSD from our patches. Bump PORTREVISION to rebuild with the new patch. Sponsored by: Fudo Security Differential Revision: https://reviews.freebsd.org/D30048 (cherry picked from commit aa34b0f42f0b02560ef68a9bd952206c02869e64) --- sysutils/lttng-tools/Makefile | 2 +- .../files/patch-src_bin_lttng-sessiond_consumer.c | 21 ++++++++++++++------- .../files/patch-src_bin_lttng-sessiond_session.h | 11 ++++------- .../patch-src_bin_lttng-sessiond_ust-metadata.c | 22 +++++++++++++++------- .../files/patch-src_bin_lttng_commands_view.c | 19 +++++++++++++------ 5 files changed, 47 insertions(+), 28 deletions(-) diff --git a/sysutils/lttng-tools/Makefile b/sysutils/lttng-tools/Makefile index f49f0c9d2c23..47729e7c2930 100644 --- a/sysutils/lttng-tools/Makefile +++ b/sysutils/lttng-tools/Makefile @@ -2,7 +2,7 @@ PORTNAME= lttng-tools PORTVERSION= 2.9.3 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= sysutils MASTER_SITES= http://lttng.org/files/${PORTNAME}/ diff --git a/sysutils/lttng-tools/files/patch-src_bin_lttng-sessiond_consumer.c b/sysutils/lttng-tools/files/patch-src_bin_lttng-sessiond_consumer.c index e22db4d04fc2..cf2fe604f8a9 100644 --- a/sysutils/lttng-tools/files/patch-src_bin_lttng-sessiond_consumer.c +++ b/sysutils/lttng-tools/files/patch-src_bin_lttng-sessiond_consumer.c @@ -1,12 +1,19 @@ ---- src/bin/lttng-sessiond/consumer.c.orig 2016-11-29 22:48:37 UTC -+++ src/bin/lttng-sessiond/consumer.c -@@ -635,6 +635,9 @@ int consumer_set_network_uri(struct cons +--- src/bin/lttng-sessiond/consumer.c.orig 2017-01-09 19:26:28 UTC ++++ src/bin/lttng-sessiond/consumer.c +@@ -17,6 +17,7 @@ + + #define _LGPL_SOURCE + #include ++#include + #include + #include + #include +@@ -635,7 +636,7 @@ int consumer_set_network_uri(struct consumer_output *o { int ret; char tmp_path[PATH_MAX]; -+#if defined(__FreeBSD__) -+ const size_t HOST_NAME_MAX = sysconf(_SC_HOST_NAME_MAX); -+#endif - char hostname[HOST_NAME_MAX]; +- char hostname[HOST_NAME_MAX]; ++ char hostname[_POSIX_HOST_NAME_MAX]; struct lttng_uri *dst_uri = NULL; + /* Code flow error safety net. */ diff --git a/sysutils/lttng-tools/files/patch-src_bin_lttng-sessiond_session.h b/sysutils/lttng-tools/files/patch-src_bin_lttng-sessiond_session.h index b64470a2c107..2e98067379cb 100644 --- a/sysutils/lttng-tools/files/patch-src_bin_lttng-sessiond_session.h +++ b/sysutils/lttng-tools/files/patch-src_bin_lttng-sessiond_session.h @@ -1,14 +1,11 @@ ---- src/bin/lttng-sessiond/session.h.orig 2016-11-29 22:48:37 UTC +--- src/bin/lttng-sessiond/session.h.orig 2017-01-09 19:26:28 UTC +++ src/bin/lttng-sessiond/session.h -@@ -60,7 +60,11 @@ struct ltt_session_list { +@@ -60,7 +60,7 @@ struct ltt_session_list { */ struct ltt_session { char name[NAME_MAX]; -+#if defined(__FreeBSD__) -+ char hostname[256]; /* Local hostname. */ -+#else - char hostname[HOST_NAME_MAX]; /* Local hostname. */ -+#endif +- char hostname[HOST_NAME_MAX]; /* Local hostname. */ ++ char hostname[_POSIX_HOST_NAME_MAX]; /* Local hostname. */ struct ltt_kernel_session *kernel_session; struct ltt_ust_session *ust_session; /* diff --git a/sysutils/lttng-tools/files/patch-src_bin_lttng-sessiond_ust-metadata.c b/sysutils/lttng-tools/files/patch-src_bin_lttng-sessiond_ust-metadata.c index 00271f154e85..e95b52ac1382 100644 --- a/sysutils/lttng-tools/files/patch-src_bin_lttng-sessiond_ust-metadata.c +++ b/sysutils/lttng-tools/files/patch-src_bin_lttng-sessiond_ust-metadata.c @@ -1,6 +1,6 @@ ---- src/bin/lttng-sessiond/ust-metadata.c.orig 2016-11-29 22:48:37 UTC +--- src/bin/lttng-sessiond/ust-metadata.c.orig 2017-01-09 19:26:28 UTC +++ src/bin/lttng-sessiond/ust-metadata.c -@@ -50,6 +50,7 @@ int _lttng_field_statedump(struct ust_re +@@ -50,6 +50,7 @@ int _lttng_field_statedump(struct ust_registry_session const struct ustctl_field *fields, size_t nr_fields, size_t *iter_field, size_t nesting); @@ -16,13 +16,21 @@ static inline int get_count_order(unsigned int count) -@@ -879,6 +881,9 @@ int ust_metadata_session_statedump(struc +@@ -879,7 +881,7 @@ int ust_metadata_session_statedump(struct ust_registry char uuid_s[UUID_STR_LEN], clock_uuid_s[UUID_STR_LEN]; int ret = 0; -+#if defined(__FreeBSD__) -+ const size_t HOST_NAME_MAX = sysconf(_SC_HOST_NAME_MAX); -+#endif - char hostname[HOST_NAME_MAX]; +- char hostname[HOST_NAME_MAX]; ++ char hostname[_POSIX_HOST_NAME_MAX]; assert(session); + +@@ -940,7 +942,7 @@ int ust_metadata_session_statedump(struct ust_registry + hostname[0] = '\0'; + ret = gethostname(hostname, sizeof(hostname)); + if (ret && errno == ENAMETOOLONG) +- hostname[HOST_NAME_MAX - 1] = '\0'; ++ hostname[_POSIX_HOST_NAME_MAX - 1] = '\0'; + ret = lttng_metadata_printf(session, + "env {\n" + " hostname = \"%s\";\n" diff --git a/sysutils/lttng-tools/files/patch-src_bin_lttng_commands_view.c b/sysutils/lttng-tools/files/patch-src_bin_lttng_commands_view.c index fba950a0426e..82f4d46c594a 100644 --- a/sysutils/lttng-tools/files/patch-src_bin_lttng_commands_view.c +++ b/sysutils/lttng-tools/files/patch-src_bin_lttng_commands_view.c @@ -1,12 +1,19 @@ ---- src/bin/lttng/commands/view.c.orig 2016-11-29 22:48:37 UTC +--- src/bin/lttng/commands/view.c.orig 2017-01-09 19:26:28 UTC +++ src/bin/lttng/commands/view.c -@@ -269,6 +269,9 @@ static char *build_live_path(char *sessi +@@ -17,6 +17,7 @@ + + #define _LGPL_SOURCE + #include ++#include + #include + #include + #include +@@ -269,7 +270,7 @@ static char *build_live_path(char *session_name) { int ret; char *path = NULL; -+#if defined(__FreeBSD__) -+ const size_t HOST_NAME_MAX = sysconf(_SC_HOST_NAME_MAX); -+#endif - char hostname[HOST_NAME_MAX]; +- char hostname[HOST_NAME_MAX]; ++ char hostname[_POSIX_HOST_NAME_MAX]; ret = gethostname(hostname, sizeof(hostname)); + if (ret < 0) {