Merge pull request #5194 from ognevny/update-util-linux

util-linux: update to 2.40.2
This commit is contained in:
jeremyd2019 2025-02-09 09:59:59 -08:00 committed by GitHub
commit ad57f04f06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 421 additions and 247 deletions

View File

@ -1,49 +0,0 @@
--- origsrc/util-linux-2.24.2/term-utils/agetty.c 2014-04-24 02:37:04.462705900 -0500
+++ src/util-linux-2.24.2/term-utils/agetty.c 2014-07-08 21:07:06.378498800 -0500
@@ -64,6 +64,14 @@
# ifndef DEFAULT_STERM
# define DEFAULT_STERM "vt102"
# endif
+#elif defined(__CYGWIN__)
+# define USE_SYSLOG
+# ifndef DEFAULT_VCTERM
+# define DEFAULT_VCTERM "cygwin"
+# endif
+# ifndef DEFAULT_STERM
+# define DEFAULT_STERM "vt102"
+# endif
#else
# ifndef DEFAULT_VCTERM
# define DEFAULT_VCTERM "vt100"
@@ -896,7 +904,9 @@ static void update_utmp(struct options *
#endif
ut.ut_type = LOGIN_PROCESS;
ut.ut_pid = pid;
+#ifndef __CYGWIN__
ut.ut_session = sid;
+#endif
pututline(&ut);
endutent();
@@ -983,8 +993,12 @@ static void open_tty(char *tty, struct t
if (op->flags & F_HANGUP) {
+#ifdef TIOCNOTTY
if (ioctl(fd, TIOCNOTTY))
debug("TIOCNOTTY ioctl failed\n");
+#else
+ setsid();
+#endif
/*
* Let's close all file decriptors before vhangup
@@ -1722,7 +1736,7 @@ static void termio_final(struct options
tp->c_cc[VQUIT] = DEF_QUIT;
tp->c_cc[VEOF] = DEF_EOF;
tp->c_cc[VEOL] = DEF_EOL;
-#ifdef __linux__
+#if defined(VSWTC)
tp->c_cc[VSWTC] = DEF_SWITCH;
#elif defined(VSWTCH)
tp->c_cc[VSWTCH] = DEF_SWITCH;

View File

@ -1,45 +0,0 @@
--- origsrc/util-linux-2.24.2/libblkid/src/Makemodule.am 2014-04-24 02:37:04.354704100 -0500
+++ src/util-linux-2.24.2/libblkid/src/Makemodule.am 2014-07-08 21:17:41.022588300 -0500
@@ -94,6 +94,7 @@ libblkid_la_SOURCES = \
libblkid/src/superblocks/xfs.c \
libblkid/src/superblocks/zfs.c \
\
+ libblkid/src/topology/ioctl.c \
libblkid/src/topology/topology.c \
libblkid/src/topology/topology.h
@@ -101,7 +102,6 @@ if LINUX
libblkid_la_SOURCES += \
libblkid/src/topology/dm.c \
libblkid/src/topology/evms.c \
- libblkid/src/topology/ioctl.c \
libblkid/src/topology/lvm.c \
libblkid/src/topology/md.c \
libblkid/src/topology/sysfs.c
--- origsrc/util-linux-2.24.2/libblkid/src/topology/topology.c 2014-04-23 08:28:29.146326300 -0500
+++ src/util-linux-2.24.2/libblkid/src/topology/topology.c 2014-07-08 21:17:17.354582900 -0500
@@ -74,7 +74,9 @@ struct blkid_struct_topology {
*/
static const struct blkid_idinfo *idinfos[] =
{
-#ifdef __linux__
+#if defined(__CYGWIN__)
+ &ioctl_tp_idinfo
+#elif defined(__linux__)
&ioctl_tp_idinfo,
&sysfs_tp_idinfo,
&md_tp_idinfo,
--- origsrc/util-linux-2.24.2/libblkid/src/topology/topology.h 2013-02-27 10:46:29.873020600 -0600
+++ src/util-linux-2.24.2/libblkid/src/topology/topology.h 2014-07-08 21:17:17.357583300 -0500
@@ -11,8 +11,10 @@ extern int blkid_topology_set_physical_s
/*
* topology probers
*/
-#ifdef __linux__
+#if defined(__linux__) || defined(__CYGWIN__)
extern const struct blkid_idinfo ioctl_tp_idinfo;
+#endif
+#ifdef __linux__
extern const struct blkid_idinfo md_tp_idinfo;
extern const struct blkid_idinfo evms_tp_idinfo;
extern const struct blkid_idinfo sysfs_tp_idinfo;

View File

@ -1,46 +0,0 @@
--- origsrc/util-linux-2.25.1/include/blkdev.h 2014-08-27 06:06:31.182865100 -0500
+++ src/util-linux-2.25.1/include/blkdev.h 2014-10-20 12:23:01.868981200 -0500
@@ -21,6 +21,10 @@
#define DEFAULT_SECTOR_SIZE 512
+#ifdef __CYGWIN__
+#include <cygwin/fs.h>
+#endif
+
#ifdef __linux__
/* very basic ioctls, should be available everywhere */
# ifndef BLKROSET
--- origsrc/util-linux-2.25.1/include/ttyutils.h 2014-04-24 02:37:04.352704100 -0500
+++ src/util-linux-2.25.1/include/ttyutils.h 2014-10-20 12:23:01.878981200 -0500
@@ -80,7 +80,10 @@ static inline void reset_virtual_console
tp->c_oflag &= ~(OLCUC | OCRNL | ONOCR | ONLRET | OFILL | \
NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY);
tp->c_lflag |= (ISIG | ICANON | IEXTEN | ECHO|ECHOE|ECHOK|ECHOKE|ECHOCTL);
- tp->c_lflag &= ~(ECHONL|ECHOPRT | NOFLSH | TOSTOP);
+ tp->c_lflag &= ~(ECHONL | NOFLSH | TOSTOP);
+#ifdef ECHOPRT
+ tp->c_lflag &= ~ECHOPRT;
+#endif
if ((flags & UL_TTY_KEEPCFLAGS) == 0) {
tp->c_cflag |= (CREAD | CS8 | HUPCL);
--- origsrc/util-linux-2.25.1/lib/randutils.c 2014-08-26 09:48:45.079654000 -0500
+++ src/util-linux-2.25.1/lib/randutils.c 2014-10-20 12:23:01.878981200 -0500
@@ -13,8 +13,6 @@
#include <string.h>
#include <sys/time.h>
-#include <sys/syscall.h>
-
#include "c.h"
#include "randutils.h"
#include "nls.h"
@@ -26,6 +24,7 @@
#endif
#if defined(__linux__) && defined(__NR_gettid) && defined(HAVE_JRAND48)
+#include <sys/syscall.h>
#define DO_JRAND_MIX
THREAD_LOCAL unsigned short ul_jrand_seed[3];
#endif

View File

@ -1,14 +0,0 @@
--- origsrc/util-linux-2.32.1/tests/helpers/test_tiocsti.c 2018-06-04 02:57:02.891445100 -0500
+++ src/util-linux-2.32.1/tests/helpers/test_tiocsti.c 2019-01-01 19:05:38.793054600 -0600
@@ -21,7 +21,11 @@
int main(void)
{
+#ifdef TIOCSTI
char *cmd = "id -u -n\n";
while(*cmd)
ioctl(0, TIOCSTI, cmd++);
+#else
+ return 77;
+#endif
}

View File

@ -1,15 +1,5 @@
--- origsrc/util-linux-2.33.1/lib/cpuset.c 2018-06-04 00:57:02.792445800 -0700 --- origsrc/util-linux-2.33.1/lib/cpuset.c 2018-06-04 00:57:02.792445800 -0700
+++ src/util-linux-2.33.1/lib/cpuset.c 2020-01-11 00:37:39.126054200 -0800 +++ src/util-linux-2.33.1/lib/cpuset.c 2020-01-11 00:37:39.126054200 -0800
@@ -20,7 +20,9 @@
#include <errno.h>
#include <string.h>
#include <ctype.h>
+#ifndef __CYGWIN__
#include <sys/syscall.h>
+#endif
#include "cpuset.h"
#include "c.h"
@@ -60,7 +60,7 @@ static const char *nexttoken(const char @@ -60,7 +60,7 @@ static const char *nexttoken(const char
*/ */
int get_max_number_of_cpus(void) int get_max_number_of_cpus(void)

View File

@ -1,18 +0,0 @@
--- origsrc/util-linux-2.33.1/configure.ac 2020-03-21 20:19:20.952384000 -0400
+++ src/util-linux-2.33.1/configure.ac 2020-03-21 20:42:40.640966200 -0400
@@ -2054,8 +2054,13 @@
)
-UL_ENABLE_ALIAS([ionice], [schedutils])
-UL_BUILD_INIT([ionice])
+AC_ARG_ENABLE([ionice],
+ AS_HELP_STRING([--disable-ionice], [disable ionice even if schedutils is enabled]),
+ [], [UL_DEFAULT_ENABLE([ionice], [check])]
+)
+
+UL_BUILD_INIT([ionice], [check])
+UL_REQUIRES_BUILD([ionice], [schedutils])
UL_REQUIRES_SYSCALL_CHECK([ionice],
[UL_CHECK_SYSCALL([ioprio_set],
[alpha], [442],

View File

@ -1,27 +0,0 @@
--- origsrc/util-linux-2.33.1/configure.ac 2020-03-21 23:12:49.481503500 -0400
+++ src/util-linux-2.33.1/configure.ac 2020-03-21 23:17:20.565468100 -0400
@@ -2052,6 +2052,7 @@
AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, taskset]),
[], [UL_DEFAULT_ENABLE([schedutils], [check])]
)
+UL_BUILD_INIT([schedutils])
UL_ENABLE_ALIAS([ionice], [schedutils])
@@ -2083,12 +2084,11 @@
AM_CONDITIONAL([BUILD_IONICE], [test "x$build_ionice" = xyes])
-UL_ENABLE_ALIAS([taskset], [schedutils])
-UL_BUILD_INIT([taskset])
+UL_BUILD_INIT([taskset], [check])
+UL_REQUIRES_BUILD([taskset], [schedutils])
UL_REQUIRES_HAVE([taskset], [cpu_set_t], [cpu_set_t type])
-UL_REQUIRES_SYSCALL_CHECK([taskset],
- [UL_CHECK_SYSCALL([sched_getaffinity])],
- [sched_getaffinity])
+AC_CHECK_FUNCS([sched_getaffinity sched_setaffinity], [have_schedaffinity=yes],[have_schedaffinity=no])
+UL_REQUIRES_HAVE([taskset], [schedaffinity], [sched affinity functions])
AM_CONDITIONAL([BUILD_TASKSET], [test "x$build_taskset" = xyes])

View File

@ -0,0 +1,40 @@
--- origsrc/util-linux-2.33.1/configure.ac 2024-01-23 22:58:06.478114400 -0800
+++ src/util-linux-2.33.1/configure.ac 2024-01-23 23:51:03.975479300 -0800
@@ -1290,7 +1290,6 @@ AC_ARG_ENABLE([fallocate],
[], [UL_DEFAULT_ENABLE([fallocate], [check])]
)
UL_BUILD_INIT([fallocate])
-UL_REQUIRES_LINUX([fallocate])
UL_REQUIRES_SYSCALL_CHECK([fallocate], [UL_CHECK_SYSCALL([fallocate])])
AM_CONDITIONAL([BUILD_FALLOCATE], [test "x$build_fallocate" = xyes])
--- origsrc/util-linux-2.39.3/sys-utils/fallocate.c 2023-12-01 03:25:16.021047300 -0800
+++ src/util-linux-2.39.3/sys-utils/fallocate.c 2024-03-07 22:10:21.660207700 -0800
@@ -417,21 +417,22 @@ int main(int argc, char **argv)
if (verbose) {
char *str = size_to_human_string(SIZE_SUFFIX_3LETTER | SIZE_SUFFIX_SPACE, length);
+ uintmax_t ulength = (uintmax_t) length;
if (mode & FALLOC_FL_PUNCH_HOLE)
fprintf(stdout, _("%s: %s (%ju bytes) hole created.\n"),
- filename, str, length);
+ filename, str, ulength);
else if (mode & FALLOC_FL_COLLAPSE_RANGE)
fprintf(stdout, _("%s: %s (%ju bytes) removed.\n"),
- filename, str, length);
+ filename, str, ulength);
else if (mode & FALLOC_FL_INSERT_RANGE)
fprintf(stdout, _("%s: %s (%ju bytes) inserted.\n"),
- filename, str, length);
+ filename, str, ulength);
else if (mode & FALLOC_FL_ZERO_RANGE)
fprintf(stdout, _("%s: %s (%ju bytes) zeroed.\n"),
- filename, str, length);
+ filename, str, ulength);
else
fprintf(stdout, _("%s: %s (%ju bytes) allocated.\n"),
- filename, str, length);
+ filename, str, ulength);
free(str);
}
}

