4f3af906fb
This version brings bug fixes, enhancements and a new script utility,
scriptlive. For detailed information see the release notes:
http://www.kernel.org/pub/linux/utils/util-linux/v2.35/v2.35-ReleaseNotes
Pull some fixed applied after the release.
Disable the use of code under GPLv3 included in hwclock since v2.30. The
subject was discussed upstream[1] and it was decided that hwclock will
be made GPLv2-only again in v2.36, so do it in advance in Buildroot.
Meanwhile, be warned that all OS images selecting hwclock built with
Buildroot since commit 74235a6854
(util-linux: bump to version 2.30)
contain code under GPLv3, which imposes some technical difficulties to
include in embedded systems. For more information see GPLv3, Section 6,
"Conveying Non-Source Forms", and the definitions of User Product and
Installation Information[2].
1. https://lore.kernel.org/util-linux/20200127202152.4jh2w4chch37wgee@ws.net.home/T/#t
2. https://www.gnu.org/licenses/gpl-3.0.html
Signed-off-by: Carlos Santos <unixmania@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
106 lines
3.4 KiB
Diff
106 lines
3.4 KiB
Diff
From e8c21c894e69ba0c72ecf69e8297cb20ec5f9c1e Mon Sep 17 00:00:00 2001
|
|
From: Karel Zak <kzak@redhat.com>
|
|
Date: Mon, 27 Jan 2020 16:17:10 +0100
|
|
Subject: [PATCH] build-sys: add --disable-hwclock-gplv3
|
|
|
|
The currently used date/time parser (for hwclock --set --date <date>)
|
|
is gnulib based code with GPLv3.
|
|
|
|
This patch allows to avoid this code and replace it with minimalistic
|
|
date/time parser.
|
|
|
|
Addresses: https://github.com/karelzak/util-linux/issues/891
|
|
Reported-by: Carlos Santos <unixmania@gmail.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
---
|
|
configure.ac | 9 +++++++++
|
|
sys-utils/Makemodule.am | 5 ++++-
|
|
sys-utils/hwclock.c | 17 ++++++++++++++---
|
|
3 files changed, 27 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 84b375543..960e2016d 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -1558,6 +1558,15 @@ AS_IF([test "x$build_hwclock_cmos" = xyes ], [
|
|
AC_DEFINE([USE_HWCLOCK_CMOS], [1], [Define to 1 if want to use CMOS clock.])
|
|
])
|
|
|
|
+AC_ARG_ENABLE([hwclock_gplv3],
|
|
+ AS_HELP_STRING([--disable-hwclock-gplv3], [do not use datetime parsing GPLv3 code]),
|
|
+ [], [enable_hwclock_gplv3=yes]
|
|
+)
|
|
+AM_CONDITIONAL([USE_HWCLOCK_GPLv3_DATETIME], [test "x$enable_hwclock_gplv3" = xyes])
|
|
+AS_IF([test "x$enable_hwclock_gplv3" = xyes ], [
|
|
+ AC_DEFINE([USE_HWCLOCK_GPLv3_DATETIME], [1], [use datetime parsing GPLv3 code to hwclock])
|
|
+])
|
|
+
|
|
|
|
UL_BUILD_INIT([mkfs], [yes])
|
|
AM_CONDITIONAL([BUILD_MKFS], [test "x$build_mkfs" = xyes])
|
|
diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
|
|
index baf851e5b..07228f75f 100644
|
|
--- a/sys-utils/Makemodule.am
|
|
+++ b/sys-utils/Makemodule.am
|
|
@@ -451,8 +451,11 @@ dist_man_MANS += \
|
|
PATHFILES += sys-utils/hwclock.8
|
|
hwclock_SOURCES = \
|
|
sys-utils/hwclock.c \
|
|
- sys-utils/hwclock.h \
|
|
+ sys-utils/hwclock.h
|
|
+if USE_HWCLOCK_GPLv3_DATETIME
|
|
+hwclock_SOURCES += \
|
|
sys-utils/hwclock-parse-date.y
|
|
+endif
|
|
hwclock_LDADD = $(LDADD) libcommon.la -lm
|
|
hwclock_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/sys-utils
|
|
if USE_HWCLOCK_CMOS
|
|
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
|
|
index 15fc19afd..e736da717 100644
|
|
--- a/sys-utils/hwclock.c
|
|
+++ b/sys-utils/hwclock.c
|
|
@@ -3,6 +3,7 @@
|
|
*
|
|
* Since 7a3000f7ba548cf7d74ac77cc63fe8de228a669e (v2.30) hwclock is linked
|
|
* with parse_date.y from gnullib. This gnulib code is distributed with GPLv3.
|
|
+ * Use --disable-hwclock-gplv3 to exclude this code.
|
|
*
|
|
*
|
|
* clock.c was written by Charles Hedrick, hedrick@cs.rutgers.edu, Apr 1992
|
|
@@ -1170,7 +1171,6 @@ int main(int argc, char **argv)
|
|
};
|
|
struct timeval startup_time;
|
|
struct adjtime adjtime = { 0 };
|
|
- struct timespec when = { 0 };
|
|
/*
|
|
* The time we started up, in seconds into the epoch, including
|
|
* fractions.
|
|
@@ -1398,11 +1398,22 @@ int main(int argc, char **argv)
|
|
|
|
if (ctl.set || ctl.predict) {
|
|
if (!ctl.date_opt) {
|
|
- warnx(_("--date is required for --set or --predict"));
|
|
- exit(EXIT_FAILURE);
|
|
+ warnx(_("--date is required for --set or --predict"));
|
|
+ exit(EXIT_FAILURE);
|
|
}
|
|
+#ifdef USE_HWCLOCK_GPLv3_DATETIME
|
|
+ /* date(1) compatible GPLv3 parser */
|
|
+ struct timespec when = { 0 };
|
|
+
|
|
if (parse_date(&when, ctl.date_opt, NULL))
|
|
set_time = when.tv_sec;
|
|
+#else
|
|
+ /* minimalistic GPLv2 based parser */
|
|
+ usec_t usec;
|
|
+
|
|
+ if (parse_timestamp(ctl.date_opt, &usec) == 0)
|
|
+ set_time = (time_t) (usec / 1000000);
|
|
+#endif
|
|
else {
|
|
warnx(_("invalid date '%s'"), ctl.date_opt);
|
|
exit(EXIT_FAILURE);
|
|
--
|
|
2.18.2
|
|
|