diff options
Diffstat (limited to 'debian/patches')
-rw-r--r-- | debian/patches/61_whoips.patch | 130 | ||||
-rw-r--r-- | debian/patches/63_dd-appenderrors.patch | 16 | ||||
-rw-r--r-- | debian/patches/72_id_checkngroups.patch | 17 | ||||
-rw-r--r-- | debian/patches/85_timer_settime.patch | 28 | ||||
-rw-r--r-- | debian/patches/99_kfbsd_fstat_patch.patch | 22 | ||||
-rw-r--r-- | debian/patches/prefer-renameat2-from-glibc-over-syscall.patch | 52 | ||||
-rw-r--r-- | debian/patches/renameatu.patch | 94 | ||||
-rw-r--r-- | debian/patches/series | 7 |
8 files changed, 366 insertions, 0 deletions
diff --git a/debian/patches/61_whoips.patch b/debian/patches/61_whoips.patch new file mode 100644 index 0000000..382ba4d --- /dev/null +++ b/debian/patches/61_whoips.patch @@ -0,0 +1,130 @@ +Author: +Description: +Index: coreutils-8.24/src/who.c +=================================================================== +--- coreutils-8.24.orig/src/who.c ++++ coreutils-8.24/src/who.c +@@ -28,6 +28,8 @@ + #include <assert.h> + + #include <sys/types.h> ++#include <sys/socket.h> ++#include <netdb.h> + #include "system.h" + + #include "c-ctype.h" +@@ -101,6 +103,9 @@ char *ttyname (int); + /* If true, attempt to canonicalize hostnames via a DNS lookup. */ + static bool do_lookup; + ++/* If true, display ips instead of hostnames */ ++static bool do_ips; ++ + /* If true, display only a list of usernames and count of + the users logged on. + Ignored for 'who am i'. */ +@@ -156,7 +161,8 @@ static int time_format_width; + /* for long options with no corresponding short option, use enum */ + enum + { +- LOOKUP_OPTION = CHAR_MAX + 1 ++ LOOKUP_OPTION = CHAR_MAX + 1, ++ IPS_OPTION = CHAR_MAX + 2 + }; + + static struct option const longopts[] = +@@ -166,6 +172,7 @@ static struct option const longopts[] = + {"count", no_argument, NULL, 'q'}, + {"dead", no_argument, NULL, 'd'}, + {"heading", no_argument, NULL, 'H'}, ++ {"ips", no_argument, NULL, IPS_OPTION}, + {"login", no_argument, NULL, 'l'}, + {"lookup", no_argument, NULL, LOOKUP_OPTION}, + {"message", no_argument, NULL, 'T'}, +@@ -428,6 +435,63 @@ print_user (const STRUCT_UTMP *utmp_ent, + } + #endif + ++ /* Needs configure check for ut_addr_v6, etc */ ++ if (do_ips && ++ memcmp(utmp_ent->ut_addr_v6, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16)) ++ { ++ /* Following code is from sysvinit-2.87dsf ++ (GPL Copyright 1991-2004 Miquel van Smoorenburg) */ ++ struct sockaddr_in sin; ++ struct sockaddr_in6 sin6; ++ struct sockaddr *sa; ++ int salen, flags; ++ unsigned int azero=0; ++ unsigned int glblunicast=0, linklocal=0, localunicast=0; ++ int mapped = 0; ++ int *a = utmp_ent->ut_addr_v6; ++ ++ hoststr = xrealloc(hoststr, 256); ++ ++ flags = do_lookup ? 0 : NI_NUMERICHOST; ++ ++ /* ++ * IPv4 or IPv6 ? We use 2 heuristics: ++ * 1. Current IPv6 range uses 2000-3fff or fc00-fdff or fec0-feff. ++ * Outside of that is illegal and must be IPv4. ++ * 2. If last 3 bytes are 0, must be IPv4 ++ * 3. If IPv6 in IPv4, handle as IPv4 ++ * ++ * Ugly. ++ */ ++ if (a[0] == 0 && a[1] == 0 && a[2] == htonl (0xffff)) ++ mapped = 1; ++ ++ azero = ntohl((unsigned int)a[0]) >> 16; ++ glblunicast = (azero >= 0x2000 && azero <= 0x3fff) ? 1 : 0; ++ localunicast = (azero >= 0xfc00 && azero <= 0xfdff) ? 1 : 0; ++ linklocal = (azero >= 0xfec0 && azero <= 0xfeff) ? 1 : 0; ++ ++ if (!(glblunicast || linklocal || localunicast) || mapped || ++ (a[1] == 0 && a[2] == 0 && a[3] == 0)) { ++ /* IPv4 */ ++ sin.sin_family = AF_INET; ++ sin.sin_port = 0; ++ sin.sin_addr.s_addr = mapped ? a[3] : a[0]; ++ sa = (struct sockaddr *)&sin; ++ salen = sizeof(sin); ++ } else { ++ /* IPv6 */ ++ memset(&sin6, 0, sizeof(sin6)); ++ sin6.sin6_family = AF_INET6; ++ sin6.sin6_port = 0; ++ memcpy(sin6.sin6_addr.s6_addr, a, 16); ++ sa = (struct sockaddr *)&sin6; ++ salen = sizeof(sin6); ++ } ++ ++ getnameinfo(sa, salen, hoststr, 256, NULL, 0, flags); ++ } ++ + print_line (sizeof UT_USER (utmp_ent), UT_USER (utmp_ent), mesg, + sizeof utmp_ent->ut_line, utmp_ent->ut_line, + time_string (utmp_ent), idlestr, pidstr, +@@ -649,6 +713,11 @@ Print information about users who are cu + -H, --heading print line of column headings\n\ + "), stdout); + fputs (_("\ ++ --ips print ips instead of hostnames. with --lookup,\n\ ++ canonicalizes based on stored IP, if available,\n\ ++ rather than stored hostname\n\ ++"), stdout); ++ fputs (_("\ + -l, --login print system login processes\n\ + "), stdout); + fputs (_("\ +@@ -778,6 +847,10 @@ main (int argc, char **argv) + do_lookup = true; + break; + ++ case IPS_OPTION: ++ do_ips = true; ++ break; ++ + case_GETOPT_HELP_CHAR; + + case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); diff --git a/debian/patches/63_dd-appenderrors.patch b/debian/patches/63_dd-appenderrors.patch new file mode 100644 index 0000000..502f082 --- /dev/null +++ b/debian/patches/63_dd-appenderrors.patch @@ -0,0 +1,16 @@ +Author: +Description: +Index: coreutils-8.24/src/dd.c +=================================================================== +--- coreutils-8.24.orig/src/dd.c ++++ coreutils-8.24/src/dd.c +@@ -1525,6 +1525,9 @@ scanargs (int argc, char *const *argv) + if (multiple_bits_set (input_flags & (O_DIRECT | O_NOCACHE)) + || multiple_bits_set (output_flags & (O_DIRECT | O_NOCACHE))) + die (EXIT_FAILURE, 0, _("cannot combine direct and nocache")); ++ if ((output_flags & O_APPEND) && ++ ((conversions_mask & C_NOTRUNC) != C_NOTRUNC)) ++ error (0, 0, _("you probably want conv=notrunc with oflag=append")); + + if (input_flags & O_NOCACHE) + { diff --git a/debian/patches/72_id_checkngroups.patch b/debian/patches/72_id_checkngroups.patch new file mode 100644 index 0000000..a2e0bec --- /dev/null +++ b/debian/patches/72_id_checkngroups.patch @@ -0,0 +1,17 @@ +Author: +Description: +Index: coreutils-8.24/src/id.c +=================================================================== +--- coreutils-8.24.orig/src/id.c ++++ coreutils-8.24/src/id.c +@@ -416,6 +416,10 @@ print_full_info (const char *username) + ok = false; + return; + } ++ else if (sysconf(_SC_NGROUPS_MAX) > 0 && n_groups > sysconf(_SC_NGROUPS_MAX)) ++ { ++ fprintf (stderr, _("Warning: user %s is in more groups than system's configured maximum.\n"), (username != NULL)?username:""); ++ } + + if (n_groups > 0) + fputs (_(" groups="), stdout); diff --git a/debian/patches/85_timer_settime.patch b/debian/patches/85_timer_settime.patch new file mode 100644 index 0000000..c2b2fd1 --- /dev/null +++ b/debian/patches/85_timer_settime.patch @@ -0,0 +1,28 @@ +Author: <mstone@debian.org> +Description: timeout ignores fractional part of sleep times when timeout is more +than 100000s (approximately 1 day) on kfbsd. prevents failure modes +in libc implementation when timeout approaches max(time_t) +Index: coreutils-8.24/src/timeout.c +=================================================================== +--- coreutils-8.24.orig/src/timeout.c ++++ coreutils-8.24/src/timeout.c +@@ -133,6 +133,11 @@ settimeout (double duration, bool warn) + resolution provided by alarm(). */ + + #if HAVE_TIMER_SETTIME ++#ifdef __FreeBSD_kernel__ ++if (duration < 100000) { ++#else ++if (true) { ++#endif + struct timespec ts = dtotimespec (duration); + struct itimerspec its = { {0, 0}, ts }; + timer_t timerid; +@@ -149,6 +154,7 @@ settimeout (double duration, bool warn) + } + else if (warn && errno != ENOSYS) + error (0, errno, _("warning: timer_create")); ++} + #endif + + unsigned int timeint; diff --git a/debian/patches/99_kfbsd_fstat_patch.patch b/debian/patches/99_kfbsd_fstat_patch.patch new file mode 100644 index 0000000..fa11942 --- /dev/null +++ b/debian/patches/99_kfbsd_fstat_patch.patch @@ -0,0 +1,22 @@ +Author: Michael Stone <mstone@debian.org> +Description: No description. +Index: coreutils-8.24/lib/fstatat.c +=================================================================== +--- coreutils-8.24.orig/lib/fstatat.c ++++ coreutils-8.24/lib/fstatat.c +@@ -132,4 +132,15 @@ stat_func (char const *name, struct stat + # undef AT_FUNC_POST_FILE_PARAM_DECLS + # undef AT_FUNC_POST_FILE_ARGS + ++#ifdef __FreeBSD_kernel__ ++ ++int __fxstatat(int version, int fd, const char *file, struct stat *st, int flag) ++{ ++ typedef int (*tp)(int, const char *, struct stat *, int); ++ volatile tp f = fstatat; ++ return f(fd, file, st, flag); ++} ++ ++#endif ++ + #endif /* !HAVE_FSTATAT */ diff --git a/debian/patches/prefer-renameat2-from-glibc-over-syscall.patch b/debian/patches/prefer-renameat2-from-glibc-over-syscall.patch new file mode 100644 index 0000000..cf5e1ac --- /dev/null +++ b/debian/patches/prefer-renameat2-from-glibc-over-syscall.patch @@ -0,0 +1,52 @@ +From: Johannes 'josch' Schauer <josch@debian.org> +Date: Tue, 4 Dec 2018 20:57:48 +0100 +X-Dgit-Generated: 8.30-1.1 2474a66055eceaf668b315d83ae7b0ae7bf9a4d5 +Subject: Prefer renameat2 from glibc over syscall if available + +This is necessary for fakechroot to be able to overwrite renameat2 which +is used by mv(1) from coreutils. See #909612 + +This patch is based on a patch by Andreas Henriksson <andreas@fatal.se> +which was accepted in gnulib git: + +https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=c50cf67bd7ff70525f3cb4074f0d9cc1f5c6cf9c + +--- + +--- coreutils-8.30.orig/lib/config.hin ++++ coreutils-8.30/lib/config.hin +@@ -2069,6 +2069,9 @@ + /* Define to 1 if you have the `renameat' function. */ + #undef HAVE_RENAMEAT + ++/* Define to 1 if you have the `renameat2' function. */ ++#undef HAVE_RENAMEAT2 ++ + /* Define to 1 if you have the `rewinddir' function. */ + #undef HAVE_REWINDDIR + +--- coreutils-8.30.orig/lib/renameat2.c ++++ coreutils-8.30/lib/renameat2.c +@@ -77,7 +77,10 @@ renameat2 (int fd1, char const *src, int + int ret_val = -1; + int err = EINVAL; + +-#ifdef SYS_renameat2 ++#if HAVE_RENAMEAT2 ++ ret_val = renameat2 (fd1, src, fd2, dst, flags); ++ err = errno; ++#elif defined SYS_renameat2 + ret_val = syscall (SYS_renameat2, fd1, src, fd2, dst, flags); + err = errno; + #elif defined RENAME_EXCL +--- coreutils-8.30.orig/m4/renameat.m4 ++++ coreutils-8.30/m4/renameat.m4 +@@ -15,7 +15,7 @@ AC_DEFUN([gl_FUNC_RENAMEAT], + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_HEADERS([linux/fs.h]) +- AC_CHECK_FUNCS_ONCE([renameat]) ++ AC_CHECK_FUNCS_ONCE([renameat renameat2]) + if test $ac_cv_func_renameat = no; then + HAVE_RENAMEAT=0 + elif test $REPLACE_RENAME = 1; then diff --git a/debian/patches/renameatu.patch b/debian/patches/renameatu.patch new file mode 100644 index 0000000..3b708a8 --- /dev/null +++ b/debian/patches/renameatu.patch @@ -0,0 +1,94 @@ +From: Johannes 'josch' Schauer <josch@debian.org> +Date: Mon, 31 Dec 2018 11:03:58 +0100 +X-Dgit-Generated: 8.30-1.1 8209088c5a946519942aba2b13200c8d09b14c91 +Subject: renameatu + + +--- + +Index: coreutils-8.30/lib/backupfile.c +=================================================================== +--- coreutils-8.30.orig/lib/backupfile.c 2018-05-14 00:20:31.000000000 -0400 ++++ coreutils-8.30/lib/backupfile.c 2019-02-28 10:26:05.000000000 -0500 +@@ -353,7 +353,7 @@ + base_offset = 0; + } + unsigned flags = backup_type == simple_backups ? 0 : RENAME_NOREPLACE; +- if (renameat2 (AT_FDCWD, file, sdir, s + base_offset, flags) == 0) ++ if (renameatu (AT_FDCWD, file, sdir, s + base_offset, flags) == 0) + break; + int e = errno; + if (e != EEXIST) +Index: coreutils-8.30/lib/renameat.c +=================================================================== +--- coreutils-8.30.orig/lib/renameat.c 2018-05-14 00:20:31.000000000 -0400 ++++ coreutils-8.30/lib/renameat.c 2019-02-28 10:26:05.000000000 -0500 +@@ -21,5 +21,5 @@ + int + renameat (int fd1, char const *src, int fd2, char const *dst) + { +- return renameat2 (fd1, src, fd2, dst, 0); ++ return renameatu (fd1, src, fd2, dst, 0); + } +Index: coreutils-8.30/lib/renameat2.c +=================================================================== +--- coreutils-8.30.orig/lib/renameat2.c 2019-02-28 10:26:05.000000000 -0500 ++++ coreutils-8.30/lib/renameat2.c 2019-02-28 10:26:05.000000000 -0500 +@@ -71,7 +71,7 @@ + function is equivalent to renameat (FD1, SRC, FD2, DST). */ + + int +-renameat2 (int fd1, char const *src, int fd2, char const *dst, ++renameatu (int fd1, char const *src, int fd2, char const *dst, + unsigned int flags) + { + int ret_val = -1; +Index: coreutils-8.30/lib/renameat2.h +=================================================================== +--- coreutils-8.30.orig/lib/renameat2.h 2018-05-14 00:20:31.000000000 -0400 ++++ coreutils-8.30/lib/renameat2.h 2019-02-28 10:26:05.000000000 -0500 +@@ -27,4 +27,4 @@ + # define RENAME_WHITEOUT (1 << 2) + #endif + +-extern int renameat2 (int, char const *, int, char const *, unsigned int); ++extern int renameatu (int, char const *, int, char const *, unsigned int); +Index: coreutils-8.30/src/copy.c +=================================================================== +--- coreutils-8.30.orig/src/copy.c 2018-06-30 22:32:02.000000000 -0400 ++++ coreutils-8.30/src/copy.c 2019-02-28 10:27:15.286392764 -0500 +@@ -1873,7 +1873,7 @@ + if (x->move_mode) + { + if (rename_errno < 0) +- rename_errno = (renameat2 (AT_FDCWD, src_name, AT_FDCWD, dst_name, ++ rename_errno = (renameatu (AT_FDCWD, src_name, AT_FDCWD, dst_name, + RENAME_NOREPLACE) + ? errno : 0); + new_dst = rename_errno == 0; +Index: coreutils-8.30/src/mv.c +=================================================================== +--- coreutils-8.30.orig/src/mv.c 2018-06-23 22:12:51.000000000 -0400 ++++ coreutils-8.30/src/mv.c 2019-02-28 10:27:45.758636551 -0500 +@@ -456,7 +456,7 @@ + { + assert (2 <= n_files); + if (n_files == 2) +- x.rename_errno = (renameat2 (AT_FDCWD, file[0], AT_FDCWD, file[1], ++ x.rename_errno = (renameatu (AT_FDCWD, file[0], AT_FDCWD, file[1], + RENAME_NOREPLACE) + ? errno : 0); + if (x.rename_errno != 0 && target_directory_operand (file[n_files - 1])) +Index: coreutils-8.30/src/shred.c +=================================================================== +--- coreutils-8.30.orig/src/shred.c 2018-05-14 00:20:24.000000000 -0400 ++++ coreutils-8.30/src/shred.c 2019-02-28 10:27:57.118727440 -0500 +@@ -1096,7 +1096,7 @@ + memset (base, nameset[0], len); + base[len] = 0; + bool rename_ok; +- while (! (rename_ok = (renameat2 (AT_FDCWD, oldname, AT_FDCWD, newname, ++ while (! (rename_ok = (renameatu (AT_FDCWD, oldname, AT_FDCWD, newname, + RENAME_NOREPLACE) + == 0)) + && errno == EEXIST && incname (base, len)) diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..2cde451 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,7 @@ +prefer-renameat2-from-glibc-over-syscall.patch +renameatu.patch +61_whoips.patch +63_dd-appenderrors.patch +72_id_checkngroups.patch +85_timer_settime.patch +99_kfbsd_fstat_patch.patch |