aboutsummaryrefslogtreecommitdiffstats
path: root/package/util-linux/patches
diff options
context:
space:
mode:
Diffstat (limited to 'package/util-linux/patches')
-rw-r--r--package/util-linux/patches/000-compile.patch44
-rw-r--r--package/util-linux/patches/001-no-printf-alloc.patch108
2 files changed, 152 insertions, 0 deletions
diff --git a/package/util-linux/patches/000-compile.patch b/package/util-linux/patches/000-compile.patch
new file mode 100644
index 000000000..b7cc18b40
--- /dev/null
+++ b/package/util-linux/patches/000-compile.patch
@@ -0,0 +1,44 @@
+--- a/misc-utils/cal.c
++++ b/misc-utils/cal.c
+@@ -291,41 +291,6 @@ main(int argc, char **argv) {
+ }
+ #endif
+
+-/*
+- * The traditional Unix cal utility starts the week at Sunday,
+- * while ISO 8601 starts at Monday. We read the start day from
+- * the locale database, which can be overridden with the
+- * -s (Sunday) or -m (Monday) options.
+- */
+-#if HAVE_DECL__NL_TIME_WEEK_1STDAY
+- /*
+- * You need to use 2 locale variables to get the first day of the week.
+- * This is needed to support first_weekday=2 and first_workday=1 for
+- * the rare case where working days span across 2 weeks.
+- * This shell script shows the combinations and calculations involved:
+- *
+- * for LANG in en_US ru_RU fr_FR csb_PL POSIX; do
+- * printf "%s:\t%s + %s -1 = " $LANG $(locale week-1stday first_weekday)
+- * date -d"$(locale week-1stday) +$(($(locale first_weekday)-1))day" +%w
+- * done
+- *
+- * en_US: 19971130 + 1 -1 = 0 #0 = sunday
+- * ru_RU: 19971130 + 2 -1 = 1
+- * fr_FR: 19971201 + 1 -1 = 1
+- * csb_PL: 19971201 + 2 -1 = 2
+- * POSIX: 19971201 + 7 -1 = 0
+- */
+- {
+- int wfd;
+- union { unsigned int word; char *string; } val;
+- val.string = nl_langinfo(_NL_TIME_WEEK_1STDAY);
+-
+- wfd = val.word;
+- wfd = day_in_week(wfd % 100, (wfd / 100) % 100, wfd / (100 * 100));
+- weekstart = (wfd + *nl_langinfo(_NL_TIME_FIRST_WEEKDAY) - 1) % 7;
+- }
+-#endif
+-
+ yflag = 0;
+ while ((ch = getopt_long(argc, argv, "13mjsyVh", longopts, NULL)) != -1)
+ switch(ch) {
diff --git a/package/util-linux/patches/001-no-printf-alloc.patch b/package/util-linux/patches/001-no-printf-alloc.patch
new file mode 100644
index 000000000..e3f048ab3
--- /dev/null
+++ b/package/util-linux/patches/001-no-printf-alloc.patch
@@ -0,0 +1,108 @@
+for systems that don't support latest POSIX standard: %as
+
+https://bugs.gentoo.org/406303
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -688,7 +688,6 @@ AC_ARG_ENABLE([libmount],
+ UL_BUILD_INIT([libmount])
+ UL_REQUIRES_LINUX([libmount])
+ UL_REQUIRES_BUILD([libmount], [libblkid])
+-UL_REQUIRES_HAVE([libmount], [scanf_alloc_modifier], [scanf string alloc modifier])
+ AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$build_libmount" = xyes)
+
+ AC_SUBST([LIBMOUNT_VERSION])
+--- a/libmount/src/tab_parse.c
++++ b/libmount/src/tab_parse.c
+@@ -22,6 +22,10 @@
+ #include "pathnames.h"
+ #include "strutils.h"
+
++#ifndef HAVE_SCANF_MS_MODIFIER
++# define UL_SCNsA "%s"
++#endif
++
+ static inline char *skip_spaces(char *s)
+ {
+ assert(s);
+@@ -61,16 +65,31 @@ static int mnt_parse_table_line(struct l
+ int rc, n = 0, xrc;
+ char *src = NULL, *fstype = NULL, *optstr = NULL;
+
++#ifndef HAVE_SCANF_MS_MODIFIER
++ size_t len = strlen(s) + 1;
++ src = malloc(len);
++ fstype = malloc(len);
++ fs->target = malloc(len);
++ optstr = malloc(len);
++#endif
++
+ rc = sscanf(s, UL_SCNsA" " /* (1) source */
+ UL_SCNsA" " /* (2) target */
+ UL_SCNsA" " /* (3) FS type */
+ UL_SCNsA" " /* (4) options */
+ "%n", /* byte count */
+
++#ifdef HAVE_SCANF_MS_MODIFIER
+ &src,
+ &fs->target,
+ &fstype,
+ &optstr,
++#else
++ src,
++ fs->target,
++ fstype,
++ optstr,
++#endif
+ &n);
+ xrc = rc;
+
+@@ -136,6 +155,16 @@ static int mnt_parse_mountinfo_line(stru
+ unsigned int maj, min;
+ char *fstype = NULL, *src = NULL, *p;
+
++#ifndef HAVE_SCANF_MS_MODIFIER
++ size_t len = strlen(s) + 1;
++ fs->root = malloc(len);
++ fs->target = malloc(len);
++ fs->vfs_optstr = malloc(len);
++ fs->fs_optstr = malloc(len);
++ fstype = malloc(len);
++ src = malloc(len);
++#endif
++
+ rc = sscanf(s, "%u " /* (1) id */
+ "%u " /* (2) parent */
+ "%u:%u " /* (3) maj:min */
+@@ -147,9 +176,15 @@ static int mnt_parse_mountinfo_line(stru
+ &fs->id,
+ &fs->parent,
+ &maj, &min,
++#ifdef HAVE_SCANF_MS_MODIFIER
+ &fs->root,
+ &fs->target,
+ &fs->vfs_optstr,
++#else
++ fs->root,
++ fs->target,
++ fs->vfs_optstr,
++#endif
+ &end);
+
+ if (rc >= 7 && end > 0)
+@@ -167,9 +202,15 @@ static int mnt_parse_mountinfo_line(stru
+ UL_SCNsA" " /* (9) source */
+ UL_SCNsA, /* (10) fs options (fs specific) */
+
++#ifdef HAVE_SCANF_MS_MODIFIER
+ &fstype,
+ &src,
+ &fs->fs_optstr);
++#else
++ fstype,
++ src,
++ fs->fs_optstr);
++#endif
+
+ if (rc >= 10) {
+ fs->flags |= MNT_FS_KERNEL;