From 716ca530e1c4515d8683c9d5be3d56b301758b66 Mon Sep 17 00:00:00 2001 From: James <> Date: Wed, 4 Nov 2015 11:49:21 +0000 Subject: trunk-47381 --- package/utils/util-linux/Makefile | 644 +++++++++++++++++++++ ...ch_root-improve-statfs-f_type-portability.patch | 49 ++ ...lors-use-static-buffers-when-parse-scheme.patch | 126 ++++ .../util-linux/patches/001-no-printf-alloc.patch | 104 ++++ .../utils/util-linux/patches/002-mkostemp.patch | 46 ++ .../patches/003-fix_pkgconfig_files.patch | 62 ++ 6 files changed, 1031 insertions(+) create mode 100644 package/utils/util-linux/Makefile create mode 100644 package/utils/util-linux/patches/0001-switch_root-improve-statfs-f_type-portability.patch create mode 100644 package/utils/util-linux/patches/0002-lib-colors-use-static-buffers-when-parse-scheme.patch create mode 100644 package/utils/util-linux/patches/001-no-printf-alloc.patch create mode 100644 package/utils/util-linux/patches/002-mkostemp.patch create mode 100644 package/utils/util-linux/patches/003-fix_pkgconfig_files.patch (limited to 'package/utils/util-linux') diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile new file mode 100644 index 0000000..f037e6a --- /dev/null +++ b/package/utils/util-linux/Makefile @@ -0,0 +1,644 @@ +# +# Copyright (C) 2007-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=util-linux +PKG_VERSION:=2.25.2 +PKG_RELEASE:=4 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.25 +PKG_MD5SUM:=cab3d7be354000f629bc601238b629b3 + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING getopt/COPYING libblkid/COPYING libmount/COPYING Documentation/licenses/COPYING.GPLv2 Documentation/licenses/COPYING.LGPLv2.1 libuuid/COPYING Documentation/licenses/COPYING.BSD-3 + +PKG_BUILD_PARALLEL:=1 + +PKG_CONFIG_DEPENDS:= \ + CONFIG_PACKAGE_cal \ + CONFIG_PACKAGE_cfdisk \ + CONFIG_PACKAGE_setterm + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/util-linux/Default + SECTION:=utils + CATEGORY:=Utilities + URL:=http://www.kernel.org/pub/linux/utils/util-linux/ +endef + +CONFIGURE_ARGS += \ + --disable-rpath \ + --enable-new-mount \ + --disable-tls \ + --disable-sulogin \ + --without-python \ + --without-udev \ + $(if $(CONFIG_PACKAGE_cal)$(CONFIG_PACKAGE_cfdisk)$(CONFIG_PACKAGE_setterm),--with-ncurses,--without-ncurses) + +TARGET_CFLAGS += $(FPIC) -std=gnu99 + +define Build/InstallDev + $(MAKE) -C $(PKG_BUILD_DIR) \ + BUILDCC="$(HOSTCC)" \ + DESTDIR="$(1)" \ + installdirs install-data + + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_BUILD_DIR)/libblkid/blkid.pc $(1)/usr/lib/pkgconfig + $(CP) $(PKG_BUILD_DIR)/libmount/mount.pc $(1)/usr/lib/pkgconfig + $(CP) $(PKG_BUILD_DIR)/libsmartcols/smartcols.pc $(1)/usr/lib/pkgconfig + $(CP) $(PKG_BUILD_DIR)/libuuid/uuid.pc $(1)/usr/lib/pkgconfig + + $(INSTALL_DIR) $(1)/usr/include/blkid + $(CP) $(PKG_BUILD_DIR)/libblkid/src/blkid.h $(1)/usr/include/blkid + $(INSTALL_DIR) $(1)/usr/include/libmount + $(CP) $(PKG_BUILD_DIR)/libmount/src/libmount.h $(1)/usr/include/libmount + $(INSTALL_DIR) $(1)/usr/include/uuid + $(CP) $(PKG_BUILD_DIR)/libuuid/src/uuid.h $(1)/usr/include/uuid + $(INSTALL_DIR) $(1)/usr/include/smartcols + $(CP) $(PKG_BUILD_DIR)/libsmartcols/src/libsmartcols.h $(1)/usr/include/smartcols + + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/.libs/libblkid.{a,so*} $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/.libs/libmount.{a,so*} $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/.libs/libuuid.{a,so*} $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/.libs/libsmartcols.{a,so*} $(1)/usr/lib +endef + +define Package/libblkid +$(call Package/util-linux/Default) + DEPENDS:=+libuuid + TITLE:=block device id library + SECTION:=libs + CATEGORY:=Libraries +endef + +define Package/libblkid/description + The libblkid library is used to identify block devices (disks) as to their + content (e.g. filesystem type, partitions) as well as extracting additional + information such as filesystem labels/volume names, partitions, unique + identifiers/serial numbers... +endef + +define Package/libmount +$(call Package/util-linux/Default) + DEPENDS:=+libblkid + TITLE:=mount library + SECTION:=libs + CATEGORY:=Libraries +endef + +define Package/libmount/description + The libmount library is used to parse /etc/fstab, /etc/mtab and + /proc/self/mountinfo files, manage the mtab file, evaluate mount options... +endef + +define Package/libuuid +$(call Package/util-linux/Default) + TITLE:=DCE compatible Universally Unique Identifier library + SECTION:=libs + CATEGORY:=Libraries +endef + +define Package/libuuid/description + The UUID library is used to generate unique identifiers for objects + that may be accessible beyond the local system. This library + generates UUIDs compatible with those created by the Open Software + Foundation (OSF) Distributed Computing Environment (DCE) utility. +endef + +define Package/libsmartcols +$(call Package/util-linux/Default) + TITLE:=table or tree library + SECTION:=libs + CATEGORY:=Libraries +endef + +define Package/libsmartcols/description + The smartcols library is used to print tables and trees in a pretty way. +endef + +define Package/agetty +$(call Package/util-linux/Default) + TITLE:=alternative Linux getty + SUBMENU=Terminal +endef + +define Package/agetty/description + agetty opens a tty port, prompts for a login name and invokes the + /bin/login command +endef + +define Package/blkid +$(call Package/util-linux/Default) + TITLE:=locate/print block device attributes + DEPENDS:= +libblkid +libuuid + SUBMENU=disc +endef + +define Package/blkid/description + The blkid program is the command-line interface to working with the libblkid + library. +endef + +define Package/cal +$(call Package/util-linux/Default) + TITLE:=display a calendar + DEPENDS:= +libncurses +endef + +define Package/cal/description + cal displays a simple calendar +endef + +define Package/cfdisk +$(call Package/util-linux/Default) + TITLE:=display or manipulate disk partition table + DEPENDS:= +libblkid +libncurses +libsmartcols + SUBMENU:=disc +endef + +define Package/cfdisk/description + cfdisk is a curses-based program for partitioning any hard disk drive +endef + +define Package/dmesg +$(call Package/util-linux/Default) + TITLE:=print or control the kernel ring buffer + DEPENDS:= +librt +endef + +define Package/dmesg/description + dmesg is used to examine or control the kernel ring buffer +endef + +define Package/fdisk +$(call Package/util-linux/Default) + TITLE:=manipulate disk partition table + DEPENDS:= +libblkid +libsmartcols + SUBMENU=disc +endef + +define Package/fdisk/description + a menu-driven program for creation and manipulation of partition tables +endef + +define Package/findfs +$(call Package/util-linux/Default) + TITLE:=find a filesystem by label or UUID + DEPENDS:= +libblkid + SUBMENU=disc +endef + +define Package/findfs/description + findfs will search the disks in the system looking for a filesystem which has + a label matching label or a UUID equal to uuid +endef + +define Package/flock +$(call Package/util-linux/Default) + TITLE:=manage locks from shell scripts +endef + +define Package/flock/description + manages flock locks from within shell scripts or the command line +endef + +define Package/getopt +$(call Package/util-linux/Default) + TITLE:=parse command options (enhanced) +endef + +define Package/getopt/description + getopt is used to break up (parse) options in command lines for easy parsing + by shell procedures, and to check for legal options +endef + +define Package/hwclock +$(call Package/util-linux/Default) + TITLE:=query or set the hardware clock +endef + +define Package/hwclock/description + hwclock is a tool for accessing the Hardware Clock +endef + +define Package/logger +$(call Package/util-linux/Default) + TITLE:=a shell command interface to the syslog system log module +endef + +define Package/logger/description + logger makes entries in the system log, it provides a shell command interface + to the syslog system log module +endef + +define Package/look +$(call Package/util-linux/Default) + TITLE:=display lines beginning with a given string +endef + +define Package/look/description + look utility displays any lines in file which contain string +endef + +define Package/losetup +$(call Package/util-linux/Default) + TITLE:=set up and control loop devices + DEPENDS:= +libsmartcols +endef + +define Package/losetup/description + losetup is used to associate loop devices with regular files or block devices, + to detach loop devices and to query the status of a loop device +endef + +define Package/lsblk +$(call Package/util-linux/Default) + TITLE:=list block devices + DEPENDS:= +libblkid +libmount +libsmartcols + SUBMENU=disc +endef + +define Package/lsblk/description + lsblk lists information about all or the specified block devices +endef + +define Package/mcookie +$(call Package/util-linux/Default) + TITLE:=generate magic cookies for xauth +endef + +define Package/mcookie/description + mcookie generates a 128-bit random hexadecimal number for use with the X + authority system +endef + +define Package/mount-utils +$(call Package/util-linux/Default) + TITLE:=related (u)mount utilities + DEPENDS+= +libmount +libsmartcols +endef + +define Package/mount-utils/description + contains: mount, umount, findmnt +endef + +define Package/namei +$(call Package/util-linux/Default) + TITLE:=follow a pathname until a terminal point is found +endef + +define Package/namei/description + namei uses its arguments as pathnames to any type of Unix file (symlinks, + files, directories, and so forth) +endef + +define Package/prlimit +$(call Package/util-linux/Default) + TITLE:=get and set process resource limits + DEPENDS:= +libsmartcols +endef + +define Package/prlimit/description + Given a process id and one or more resources, prlimit tries to retrieve + and/or modify the limits. +endef + +define Package/rename +$(call Package/util-linux/Default) + TITLE:=rename files +endef + +define Package/rename/description + rename will rename the specified files by replacing the first occurrence of + expression in their name by replacement +endef + +define Package/partx-utils +$(call Package/util-linux/Default) + TITLE:=inform kernel about the presence and numbering of on-disk partitions + DEPENDS:= +libblkid +libsmartcols + SUBMENU=disc +endef + +define Package/partx-utils/description + contains partx, addpart, delpart +endef + +define Package/script-utils +$(call Package/util-linux/Default) + TITLE:=make and replay typescript of terminal session + SUBMENU=Terminal +endef + +define Package/script-utils/description + contains: script, scriptreplay +endef + +define Package/setterm +$(call Package/util-linux/Default) + TITLE:=set terminal attributes + DEPENDS:= +libncurses + SUBMENU:=Terminal +endef + +define Package/setterm/description + setterm writes to standard output a character string that will invoke the + specified terminal capabilities +endef + +define Package/sfdisk +$(call Package/util-linux/Default) + TITLE:=partition table manipulator for Linux + SUBMENU=disc +endef + +define Package/sfdisk/description + list the size of a partition, list the partitions on a device, check the + partitions on a device and repartition a device +endef + +define Package/swap-utils +$(call Package/util-linux/Default) + TITLE:=swap space management utilities + DEPENDS+= +libblkid + SUBMENU:=disc +endef + +define Package/swap-utils/description + contains: mkswap, swaplabel +endef + +define Package/uuidd +$(call Package/util-linux/Default) + TITLE:=UUID generation daemon + DEPENDS:= +libuuid +endef + +define Package/uuidd/description + The uuidd daemon is used by the UUID library to generate universally unique + identifiers (UUIDs), especially time-based UUIDs, in a secure and + guaranteed-unique fashion, even in the face of large numbers of threads + running on different CPUs trying to grab UUIDs. +endef + +define Package/uuidgen +$(call Package/util-linux/Default) + TITLE:=create a new UUID value + DEPENDS:= +libuuid +endef + +define Package/uuidgen/description + The uuidgen program creates (and prints) a new universally unique identifier + (UUID) using the libuuid library. The new UUID can reasonably be considered + unique among all UUIDs created on the local system, and among UUIDs created on + other systems in the past and in the future. +endef + +define Package/wall +$(call Package/util-linux/Default) + TITLE:=send a message to everybody's terminal + SUBMENU=Terminal +endef + +define Package/wall/description + wall sends a message to everybody logged in with their mesg permission + set to yes +endef + +define Package/whereis +$(call Package/util-linux/Default) + TITLE:=locate the binary, source, and manual page files for a command +endef + +define Package/whereis/description + whereis locates source/binary and manuals sections for specified files +endef + +define Package/wipefs +$(call Package/util-linux/Default) + TITLE:=wipe a signature from a device + DEPENDS:= +libblkid + SUBMENU:=disc +endef + +define Package/wipefs/description + wipefs can erase filesystem, raid or partition table signatures (magic + strings) from the specified device to make the signature invisible for + libblkid. +endef + +define Package/libblkid/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/.libs/libblkid.so* $(1)/usr/lib/ +endef + +define Package/libmount/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/.libs/libmount.so* $(1)/usr/lib/ +endef + +define Package/libsmartcols/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/.libs/libsmartcols.so* $(1)/usr/lib/ +endef + +define Package/libuuid/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/.libs/libuuid.so* $(1)/usr/lib/ +endef + +define Package/agetty/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/agetty $(1)/usr/sbin/ +endef + +define Package/blkid/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/blkid $(1)/usr/sbin/ +endef + +define Package/cal/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/cal $(1)/usr/bin/ +endef + +define Package/cfdisk/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/cfdisk $(1)/usr/sbin/ +endef + +define Package/dmesg/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/dmesg $(1)/usr/sbin/ +endef + +define Package/fdisk/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/fdisk $(1)/usr/sbin/ +endef + +define Package/findfs/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/findfs $(1)/usr/sbin/ +endef + +define Package/flock/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/flock $(1)/usr/bin/ +endef + +define Package/getopt/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/getopt $(1)/usr/bin/ +endef + +define Package/hwclock/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/hwclock $(1)/usr/sbin/ +endef + +define Package/logger/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/logger $(1)/usr/bin/ +endef + +define Package/look/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/look $(1)/usr/bin/ +endef + +define Package/losetup/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/losetup $(1)/usr/sbin/ +endef + +define Package/lsblk/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/lsblk $(1)/usr/bin/ +endef + +define Package/mcookie/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/mcookie $(1)/usr/bin/ +endef + +define Package/mount-utils/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/{u,}mount $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/mountpoint $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/findmnt $(1)/usr/bin/ +endef + +define Package/namei/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/namei $(1)/usr/bin/ +endef + +define Package/prlimit/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/prlimit $(1)/usr/bin/ +endef + +define Package/rename/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/rename $(1)/usr/bin/ +endef + +define Package/partx-utils/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/partx $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/addpart $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/delpart $(1)/usr/sbin/ +endef + +define Package/script-utils/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/script $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/scriptreplay $(1)/usr/bin/ +endef + +define Package/setterm/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/setterm $(1)/usr/bin/ +endef + +define Package/sfdisk/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/sfdisk $(1)/usr/sbin/ +endef + +define Package/swap-utils/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/mkswap $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/swaplabel $(1)/usr/sbin/ +endef + +define Package/uuidd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/uuidd $(1)/usr/sbin/ +endef + +define Package/uuidgen/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/uuidgen $(1)/usr/bin/ +endef + +define Package/wall/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/wall $(1)/usr/bin/ +endef + +define Package/whereis/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/whereis $(1)/usr/bin/ +endef + +define Package/wipefs/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/wipefs $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,libblkid)) +$(eval $(call BuildPackage,libmount)) +$(eval $(call BuildPackage,libsmartcols)) +$(eval $(call BuildPackage,libuuid)) +$(eval $(call BuildPackage,agetty)) +$(eval $(call BuildPackage,blkid)) +$(eval $(call BuildPackage,cal)) +$(eval $(call BuildPackage,cfdisk)) +$(eval $(call BuildPackage,dmesg)) +$(eval $(call BuildPackage,fdisk)) +$(eval $(call BuildPackage,findfs)) +$(eval $(call BuildPackage,flock)) +$(eval $(call BuildPackage,getopt)) +$(eval $(call BuildPackage,hwclock)) +$(eval $(call BuildPackage,logger)) +$(eval $(call BuildPackage,look)) +$(eval $(call BuildPackage,losetup)) +$(eval $(call BuildPackage,lsblk)) +$(eval $(call BuildPackage,mcookie)) +$(eval $(call BuildPackage,mount-utils)) +$(eval $(call BuildPackage,namei)) +$(eval $(call BuildPackage,prlimit)) +$(eval $(call BuildPackage,rename)) +$(eval $(call BuildPackage,partx-utils)) +$(eval $(call BuildPackage,script-utils)) +$(eval $(call BuildPackage,setterm)) +$(eval $(call BuildPackage,sfdisk)) +$(eval $(call BuildPackage,swap-utils)) +$(eval $(call BuildPackage,uuidd)) +$(eval $(call BuildPackage,uuidgen)) +$(eval $(call BuildPackage,wall)) +$(eval $(call BuildPackage,whereis)) +$(eval $(call BuildPackage,wipefs)) diff --git a/package/utils/util-linux/patches/0001-switch_root-improve-statfs-f_type-portability.patch b/package/utils/util-linux/patches/0001-switch_root-improve-statfs-f_type-portability.patch new file mode 100644 index 0000000..761ace7 --- /dev/null +++ b/package/utils/util-linux/patches/0001-switch_root-improve-statfs-f_type-portability.patch @@ -0,0 +1,49 @@ +From 8f806bb1ea30f15db7ca36d1cfa79349f8115302 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 6 Nov 2014 12:50:27 +0100 +Subject: [PATCH] switch_root: improve statfs->f_type portability + +__SWORD_TYPE is not available everywhere, for example it's not defined +by musl libc. It also seems that __SWORD_TYPE is not used for f_type +on some architectures (s390x). + +Reported-by: Natanael Copa +Signed-off-by: Karel Zak +--- + include/statfs_magic.h | 11 +++++++++++ + sys-utils/switch_root.c | 4 ++-- + 2 files changed, 13 insertions(+), 2 deletions(-) + +--- a/include/statfs_magic.h ++++ b/include/statfs_magic.h +@@ -1,6 +1,17 @@ + #ifndef UTIL_LINUX_STATFS_MAGIC_H + #define UTIL_LINUX_STATFS_MAGIC_H + ++#include ++ ++/* ++ * If possible then don't depend on internal libc __SWORD_TYPE type. ++ */ ++#ifdef __GNUC__ ++typedef __typeof__( ((struct statfs *)0)->f_type ) ul_statfs_ftype_t; ++#else ++typedef __SWORD_TYPE ul_statfs_ftype_t; ++#endif ++ + /* + * Unfortunately, Linux kernel hedeader file is incomplete + * mess and kernel returns by statfs f_type many numbers that are nowhere +--- a/sys-utils/switch_root.c ++++ b/sys-utils/switch_root.c +@@ -181,8 +181,8 @@ static int switchroot(const char *newroo + if (pid <= 0) { + struct statfs stfs; + if (fstatfs(cfd, &stfs) == 0 && +- (stfs.f_type == (__SWORD_TYPE)STATFS_RAMFS_MAGIC || +- stfs.f_type == (__SWORD_TYPE)STATFS_TMPFS_MAGIC)) ++ (stfs.f_type == (ul_statfs_ftype_t) STATFS_RAMFS_MAGIC || ++ stfs.f_type == (ul_statfs_ftype_t) STATFS_TMPFS_MAGIC)) + recursiveRemove(cfd); + else + warn(_("old root filesystem is not an initramfs")); diff --git a/package/utils/util-linux/patches/0002-lib-colors-use-static-buffers-when-parse-scheme.patch b/package/utils/util-linux/patches/0002-lib-colors-use-static-buffers-when-parse-scheme.patch new file mode 100644 index 0000000..ccd82fd --- /dev/null +++ b/package/utils/util-linux/patches/0002-lib-colors-use-static-buffers-when-parse-scheme.patch @@ -0,0 +1,126 @@ +From 6508db29ded734ac4ff5e5e19486c143c9eb3d89 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Fri, 21 Nov 2014 12:23:47 +0100 +Subject: [PATCH] lib/colors: use static buffers when parse scheme + +* use static buffers when parse scheme colors +* cleanup deallocation on error in sequence parser + +Signed-off-by: Karel Zak +--- + +This is modified upstream patch. + +--- a/lib/colors.c ++++ b/lib/colors.c +@@ -416,28 +416,31 @@ static int colors_add_scheme(struct ul_c + char *name, + char *seq0) + { +- struct ul_color_scheme *cs; +- char *seq; ++ struct ul_color_scheme *cs = NULL; ++ char *seq = NULL; + int rc; + + if (!cc || !name || !*name || !seq0 || !*seq0) + return -EINVAL; + + rc = cn_sequence(seq0, &seq); +- free(seq0); + if (rc) + return rc; + ++ rc = -ENOMEM; ++ + /* convert logical name (e.g. "red") to real ESC code */ + if (isalpha(*seq)) { + const char *s = color_sequence_from_colorname(seq); + char *p; + +- if (!s) +- return -EINVAL; ++ if (!s) { ++ rc = -EINVAL; ++ goto err; ++ } + p = strdup(s); + if (!p) +- return -ENOMEM; ++ goto err; + free(seq); + seq = p; + } +@@ -447,17 +450,28 @@ static int colors_add_scheme(struct ul_c + void *tmp = realloc(cc->schemes, (cc->nschemes + 10) + * sizeof(struct ul_color_scheme)); + if (!tmp) +- return -ENOMEM; ++ goto err; + cc->schemes = tmp; + cc->schemes_sz = cc->nschemes + 10; + } + + /* add a new item */ +- cs = &cc->schemes[cc->nschemes++]; +- cs->name = name; ++ cs = &cc->schemes[cc->nschemes]; + cs->seq = seq; ++ cs->name = strdup(name); ++ if (!cs->name) ++ goto err; + ++ cc->nschemes++; + return 0; ++err: ++ if (cs) { ++ free(cs->seq); ++ free(cs->name); ++ cs->seq = cs->name = NULL; ++ } else ++ free(seq); ++ return rc; + } + + /* +@@ -543,7 +557,8 @@ static int colors_read_schemes(struct ul + { + int rc = 0; + FILE *f = NULL; +- char buf[BUFSIZ]; ++ char buf[BUFSIZ], ++ cn[129], seq[129]; + + if (!cc->configured) + rc = colors_read_configuration(cc); +@@ -560,7 +575,6 @@ static int colors_read_schemes(struct ul + } + + while (fgets(buf, sizeof(buf), f)) { +- char *cn = NULL, *seq = NULL; + char *p = strchr(buf, '\n'); + + if (!p) { +@@ -576,17 +590,14 @@ static int colors_read_schemes(struct ul + if (*p == '\0' || *p == '#') + continue; + +- rc = sscanf(p, UL_SCNsA" " /* name */ +- UL_SCNsA, /* color */ +- &cn, &seq); +- if (rc == 2 && cn && seq) ++ rc = sscanf(p, "%128[^ ] %128[^\n ]", cn, seq); ++ if (rc == 2 && *cn && *seq) { + rc = colors_add_scheme(cc, cn, seq); /* set rc=0 on success */ +- if (rc) { +- free(cn); +- free(seq); ++ if (rc) ++ goto done; + } +- rc = 0; + } ++ rc = 0; + + done: + if (f) diff --git a/package/utils/util-linux/patches/001-no-printf-alloc.patch b/package/utils/util-linux/patches/001-no-printf-alloc.patch new file mode 100644 index 0000000..ad9eef0 --- /dev/null +++ b/package/utils/util-linux/patches/001-no-printf-alloc.patch @@ -0,0 +1,104 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -798,7 +798,6 @@ AC_ARG_ENABLE([libmount], + ) + UL_BUILD_INIT([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]) + AM_CONDITIONAL([BUILD_LIBMOUNT_TESTS], [test "x$build_libmount" = xyes -a "x$enable_static" = xyes]) + +--- 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 int next_number(char **s, int *num) + { + char *end = NULL; +@@ -52,16 +56,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; + +@@ -127,6 +146,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, "%d " /* (1) id */ + "%d " /* (2) parent */ + "%u:%u " /* (3) maj:min */ +@@ -138,9 +167,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) +@@ -160,9 +195,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) { + size_t sz; diff --git a/package/utils/util-linux/patches/002-mkostemp.patch b/package/utils/util-linux/patches/002-mkostemp.patch new file mode 100644 index 0000000..0281842 --- /dev/null +++ b/package/utils/util-linux/patches/002-mkostemp.patch @@ -0,0 +1,46 @@ +Support older hosts with latest util-linux-native + +mkostemp is not defined on older machines. So we detect this and +provide a define that uses mkstemp instead. + +O_CLOEXEC is not defined on older machines. It is however defined +in the 'c.h' header. Fix up the users to include 'c.h'. + +fdisks/fdisksunlabel.c was modified to use qsort_r, however +this is not defined on older hosts. Revert: + commit c69bbca9c1f6645097bd20fe3a21f5a99a2a0698 + fdisk: (sun): use ask API, remove global variable + +Upstream-Status: Inappropriate [other] +Patches revert upstream changes in order to support older +machines. + +Signed-off-by: Mark Hatle +--- + +--- a/configure.ac ++++ b/configure.ac +@@ -315,6 +315,7 @@ AC_CHECK_FUNCS([ \ + llseek \ + lseek64 \ + mempcpy \ ++ mkostemp \ + nanosleep \ + open_memstream \ + personality \ +--- a/include/c.h ++++ b/include/c.h +@@ -233,6 +233,13 @@ static inline int dirfd(DIR *d) + #endif + + /* ++ * mkostemp replacement ++ */ ++#ifndef HAVE_MKOSTEMP ++#define mkostemp(template, flags) mkstemp(template) ++#endif ++ ++/* + * MAXHOSTNAMELEN replacement + */ + static inline size_t get_hostname_max(void) diff --git a/package/utils/util-linux/patches/003-fix_pkgconfig_files.patch b/package/utils/util-linux/patches/003-fix_pkgconfig_files.patch new file mode 100644 index 0000000..ac590a0 --- /dev/null +++ b/package/utils/util-linux/patches/003-fix_pkgconfig_files.patch @@ -0,0 +1,62 @@ +--- a/libuuid/Makemodule.am ++++ b/libuuid/Makemodule.am +@@ -4,7 +4,6 @@ include libuuid/man/Makemodule.am + include libuuid/src/Makemodule.am + + pkgconfig_DATA += libuuid/uuid.pc +-PATHFILES += libuuid/uuid.pc + EXTRA_DIST += libuuid/COPYING + + endif # BUILD_LIBUUID +--- a/configure.ac ++++ b/configure.ac +@@ -1802,15 +1802,19 @@ AC_CONFIG_HEADERS([config.h]) + # + AC_CONFIG_FILES([ + Makefile ++libblkid/blkid.pc + libblkid/docs/Makefile + libblkid/docs/version.xml + libblkid/src/blkid.h ++libmount/mount.pc + libmount/docs/Makefile + libmount/docs/version.xml + libmount/src/libmount.h ++libsmartcols/smartcols.pc + libsmartcols/docs/Makefile + libsmartcols/docs/version.xml + libsmartcols/src/libsmartcols.h ++libuuid/uuid.pc + po/Makefile.in + ]) + +--- a/libblkid/Makemodule.am ++++ b/libblkid/Makemodule.am +@@ -9,7 +9,6 @@ SUBDIRS += libblkid/docs + endif + + pkgconfig_DATA += libblkid/blkid.pc +-PATHFILES += libblkid/blkid.pc + dist_man_MANS += libblkid/libblkid.3 + EXTRA_DIST += libblkid/libblkid.3 libblkid/COPYING + +--- a/libmount/Makemodule.am ++++ b/libmount/Makemodule.am +@@ -9,7 +9,6 @@ SUBDIRS += libmount/docs + endif + + pkgconfig_DATA += libmount/mount.pc +-PATHFILES += libmount/mount.pc + EXTRA_DIST += libmount/COPYING + + endif # BUILD_LIBMOUNT +--- a/libsmartcols/Makemodule.am ++++ b/libsmartcols/Makemodule.am +@@ -8,7 +8,6 @@ SUBDIRS += libsmartcols/docs + endif + + pkgconfig_DATA += libsmartcols/smartcols.pc +-PATHFILES += libsmartcols/smartcols.pc + EXTRA_DIST += libsmartcols/COPYING + + endif # BUILD_LIBSMARTCOLS -- cgit v1.2.3