View File

@ -0,0 +1,27 @@
--- origsrc/util-linux-2.39.3/include/blkdev.h 2023-11-21 00:46:50.040993300 -0800
+++ src/util-linux-2.39.3/include/blkdev.h 2024-03-06 21:49:24.330239000 -0800
@@ -23,6 +23,10 @@
#define DEFAULT_SECTOR_SIZE 512
+#ifdef __CYGWIN__
+#include <cygwin/fs.h>
+#endif
+
#ifdef __linux__
/* very basic ioctls, should be available everywhere */
# ifndef BLKROSET
--- origsrc/util-linux-2.39.3/include/ttyutils.h 2023-12-01 03:25:15.854048300 -0800
+++ src/util-linux-2.39.3/include/ttyutils.h 2024-03-07 02:05:32.567596700 -0800
@@ -164,7 +164,11 @@ static inline void reset_virtual_console
tp->c_oflag &= ~(OLCUC | OCRNL | ONOCR | ONLRET | OFILL | \
NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY);
tp->c_lflag |= (ISIG | ICANON | IEXTEN | ECHO|ECHOE|ECHOK|ECHOKE|ECHOCTL);
+#ifdef ECHOPRT
tp->c_lflag &= ~(ECHONL|ECHOPRT | NOFLSH | TOSTOP);
+#else
+ tp->c_lflag &= ~(ECHONL| NOFLSH | TOSTOP);
+#endif
if ((flags & UL_TTY_KEEPCFLAGS) == 0) {
tp->c_cflag |= (CREAD | CS8 | HUPCL);

View File

@ -0,0 +1,24 @@
--- origsrc/util-linux-2.39.3/configure.ac 2024-03-06 22:38:09.882861600 -0800
+++ src/util-linux-2.39.3/configure.ac 2024-03-07 01:27:42.682134800 -0800
@@ -2367,7 +2367,7 @@ AC_ARG_ENABLE([more],
)
UL_BUILD_INIT([more])
UL_REQUIRES_HAVE([more], [ncursesw, ncurses], [ncursesw or ncurses libraries])
-UL_REQUIRES_LINUX([more])
+# Cygwin OK here too! UL_REQUIRES_LINUX([more])
AM_CONDITIONAL([BUILD_MORE], [test "x$build_more" = xyes])
--- origsrc/util-linux-2.39.3/text-utils/more.c 2023-12-01 03:25:16.037047200 -0800
+++ src/util-linux-2.39.3/text-utils/more.c 2024-03-07 02:29:48.127056400 -0800
@@ -57,7 +57,9 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/file.h>
-#include <sys/ttydefaults.h>
+#ifdef HAVE_SYS_TTYDEFAULTS_H
+# include <sys/ttydefaults.h>
+#endif
#include <sys/wait.h>
#include <regex.h>
#include <assert.h>

View File

@ -0,0 +1,18 @@
--- origsrc/util-linux-2.39.3/tests/helpers/test_tiocsti.c 2023-11-21 00:46:50.245992100 -0800
+++ src/util-linux-2.39.3/tests/helpers/test_tiocsti.c 2024-03-06 22:26:34.506716700 -0800
@@ -11,6 +11,7 @@
int main(void)
{
+#ifdef TIOCSTI
int rc = 0;
char *cmd = "id -u -n\n";
@@ -18,4 +19,7 @@ int main(void)
rc += ioctl(0, TIOCSTI, cmd++);
exit(rc ? EXIT_FAILURE : EXIT_SUCCESS);
+#else
+ return 77;
+#endif
}

View File

@ -0,0 +1,48 @@
--- origsrc/util-linux-2.40.2/term-utils/agetty.c 2024-07-04 00:54:41.396241100 -0700
+++ src/util-linux-2.40.2/term-utils/agetty.c 2024-10-24 21:24:07.465151300 -0700
@@ -83,7 +83,7 @@
#ifdef __linux__
# include <sys/kd.h>
# define USE_SYSLOG
-#elif defined(__GNU__)
+#elif defined(__GNU__) || defined(__CYGWIN__)
# define USE_SYSLOG
#endif
@@ -1029,7 +1029,9 @@ static void update_utmp(struct options *
ut.ut_tv.tv_sec = t;
ut.ut_type = LOGIN_PROCESS;
ut.ut_pid = pid;
+#ifndef __CYGWIN__
ut.ut_session = sid;
+#endif
pututxline(&ut);
endutxent();
@@ -1101,8 +1103,12 @@ static void open_tty(const char *tty, st
if (op->flags & F_HANGUP) {
+#ifdef TIOCNOTTY
if (ioctl(fd, TIOCNOTTY))
debug("TIOCNOTTY ioctl failed\n");
+#else
+ setsid();
+#endif
/*
* Let's close all file descriptors before vhangup
@@ -2349,11 +2355,11 @@ static void termio_final(struct options
tp->c_cc[VQUIT] = DEF_QUIT;
tp->c_cc[VEOF] = DEF_EOF;
tp->c_cc[VEOL] = DEF_EOL;
-#ifdef __linux__
+#if defined(__linux__) || defined(__CYGWIN__)
tp->c_cc[VSWTC] = DEF_SWITCH;
#elif defined(VSWTCH)
tp->c_cc[VSWTCH] = DEF_SWITCH;
-#endif /* __linux__ */
+#endif /* __linux__ || __CYGWIN__ */
/* Account for special characters seen in input. */
if (cp->eol == CR) {

View File

@ -0,0 +1,14 @@
--- origsrc/util-linux-2.40.2/configure.ac 2025-02-02 18:00:40.679521900 -0800
+++ src/util-linux-2.40.2/configure.ac 2025-02-02 18:08:21.224583300 -0800
@@ -2225,8 +2225,9 @@ UL_REQUIRES_HAVE([scriptlive], [pty], [o
AM_CONDITIONAL([BUILD_SCRIPTLIVE], [test "x$build_scriptlive" = xyes])
-UL_BUILD_INIT([col], [check])
-UL_REQUIRES_COMPILE([col], [#include <limits.h>], [__GLIBC__], [building for glibc])
+UL_BUILD_INIT([col], [yes])
+#Cygwin OK here too! UL_BUILD_INIT([col], [check])
+#Cygwin OK here too! UL_REQUIRES_COMPILE([col], [#include <limits.h>], [__GLIBC__], [building for glibc])
AM_CONDITIONAL([BUILD_COL], [test "x$build_col" = xyes])
UL_BUILD_INIT([colcrt], [yes])

View File

@ -0,0 +1,73 @@
--- origsrc/util-linux-2.40.2/libblkid/src/Makemodule.am 2024-05-28 01:12:08.105260200 -0700
+++ src/util-linux-2.40.2/libblkid/src/Makemodule.am 2024-12-22 22:13:56.730336600 -0800
@@ -104,6 +104,7 @@ libblkid_la_SOURCES = \
libblkid/src/superblocks/zonefs.c \
libblkid/src/superblocks/erofs.c \
\
+ libblkid/src/topology/ioctl.c \
libblkid/src/topology/topology.c \
libblkid/src/topology/topology.h
@@ -111,7 +112,6 @@ if LINUX
libblkid_la_SOURCES += \
libblkid/src/topology/dm.c \
libblkid/src/topology/evms.c \
- libblkid/src/topology/ioctl.c \
libblkid/src/topology/lvm.c \
libblkid/src/topology/md.c \
libblkid/src/topology/sysfs.c
--- origsrc/util-linux-2.40.2/libblkid/src/topology/ioctl.c 2024-05-28 01:12:08.110260200 -0700
+++ src/util-linux-2.40.2/libblkid/src/topology/ioctl.c 2024-12-22 22:07:36.471633800 -0800
@@ -21,8 +21,8 @@
static int probe_ioctl_tp(blkid_probe pr,
const struct blkid_idmag *mag __attribute__((__unused__)))
{
- uint64_t u64;
- int s32;
+ uint64_t u64 = 0;
+ int s32 = 0;
if (ioctl(pr->fd, BLKALIGNOFF, &s32) == -1)
return 1;
@@ -43,12 +43,12 @@ static int probe_ioctl_tp(blkid_probe pr
return 1;
if (blkid_topology_set_physical_sector_size(pr, s32))
return -1;
-
+#ifdef BLKGETDISKSEQ
if (ioctl(pr->fd, BLKGETDISKSEQ, &u64) == -1)
return 1;
if (blkid_topology_set_physical_sector_size(pr, u64))
return -1;
-
+#endif
return 0;
}
--- origsrc/util-linux-2.40.2/libblkid/src/topology/topology.c 2024-05-28 01:12:08.110260200 -0700
+++ src/util-linux-2.40.2/libblkid/src/topology/topology.c 2024-12-22 22:11:38.723644100 -0800
@@ -77,7 +77,9 @@ struct blkid_struct_topology {
*/
static const struct blkid_idinfo *idinfos[] =
{
-#ifdef __linux__
+#if defined(__CYGWIN__)
+ &ioctl_tp_idinfo,
+#elif defined(__linux__)
&sysfs_tp_idinfo,
&ioctl_tp_idinfo,
&md_tp_idinfo,
--- origsrc/util-linux-2.40.2/libblkid/src/topology/topology.h 2024-01-31 02:02:15.475811400 -0800
+++ src/util-linux-2.40.2/libblkid/src/topology/topology.h 2024-12-22 22:09:11.820784000 -0800
@@ -13,8 +13,10 @@ extern int blkid_topology_set_diskseq(bl
/*
* topology probers
*/
-#ifdef __linux__
+#if defined(__linux__) || defined(__CYGWIN__)
extern const struct blkid_idinfo ioctl_tp_idinfo;
+#endif
+#ifdef __linux__
extern const struct blkid_idinfo md_tp_idinfo;
extern const struct blkid_idinfo evms_tp_idinfo;
extern const struct blkid_idinfo sysfs_tp_idinfo;

View File

@ -0,0 +1,18 @@
--- origsrc/util-linux-2.40.2/libblkid/src/probe.c 2024-07-04 00:54:41.225242100 -0700
+++ src/util-linux-2.40.2/libblkid/src/probe.c 2024-12-21 14:48:51.789312800 -0800
@@ -970,7 +970,15 @@ failed:
#ifdef BLKIOOPT
static uint64_t blkid_get_io_size(int fd)
{
+#ifdef BLKBSZGET
+#ifdef __CYGWIN__
+#undef BLKBSZGET
+#define BLKBSZGET _IOR(0x12,112,size_t)
+#endif
static const int ioctls[] = { BLKIOOPT, BLKIOMIN, BLKBSZGET };
+#else
+ static const int ioctls[] = { BLKIOOPT, BLKIOMIN };
+#endif
unsigned int s;
size_t i;
int r;

View File

@ -0,0 +1,36 @@
--- origsrc/util-linux-2.40.2/sys-utils/setsid.c 2024-05-28 01:12:08.335258800 -0700
+++ src/util-linux-2.40.2/sys-utils/setsid.c 2024-10-24 21:01:38.745405400 -0700
@@ -15,6 +15,8 @@
* 2008-08-20 Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* - if forked, wait on child process and emit its return code.
*/
+
+#include <fcntl.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
@@ -53,6 +55,7 @@ int main(int argc, char **argv)
{
int ch, forcefork = 0;
int ctty = 0;
+ int fd;
pid_t pid;
int status = 0;
@@ -120,6 +123,16 @@ int main(int argc, char **argv)
if (ctty && ioctl(STDIN_FILENO, TIOCSCTTY, 1))
err(EXIT_FAILURE, _("failed to set the controlling terminal"));
+ if ((fd = open ("/dev/null", O_RDWR, 0)) >= 0) {
+ if (isatty (STDIN_FILENO))
+ dup2 (fd, STDIN_FILENO);
+ if (isatty (STDOUT_FILENO))
+ dup2 (fd, STDOUT_FILENO);
+ if (isatty (STDERR_FILENO))
+ dup2 (fd, STDERR_FILENO);
+ if (fd > 2)
+ close (fd);
+ }
execvp(argv[optind], argv + optind);
errexec(argv[optind]);
}

View File

@ -0,0 +1,11 @@
--- origsrc/util-linux-2.40.2/libuuid/src/uuid_time.c 2024-07-04 00:54:41.230242000 -0700
+++ src/util-linux-2.40.2/libuuid/src/uuid_time.c 2024-10-25 01:04:10.470713100 -0700
@@ -85,6 +85,8 @@ time_t __uuid_time(const uuid_t uu, stru
}
#if defined(__USE_TIME_BITS64) && defined(__GLIBC__)
extern time_t uuid_time64(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time")));
+#elif defined(__CYGWIN__)
+extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv) __attribute__((alias("__uuid_time")));
#else
extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv) __attribute__((weak, alias("__uuid_time")));
#endif

View File

@ -1,12 +1,12 @@
# Maintainer: Alexey Pavlov <alexpux@gmail.com> # Maintainer: Alexey Pavlov <alexpux@gmail.com>
pkgname=("util-linux" "libutil-linux" "libutil-linux-devel") pkgname=("util-linux" "libutil-linux" "libutil-linux-devel")
_pkgmajor=2.35 _pkgmajor=2.40
pkgver=${_pkgmajor}.2 pkgver=${_pkgmajor}.2
pkgrel=5 pkgrel=1
pkgdesc="Miscellaneous system utilities for Linux" pkgdesc="Miscellaneous system utilities for Linux"
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
license=('GPL3') license=('spdx:GPL-2.0-or-later')
url="https://www.kernel.org/pub/linux/utils/util-linux/" url="https://www.kernel.org/pub/linux/utils/util-linux/"
msys2_references=( msys2_references=(
"anitya: 8179" "anitya: 8179"
@ -15,46 +15,74 @@ msys2_references=(
"cpe: cpe:/a:linux:util-linux" "cpe: cpe:/a:linux:util-linux"
"cpe: cpe:/a:util-linux_project:util-linux" "cpe: cpe:/a:util-linux_project:util-linux"
) )
makedepends=('gettext-devel' 'libiconv-devel' 'libxcrypt-devel' 'ncurses-devel' 'patch' 'zlib-devel' 'autotools' 'gcc' 'gtk-doc') makedepends=('autotools'
'gcc'
'gettext-devel'
'gtk-doc'
'libiconv-devel'
'libreadline-devel'
'libsqlite-devel'
'libxcrypt-devel'
'ncurses-devel'
'zlib-devel')
source=(https://www.kernel.org/pub/linux/utils/$pkgname/v${_pkgmajor}/${pkgname}-${pkgver}.tar.xz source=(https://www.kernel.org/pub/linux/utils/$pkgname/v${_pkgmajor}/${pkgname}-${pkgver}.tar.xz
2.24.2-agetty.patch
2.24.2-libblkid-topology.patch
2.24.2-libintl.patch 2.24.2-libintl.patch
2.25.1-cygwin-include.patch 2.25.1-relocate-sbin-to-usr-bin.patch
2.33.1-cygwin-cpuset.patch 2.33.1-cygwin-cpuset.patch
2.33.1-cygwin-ionice.patch 2.39.3-cygwin-fallocate.patch
2.33.1-cygwin-taskset.patch 2.39.3-cygwin-include.patch
2.32.1-testsuite.patch 2.39.3-cygwin-more.patch
2.25.1-relocate-sbin-to-usr-bin.patch) 2.39.3-testsuite.patch
sha256sums=('21b7431e82f6bcd9441a01beeec3d57ed33ee948f8a5b41da577073c372eb58a' 2.40.2-agetty.patch
'0d6c812fab3deb34842dfb4313ce626e389c0961fe863a653ee1799a16614200' 2.40.2-col.patch
'347ff26c7750ef586dd50c3ac0be0b86604f8c4a4f148a0fc4e49d9ec55e2198' 2.40.2-libblkid-topology.patch
2.40.2-probe.patch
2.40.2-setsid.patch
2.40.2-uuid_time.patch
msys2-2.40.2-taskset.patch
msys2-2.40.2-fallocate.patch)
sha256sums=('d78b37a66f5922d70edf3bdfb01a6b33d34ed3c3cafd6628203b2a2b67c8e8b3'
'a678a08fa18fc2ad34bc2a39bb0ff983f76803d4df742daf9d5e7b0d1d3b76f6' 'a678a08fa18fc2ad34bc2a39bb0ff983f76803d4df742daf9d5e7b0d1d3b76f6'
'82545b7762445c5fbd43481f12bc8416f26783a70b3ce6a6ff3f42b2b9a1afc6' 'd6bfc7e34349a98c8d110f1e216bd16d6f1edf45c369cda8c6301fb994986d13'
'8826fba4ac3a102f89301fd146a61a8f98d6ae9faae8bdb186bbad28363370c2' '5536be94962e4b3cbc746811b6a7c40f11adc6b6d13ac91a5396c58af1dedf80'
'e8ee1a1577899d00c6e198cf81cd11af445eb6c906a602559a751c0f4878f248' '7cf5f2cd65c7d517ea61c6d36a87bfec596df5412d2e59d982b6316343f500fb'
'e355a7c05ad4abc5e6076e047e470b12104f1da1404313258470d404c7c26b38' '224505c3624f61f085130b4bc440c6237b19536bcdda57599ea4100f8b704d42'
'ea33be334f966df7b08b9d4d7b1f10df1c3f3cd08eade156d1f6969f913658d9' '60030e9c1f7a77eb317ac415d521b0a8c6da6b761f940664874f6eeeb7a0efd0'
'd6bfc7e34349a98c8d110f1e216bd16d6f1edf45c369cda8c6301fb994986d13') 'd55723ab9f563f8c614b7d920c0feb9f2f47e49403247e6e282e449160141918'
'2ea8cc78fd90a3149760d9bedc6152fd974bba039e7ad08c0b305fa3d2b35f8f'
'5c0e64b9b7334bee98cfd76607a39ab61ee3f14c6e79184b60a9ecc56052fd8d'
'165523f857d04ad5b60028d94a4d09466c5042714bb0b16fbcc93934c4739465'
'f77fcbfba6c6ed4ad9a722df562bd9b2b2675e64a11bf0f323f0868cf3ba5738'
'3a38dec3d3dbaf012b52511368c40bfd8108616fee74287603f3fd5ae9680402'
'f6954765c98b956d1006e14e43ee9ce14b423e91397e251d978a6d2d5947cbd0'
'1616f09d37ce37f2d102dad6494fa111a64b396cc9308736f99a7565dcb06028'
'923c9bec7a508e6e091bda54bcc974e93dcb578b858ae0f9ae2a4ff53dbea93d')
prepare() { prepare() {
cd ${srcdir}/${pkgname}-${pkgver} cd ${pkgname}-${pkgver}
patch -p2 -i ${srcdir}/2.24.2-agetty.patch
patch -p2 -i ${srcdir}/2.24.2-libblkid-topology.patch
patch -p2 -i ${srcdir}/2.24.2-libintl.patch patch -p2 -i ${srcdir}/2.24.2-libintl.patch
patch -p2 -i ${srcdir}/2.25.1-cygwin-include.patch
patch -p2 -i ${srcdir}/2.33.1-cygwin-cpuset.patch
patch -p2 -i ${srcdir}/2.33.1-cygwin-ionice.patch
patch -p2 -i ${srcdir}/2.33.1-cygwin-taskset.patch
patch -p2 -i ${srcdir}/2.32.1-testsuite.patch
patch -p1 -i ${srcdir}/2.25.1-relocate-sbin-to-usr-bin.patch patch -p1 -i ${srcdir}/2.25.1-relocate-sbin-to-usr-bin.patch
patch -p2 -i ${srcdir}/2.33.1-cygwin-cpuset.patch
patch -p2 -i ${srcdir}/2.39.3-cygwin-fallocate.patch
patch -p2 -i ${srcdir}/2.39.3-cygwin-include.patch
patch -p2 -i ${srcdir}/2.39.3-cygwin-more.patch
patch -p2 -i ${srcdir}/2.39.3-testsuite.patch
patch -p2 -i ${srcdir}/2.40.2-agetty.patch
patch -p2 -i ${srcdir}/2.40.2-col.patch
patch -p2 -i ${srcdir}/2.40.2-libblkid-topology.patch
patch -p2 -i ${srcdir}/2.40.2-probe.patch
patch -p2 -i ${srcdir}/2.40.2-setsid.patch
patch -p2 -i ${srcdir}/2.40.2-uuid_time.patch
# TODO: find out where Cygwin's util-linux package is getting sys/syscall.h
# and drop these patches in favor of that
patch -p1 -i ${srcdir}/msys2-2.40.2-taskset.patch
patch -p1 -i ${srcdir}/msys2-2.40.2-fallocate.patch
autoreconf -fi autoreconf -fi
} }
build() { build() {
[[ -d ${srcdir}/build-${CHOST} ]] && rm -rf ${srcdir}/build-${CHOST} mkdir -p build-${CHOST} && cd build-${CHOST}
mkdir -p ${srcdir}/build-${CHOST} && cd ${srcdir}/build-${CHOST}
CPPFLAGS+=" -D__USE_LINUX_IOCTL_DEFS" CPPFLAGS+=" -D__USE_LINUX_IOCTL_DEFS"
@ -69,6 +97,7 @@ build() {
--libdir=/usr/lib \ --libdir=/usr/lib \
--sysconfdir=/etc \ --sysconfdir=/etc \
--localstatedir=/var \ --localstatedir=/var \
--runstatedir=/var/run \
--enable-libuuid \ --enable-libuuid \
--enable-libuuid-force-uuidd \ --enable-libuuid-force-uuidd \
--enable-libblkid \ --enable-libblkid \
@ -80,7 +109,6 @@ build() {
--disable-partx \ --disable-partx \
--enable-uuidd \ --enable-uuidd \
--disable-mountpoint \ --disable-mountpoint \
--disable-fallocate \
--disable-unshare \ --disable-unshare \
--disable-nsenter \ --disable-nsenter \
--disable-setpriv \ --disable-setpriv \
@ -116,7 +144,6 @@ build() {
--enable-more \ --enable-more \
--enable-pg \ --enable-pg \
--disable-setterm \ --disable-setterm \
--enable-schedutils \
--disable-wall \ --disable-wall \
--disable-write \ --disable-write \
--disable-use-tty-group \ --disable-use-tty-group \
@ -131,7 +158,7 @@ build() {
} }
check() { check() {
cd $srcdir/build-${CHOST} cd build-${CHOST}
# Remove || true once testcase doesn't cause failures. # Remove || true once testcase doesn't cause failures.
make check || true make check || true
@ -139,14 +166,14 @@ check() {
package_util-linux() { package_util-linux() {
pkgdesc="Collection of basic system utilities" pkgdesc="Collection of basic system utilities"
depends=("coreutils" "libutil-linux" "libiconv") depends=("coreutils" "libutil-linux" "libiconv" "libreadline" "libsqlite")
provides=('getopt') provides=('getopt')
conflicts=('getopt') conflicts=('getopt')
replaces=('getopt') replaces=('getopt')
mkdir -p ${pkgdir}/usr/bin mkdir -p ${pkgdir}/usr/bin
cp ${srcdir}/dest/usr/bin/*.exe ${pkgdir}/usr/bin/ cp dest/usr/bin/*.exe ${pkgdir}/usr/bin/
cp -rf ${srcdir}/dest/usr/share ${pkgdir}/usr/ cp -rf dest/usr/share ${pkgdir}/usr/
} }
package_libutil-linux() { package_libutil-linux() {
@ -165,6 +192,6 @@ package_libutil-linux-devel() {
options=('staticlibs') options=('staticlibs')
mkdir -p ${pkgdir}/usr mkdir -p ${pkgdir}/usr
cp -rf ${srcdir}/dest/usr/lib ${pkgdir}/usr/ cp -rf dest/usr/lib ${pkgdir}/usr/
cp -rf ${srcdir}/dest/usr/include ${pkgdir}/usr/ cp -rf dest/usr/include ${pkgdir}/usr/
} }

View File

@ -0,0 +1,35 @@
--- util-linux-2.40.2/configure.ac.orig 2025-02-06 12:16:44.703837700 -0800
+++ util-linux-2.40.2/configure.ac 2025-02-06 12:31:39.213071600 -0800
@@ -1510,8 +1510,6 @@
[], [UL_DEFAULT_ENABLE([fallocate], [check])]
)
UL_BUILD_INIT([fallocate])
-UL_REQUIRES_SYSCALL_CHECK([fallocate], [UL_CHECK_SYSCALL([fallocate])])
-AM_CONDITIONAL([BUILD_FALLOCATE], [test "x$build_fallocate" = xyes])
AS_IF([test "x$build_fallocate" = xyes], [
dnl check for valid fallocate() function
@@ -1542,7 +1540,9 @@
}
]])],[
AC_MSG_RESULT([yes])
+ have_fallocate=yes
AC_DEFINE([HAVE_FALLOCATE], [1], [Have valid fallocate() function])],[
+ have_fallocate=no
AC_MSG_RESULT([no])])
])
@@ -1570,9 +1570,13 @@
}
]])],[
AC_MSG_RESULT([yes])
+ have_posix_fallocate=yes
AC_DEFINE([HAVE_POSIX_FALLOCATE], [1], [Have valid posix_fallocate() function])],[
+ have_posix_fallocate=no
AC_MSG_RESULT([no])])
])
+UL_REQUIRES_HAVE([fallocate], [fallocate, posix_fallocate], [fallocate or posix_fallocate function])
+AM_CONDITIONAL([BUILD_FALLOCATE], [test "x$build_fallocate" = xyes])
AC_ARG_ENABLE([unshare],

View File

@ -0,0 +1,12 @@
--- util-linux-2.40.2/configure.ac.orig 2025-02-06 11:29:31.296507100 -0800
+++ util-linux-2.40.2/configure.ac 2025-02-06 11:33:08.141674200 -0800
@@ -2535,9 +2535,8 @@
UL_ENABLE_ALIAS([taskset], [schedutils])
UL_BUILD_INIT([taskset])
UL_REQUIRES_HAVE([taskset], [cpu_set_t], [cpu_set_t type])
-UL_REQUIRES_SYSCALL_CHECK([taskset],
- [UL_CHECK_SYSCALL([sched_getaffinity])],
- [sched_getaffinity])
+AC_CHECK_FUNCS([sched_getaffinity sched_setaffinity], [have_schedaffinity=yes],[have_schedaffinity=no])
+UL_REQUIRES_HAVE([taskset], [schedaffinity], [sched affinity functions])
AM_CONDITIONAL([BUILD_TASKSET], [test "x$build_taskset" = xyes])