Compare commits

..

5 commits

Author SHA1 Message Date
Lukáš Zaoral
1892fa2306
fix fold -b with UTF8 locale
Resolves: RHEL-60295
2024-09-28 08:12:44 +02:00
Sohum Mendon
29fa793648
Fix fold exit status for nonexistent files
Resolves: rhbz#2296201
2024-07-15 10:45:30 +02:00
Lukáš Zaoral
e188652f2c
fix buffer overflow in split
Resolves: CVE-2024-0684
2024-01-18 15:23:40 +01:00
Lukáš Zaoral
effc4950ac
fix cp -p not copying NFSv4 acls
Resolves: rhbz#2160675
2023-09-11 14:33:56 +02:00
Lukáš Zaoral
9225dbfda4
copy: reduce verbosity of -i and -u with --verbose
Resolves: rhbz#2236321
2023-08-31 09:38:19 +02:00
19 changed files with 2804 additions and 951 deletions

View file

@ -1,4 +1,4 @@
From bca11e30e8a6281a8cbddc9fb196dd86ab09c955 Mon Sep 17 00:00:00 2001
From c7b13f5e1a7ad012c510a8bdd5a8943ab4b55833 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Fri, 17 Jun 2016 16:58:18 +0200
Subject: [PATCH] downstream changes to default DIR_COLORS
@ -9,7 +9,7 @@ Subject: [PATCH] downstream changes to default DIR_COLORS
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/DIR_COLORS b/DIR_COLORS
index 540f6cd..b4785b6 100644
index b465771..ad42b09 100644
--- a/DIR_COLORS
+++ b/DIR_COLORS
@@ -1,3 +1,7 @@
@ -30,17 +30,17 @@ index 540f6cd..b4785b6 100644
# ===================================================================
# Terminal filters
# ===================================================================
@@ -70,7 +77,7 @@ DOOR 01;35 # door
@@ -69,7 +76,7 @@ DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
-MISSING 00 # ... and the files they point to
+MISSING 01;37;41 # ... and the files they point to
SETUID 37;41 # regular file that is setuid (u+s)
SETGID 30;43 # regular file that is setgid (g+s)
CAPABILITY 00 # regular file with capability (very expensive to lookup)
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 00 # file with capability (very expensive to lookup)
diff --git a/DIR_COLORS.lightbgcolor b/DIR_COLORS.lightbgcolor
index e3b0ec3..39a0a4c 100644
index eab6258..1627b63 100644
--- a/DIR_COLORS.lightbgcolor
+++ b/DIR_COLORS.lightbgcolor
@@ -1,3 +1,9 @@
@ -63,7 +63,7 @@ index e3b0ec3..39a0a4c 100644
# ===================================================================
# Terminal filters
# ===================================================================
@@ -60,17 +69,17 @@ TERM xterm*
@@ -59,17 +68,17 @@ TERM xterm*
#NORMAL 00 # no color code at all
#FILE 00 # regular file: use no color at all
RESET 0 # reset to "normal" color
@ -83,18 +83,18 @@ index e3b0ec3..39a0a4c 100644
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
-MISSING 00 # ... and the files they point to
+MISSING 01;37;41 # ... and the files they point to
SETUID 37;41 # regular file that is setuid (u+s)
SETGID 30;43 # regular file that is setgid (g+s)
CAPABILITY 00 # regular file with capability (very expensive to lookup)
@@ -79,7 +88,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 00 # file with capability (very expensive to lookup)
@@ -78,7 +87,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for regular files with execute permission:
# This is for files with execute permission:
-EXEC 01;32
+EXEC 00;32
# ===================================================================
# File extension attributes
--
2.49.0
2.34.1

View file

@ -0,0 +1,31 @@
From c4c5ed8f4e9cd55a12966d4f520e3a13101637d9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 16 Jan 2024 13:48:32 -0800
Subject: [PATCH] split: do not shrink hold buffer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* src/split.c (line_bytes_split): Do not shrink hold buffer.
If its large for this batch its likely to be large for the next
batch, and for split its not worth the complexity/CPU hassle to
shrink it. Do not assume hold_size can be bufsize.
---
src/split.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/split.c b/src/split.c
index 64020c859..037960a59 100644
--- a/src/split.c
+++ b/src/split.c
@@ -809,10 +809,7 @@ line_bytes_split (intmax_t n_bytes, char *buf, idx_t bufsize)
{
cwrite (n_out == 0, hold, n_hold);
n_out += n_hold;
- if (n_hold > bufsize)
- hold = xirealloc (hold, bufsize);
n_hold = 0;
- hold_size = bufsize;
}
/* Output to eol if present. */

View file

@ -0,0 +1,217 @@
commit ccda8a2aedad84d9b730fdd6b36baa9582f54bfd
Author: rpm-build <rpm-build>
Date: Mon Sep 11 14:28:05 2023 +0200
coreutils-9.3-cp--p-should-copy-NFSv4-acls.patch
Cherry picked from the following gnulib upstream commits:
* b851a965da62cd858d71b2e5a7261a211f00b297 ("file-has-acl: port to Fedora 39")
* f01d8792778b637f7464533ac019e42f58adb310 ("file-has-acl: dont access freed storage")
* 735716931755c74f3788ac83fead717c0bb22dfe ("file-has-acl: improve port to Fedora 39")
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index b31a2ea..4cddc80 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -29,7 +29,10 @@
#include "acl-internal.h"
-#if USE_ACL && GETXATTR_WITH_POSIX_ACLS
+#include "minmax.h"
+
+#if USE_ACL && HAVE_LINUX_XATTR_H && HAVE_LISTXATTR
+# include <stdckdint.h>
# include <string.h>
# include <arpa/inet.h>
# include <sys/xattr.h>
@@ -44,6 +47,20 @@ enum {
ACE4_IDENTIFIER_GROUP = 0x00000040
};
+/* Return true if ATTR is in the set represented by the NUL-terminated
+ strings in LISTBUF, which is of size LISTSIZE. */
+
+static bool
+have_xattr (char const *attr, char const *listbuf, ssize_t listsize)
+{
+ char const *blim = listbuf + listsize;
+ for (char const *b = listbuf; b < blim; b += strlen (b) + 1)
+ for (char const *a = attr; *a == *b; a++, b++)
+ if (!*a)
+ return true;
+ return false;
+}
+
/* Return 1 if given ACL in XDR format is non-trivial, 0 if it is trivial.
-1 upon failure to determine it. Possibly change errno. Assume that
the ACL is valid, except avoid undefined behavior even if invalid.
@@ -137,37 +154,77 @@ file_has_acl (char const *name, struct stat const *sb)
if (! S_ISLNK (sb->st_mode))
{
-# if GETXATTR_WITH_POSIX_ACLS
-
- ssize_t ret;
+# if HAVE_LINUX_XATTR_H && HAVE_LISTXATTR
int initial_errno = errno;
- ret = getxattr (name, XATTR_NAME_POSIX_ACL_ACCESS, NULL, 0);
- if (ret < 0 && errno == ENODATA)
- ret = 0;
- else if (ret > 0)
- return 1;
-
- if (ret == 0 && S_ISDIR (sb->st_mode))
+ /* The max length of a trivial NFSv4 ACL is 6 words for owner,
+ 6 for group, 7 for everyone, all times 2 because there are
+ both allow and deny ACEs. There are 6 words for owner
+ because of type, flag, mask, wholen, "OWNER@"+pad and
+ similarly for group; everyone is another word to hold
+ "EVERYONE@". */
+ typedef uint32_t trivial_NFSv4_xattr_buf[2 * (6 + 6 + 7)];
+
+ /* A buffer large enough to hold any trivial NFSv4 ACL,
+ and also useful as a small array of char. */
+ union {
+ trivial_NFSv4_xattr_buf xattr;
+ char ch[sizeof (trivial_NFSv4_xattr_buf)];
+ } stackbuf;
+
+ char *listbuf = stackbuf.ch;
+ ssize_t listbufsize = sizeof stackbuf.ch;
+ char *heapbuf = NULL;
+ ssize_t listsize;
+
+ /* Use listxattr first, as this means just one syscall in the
+ typical case where the file lacks an ACL. Try stackbuf
+ first, falling back on malloc if stackbuf is too small. */
+ while ((listsize = listxattr (name, listbuf, listbufsize)) < 0
+ && errno == ERANGE)
{
- ret = getxattr (name, XATTR_NAME_POSIX_ACL_DEFAULT, NULL, 0);
- if (ret < 0 && errno == ENODATA)
- ret = 0;
- else if (ret > 0)
- return 1;
+ free (heapbuf);
+ ssize_t newsize = listxattr (name, NULL, 0);
+ if (newsize <= 0)
+ return newsize;
+
+ /* Grow LISTBUFSIZE to at least NEWSIZE. Grow it by a
+ nontrivial amount too, to defend against denial of
+ service by an adversary that fiddles with ACLs. */
+ bool overflow = ckd_add (&listbufsize, listbufsize, listbufsize >> 1);
+ listbufsize = MAX (listbufsize, newsize);
+ if (overflow || SIZE_MAX < listbufsize)
+ {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ listbuf = heapbuf = malloc (listbufsize);
+ if (!listbuf)
+ return -1;
}
- if (ret < 0)
+ /* In Fedora 39, a file can have both NFSv4 and POSIX ACLs,
+ but if it has an NFSv4 ACL that's the one that matters.
+ In earlier Fedora the two types of ACLs were mutually exclusive.
+ Attempt to work correctly on both kinds of systems. */
+ bool nfsv4_acl
+ = 0 < listsize && have_xattr (XATTR_NAME_NFSV4_ACL, listbuf, listsize);
+ int ret
+ = (listsize <= 0 ? listsize
+ : (nfsv4_acl
+ || have_xattr (XATTR_NAME_POSIX_ACL_ACCESS, listbuf, listsize)
+ || (S_ISDIR (sb->st_mode)
+ && have_xattr (XATTR_NAME_POSIX_ACL_DEFAULT,
+ listbuf, listsize))));
+ free (heapbuf);
+
+ /* If there is an NFSv4 ACL, follow up with a getxattr syscall
+ to see whether the NFSv4 ACL is nontrivial. */
+ if (nfsv4_acl)
{
- /* Check for NFSv4 ACLs. The max length of a trivial
- ACL is 6 words for owner, 6 for group, 7 for everyone,
- all times 2 because there are both allow and deny ACEs.
- There are 6 words for owner because of type, flag, mask,
- wholen, "OWNER@"+pad and similarly for group; everyone is
- another word to hold "EVERYONE@". */
- uint32_t xattr[2 * (6 + 6 + 7)];
-
- ret = getxattr (name, XATTR_NAME_NFSV4_ACL, xattr, sizeof xattr);
+ ret = getxattr (name, XATTR_NAME_NFSV4_ACL,
+ stackbuf.xattr, sizeof stackbuf.xattr);
if (ret < 0)
switch (errno)
{
@@ -177,7 +234,7 @@ file_has_acl (char const *name, struct stat const *sb)
else
{
/* It looks like a trivial ACL, but investigate further. */
- ret = acl_nfs4_nontrivial (xattr, ret);
+ ret = acl_nfs4_nontrivial (stackbuf.xattr, ret);
if (ret < 0)
{
errno = EINVAL;
diff --git a/m4/acl.m4 b/m4/acl.m4
index dc9853a..3fa0779 100644
--- a/m4/acl.m4
+++ b/m4/acl.m4
@@ -177,37 +177,23 @@ AC_DEFUN([gl_ACL_GET_FILE],
AS_IF([test "$gl_cv_func_working_acl_get_file" != no], [$1], [$2])
])
-# On GNU/Linux, testing if a file has an acl can be done with the getxattr
-# syscall which doesn't require linking against additional libraries.
+# On GNU/Linux, testing if a file has an acl can be done with the
+# listxattr and getxattr syscalls, which don't require linking
+# against additional libraries. Assume this works if linux/attr.h
+# and listxattr are present.
AC_DEFUN([gl_FILE_HAS_ACL],
[
AC_REQUIRE([gl_FUNC_ACL_ARG])
- if test "$enable_acl" != no; then
- AC_CACHE_CHECK([for getxattr with XATTR_NAME_POSIX_ACL macros],
- [gl_cv_getxattr_with_posix_acls],
- [gl_cv_getxattr_with_posix_acls=no
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <sys/types.h>
- #include <sys/xattr.h>
- #include <linux/xattr.h>
- ]],
- [[ssize_t a = getxattr (".", XATTR_NAME_POSIX_ACL_ACCESS, 0, 0);
- ssize_t b = getxattr (".", XATTR_NAME_POSIX_ACL_DEFAULT, 0, 0);
- return a < 0 || b < 0;
- ]])],
- [gl_cv_getxattr_with_posix_acls=yes])])
- fi
- if test "$gl_cv_getxattr_with_posix_acls" = yes; then
- FILE_HAS_ACL_LIB=
- AC_DEFINE([GETXATTR_WITH_POSIX_ACLS], 1,
- [Define to 1 if getxattr works with XATTR_NAME_POSIX_ACL_ACCESS
- and XATTR_NAME_POSIX_ACL_DEFAULT.])
- else
- dnl Set gl_need_lib_has_acl to a nonempty value, so that any
- dnl later gl_FUNC_ACL call will set FILE_HAS_ACL_LIB=$LIB_ACL.
- gl_need_lib_has_acl=1
- FILE_HAS_ACL_LIB=$LIB_ACL
- fi
+ AC_CHECK_HEADERS_ONCE([linux/xattr.h])
+ AC_CHECK_FUNCS_ONCE([listxattr])
+ FILE_HAS_ACL_LIB=
+ AS_CASE([$enable_acl,$ac_cv_header_linux_xattr_h,$ac_cv_func_listxattr],
+ [no,*,*], [],
+ [*,yes,yes], [],
+ [*],
+ [dnl Set gl_need_lib_has_acl to a nonempty value, so that any
+ dnl later gl_FUNC_ACL call will set FILE_HAS_ACL_LIB=$LIB_ACL.
+ gl_need_lib_has_acl=1
+ FILE_HAS_ACL_LIB=$LIB_ACL])
AC_SUBST([FILE_HAS_ACL_LIB])
])

View file

@ -0,0 +1,276 @@
From eca8f2dd212de534778c874a52ca079659e30140 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Tue, 18 Apr 2023 17:57:42 +0200
Subject: [PATCH] Revert "strtol, strtoll, strtoul, strtoull: Make ISO C 23
compliant."
This reverts commit 4e38f4a0c65d4d19883b404a84169088b84b60d2.
---
gnulib-tests/test-strtoll.c | 62 ------------------------------------
gnulib-tests/test-strtoull.c | 62 ------------------------------------
lib/strtol.c | 14 ++------
m4/strtoll.m4 | 19 +++--------
m4/strtoull.m4 | 19 +++--------
5 files changed, 11 insertions(+), 165 deletions(-)
diff --git a/gnulib-tests/test-strtoll.c b/gnulib-tests/test-strtoll.c
index 24cb4eb..ecedbe6 100644
--- a/gnulib-tests/test-strtoll.c
+++ b/gnulib-tests/test-strtoll.c
@@ -239,67 +239,5 @@ main (void)
ASSERT (errno == 0);
}
- /* Binary integer syntax. */
- {
- const char input[] = "0b111010";
- char *ptr;
- long long result;
- errno = 0;
- result = strtoll (input, &ptr, 10);
- ASSERT (result == 0LL);
- ASSERT (ptr == input + 1);
- ASSERT (errno == 0);
- }
- {
- const char input[] = "0b111010";
- char *ptr;
- long long result;
- errno = 0;
- result = strtoll (input, &ptr, 2);
- ASSERT (result == 58LL);
- ASSERT (ptr == input + 8);
- ASSERT (errno == 0);
- }
- {
- const char input[] = "0b111010";
- char *ptr;
- long long result;
- errno = 0;
- result = strtoll (input, &ptr, 0);
- ASSERT (result == 58LL);
- ASSERT (ptr == input + 8);
- ASSERT (errno == 0);
- }
- {
- const char input[] = "0b";
- char *ptr;
- long long result;
- errno = 0;
- result = strtoll (input, &ptr, 10);
- ASSERT (result == 0LL);
- ASSERT (ptr == input + 1);
- ASSERT (errno == 0);
- }
- {
- const char input[] = "0b";
- char *ptr;
- long long result;
- errno = 0;
- result = strtoll (input, &ptr, 2);
- ASSERT (result == 0LL);
- ASSERT (ptr == input + 1);
- ASSERT (errno == 0);
- }
- {
- const char input[] = "0b";
- char *ptr;
- long long result;
- errno = 0;
- result = strtoll (input, &ptr, 0);
- ASSERT (result == 0LL);
- ASSERT (ptr == input + 1);
- ASSERT (errno == 0);
- }
-
return 0;
}
diff --git a/gnulib-tests/test-strtoull.c b/gnulib-tests/test-strtoull.c
index 7b0027f..dd6ec2a 100644
--- a/gnulib-tests/test-strtoull.c
+++ b/gnulib-tests/test-strtoull.c
@@ -238,67 +238,5 @@ main (void)
ASSERT (errno == 0);
}
- /* Binary integer syntax. */
- {
- const char input[] = "0b111010";
- char *ptr;
- unsigned long long result;
- errno = 0;
- result = strtoull (input, &ptr, 10);
- ASSERT (result == 0ULL);
- ASSERT (ptr == input + 1);
- ASSERT (errno == 0);
- }
- {
- const char input[] = "0b111010";
- char *ptr;
- unsigned long long result;
- errno = 0;
- result = strtoull (input, &ptr, 2);
- ASSERT (result == 58ULL);
- ASSERT (ptr == input + 8);
- ASSERT (errno == 0);
- }
- {
- const char input[] = "0b111010";
- char *ptr;
- unsigned long long result;
- errno = 0;
- result = strtoull (input, &ptr, 0);
- ASSERT (result == 58ULL);
- ASSERT (ptr == input + 8);
- ASSERT (errno == 0);
- }
- {
- const char input[] = "0b";
- char *ptr;
- unsigned long long result;
- errno = 0;
- result = strtoull (input, &ptr, 10);
- ASSERT (result == 0ULL);
- ASSERT (ptr == input + 1);
- ASSERT (errno == 0);
- }
- {
- const char input[] = "0b";
- char *ptr;
- unsigned long long result;
- errno = 0;
- result = strtoull (input, &ptr, 2);
- ASSERT (result == 0ULL);
- ASSERT (ptr == input + 1);
- ASSERT (errno == 0);
- }
- {
- const char input[] = "0b";
- char *ptr;
- unsigned long long result;
- errno = 0;
- result = strtoull (input, &ptr, 0);
- ASSERT (result == 0ULL);
- ASSERT (ptr == input + 1);
- ASSERT (errno == 0);
- }
-
return 0;
}
diff --git a/lib/strtol.c b/lib/strtol.c
index b93483d..d11269b 100644
--- a/lib/strtol.c
+++ b/lib/strtol.c
@@ -288,11 +288,6 @@ INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
s += 2;
base = 16;
}
- else if ((base == 0 || base == 2) && TOUPPER (s[1]) == L_('B'))
- {
- s += 2;
- base = 2;
- }
else if (base == 0)
base = 8;
}
@@ -383,14 +378,11 @@ INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
noconv:
/* We must handle a special case here: the base is 0 or 16 and the
first two characters are '0' and 'x', but the rest are no
- hexadecimal digits. Likewise when the base is 0 or 2 and the
- first two characters are '0' and 'b', but the rest are no binary
- digits. This is no error case. We return 0 and ENDPTR points to
- the 'x' or 'b'. */
+ hexadecimal digits. This is no error case. We return 0 and
+ ENDPTR points to the 'x'. */
if (endptr != NULL)
{
- if (save - nptr >= 2
- && (TOUPPER (save[-1]) == L_('X') || TOUPPER (save[-1]) == L_('B'))
+ if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
&& save[-2] == L_('0'))
*endptr = (STRING_TYPE *) &save[-1];
else
diff --git a/m4/strtoll.m4 b/m4/strtoll.m4
index ec09609..ede630c 100644
--- a/m4/strtoll.m4
+++ b/m4/strtoll.m4
@@ -1,4 +1,4 @@
-# strtoll.m4 serial 10
+# strtoll.m4 serial 9
dnl Copyright (C) 2002, 2004, 2006, 2008-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -24,26 +24,15 @@ AC_DEFUN([gl_FUNC_STRTOLL],
if (term != input + 1)
result |= 1;
}
- /* This test fails on pre-C23 platforms. */
- {
- const char input[] = "0b1";
- (void) strtoll (input, &term, 2);
- if (term != input + 3)
- result |= 2;
- }
return result;
]])
],
[gl_cv_func_strtoll_works=yes],
[gl_cv_func_strtoll_works=no],
[case "$host_os" in
- # Guess no on native Windows.
- mingw*) gl_cv_func_strtoll_works="guessing no" ;;
- # Guess no on glibc systems.
- *-gnu* | gnu*) gl_cv_func_strtoll_works="guessing no" ;;
- # Guess no on musl systems.
- *-musl* | midipix*) gl_cv_func_strtoll_works="guessing no" ;;
- *) gl_cv_func_strtoll_works="$gl_cross_guess_normal" ;;
+ # Guess no on native Windows.
+ mingw*) gl_cv_func_strtoll_works="guessing no" ;;
+ *) gl_cv_func_strtoll_works="$gl_cross_guess_normal" ;;
esac
])
])
diff --git a/m4/strtoull.m4 b/m4/strtoull.m4
index 4f895c7..a9b0ddf 100644
--- a/m4/strtoull.m4
+++ b/m4/strtoull.m4
@@ -1,4 +1,4 @@
-# strtoull.m4 serial 10
+# strtoull.m4 serial 9
dnl Copyright (C) 2002, 2004, 2006, 2008-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -24,26 +24,15 @@ AC_DEFUN([gl_FUNC_STRTOULL],
if (term != input + 1)
result |= 1;
}
- /* This test fails on pre-C23 platforms. */
- {
- const char input[] = "0b1";
- (void) strtoull (input, &term, 2);
- if (term != input + 3)
- result |= 2;
- }
return result;
]])
],
[gl_cv_func_strtoull_works=yes],
[gl_cv_func_strtoull_works=no],
[case "$host_os" in
- # Guess no on native Windows.
- mingw*) gl_cv_func_strtoull_works="guessing no" ;;
- # Guess no on glibc systems.
- *-gnu* | gnu*) gl_cv_func_strtoull_works="guessing no" ;;
- # Guess no on musl systems.
- *-musl* | midipix*) gl_cv_func_strtoull_works="guessing no" ;;
- *) gl_cv_func_strtoull_works="$gl_cross_guess_normal" ;;
+ # Guess no on native Windows.
+ mingw*) gl_cv_func_strtoull_works="guessing no" ;;
+ *) gl_cv_func_strtoull_works="$gl_cross_guess_normal" ;;
esac
])
])
--
2.39.2

View file

@ -0,0 +1,141 @@
From cc078f747f3db00e70b2ae2ad2ab34e8d54316d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Tue, 25 Apr 2023 11:07:36 +0100
Subject: [PATCH] copy: reduce verbosity of -i and -u with --verbose
Since skipping of files is central to the operation of -i and -u,
and with -u one may be updating few files out of many,
reinstate the verbosity of this functionality as it was before 9.3.
* src/copy.c (copy_internal): Only output "skipped" message
with --debug. Also adjust so message never changes with --debug.
* tests/cp/cp-i.sh: Adjust accordingly.
* tests/mv/mv-n.sh: Likewise.
* tests/cp/debug.sh: Add explicit test case for message.
Cherry-picked-from: cc078f747f3db00e70b2ae2ad2ab34e8d54316d3
Signed-off-by: Lukáš Zaoral <lzaoral@redhat.com>
---
src/copy.c | 6 +++---
tests/cp/cp-i.sh | 9 ++++-----
tests/cp/debug.sh | 4 ++++
tests/mv/mv-n.sh | 9 ++++-----
4 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/copy.c b/src/copy.c
index 13d93324f..0dd059d2e 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -2433,10 +2433,10 @@ copy_internal (char const *src_name, char const *dst_name,
skip:
if (skipped)
{
- if (x->verbose)
- printf (_("skipped %s\n"), quoteaf (dst_name));
- else if (x->interactive == I_ALWAYS_NO)
+ if (x->interactive == I_ALWAYS_NO)
error (0, 0, _("not replacing %s"), quoteaf (dst_name));
+ else if (x->debug)
+ printf (_("skipped %s\n"), quoteaf (dst_name));
return_now = true;
}
diff --git a/tests/cp/cp-i.sh b/tests/cp/cp-i.sh
index 4458b2edd..a9178a99e 100755
--- a/tests/cp/cp-i.sh
+++ b/tests/cp/cp-i.sh
@@ -29,13 +29,12 @@ echo n | returns_ 1 cp -iR a b 2>/dev/null || fail=1
# test miscellaneous combinations of -f -i -n parameters
touch c d || framework_failure_
echo "'c' -> 'd'" > out_copy || framework_failure_
-echo "skipped 'd'" > out_skip || framework_failure_
echo "cp: not replacing 'd'" > err_skip || framework_failure_
touch out_empty || framework_failure_
# ask for overwrite, answer no
echo n | returns_ 1 cp -vi c d 2>/dev/null > out1 || fail=1
-compare out1 out_skip || fail=1
+compare out1 out_empty || fail=1
# ask for overwrite, answer yes
echo y | cp -vi c d 2>/dev/null > out2 || fail=1
@@ -47,7 +46,7 @@ compare out3 out_copy || fail=1
# -n wins over -i
echo y | returns_ 1 cp -vin c d 2>/dev/null > out4 || fail=1
-compare out4 out_skip || fail=1
+compare out4 out_empty || fail=1
# -n wins over -i non verbose
echo y | returns_ 1 cp -in c d 2>err4 > out4 || fail=1
@@ -60,11 +59,11 @@ compare out5 out_copy || fail=1
# do not ask, prevent from overwrite
echo n | returns_ 1 cp -vfn c d 2>/dev/null > out6 || fail=1
-compare out6 out_skip || fail=1
+compare out6 out_empty || fail=1
# do not ask, prevent from overwrite
echo n | returns_ 1 cp -vnf c d 2>/dev/null > out7 || fail=1
-compare out7 out_skip || fail=1
+compare out7 out_empty || fail=1
# options --backup and --no-clobber are mutually exclusive
returns_ 1 cp -bn c d 2>/dev/null || fail=1
diff --git a/tests/cp/debug.sh b/tests/cp/debug.sh
index b46adc637..242894de2 100755
--- a/tests/cp/debug.sh
+++ b/tests/cp/debug.sh
@@ -25,4 +25,8 @@ grep 'copy offload:.*reflink:.*sparse detection:' cp.out || fail=1
cp --debug --attributes-only file file.cp >cp.out || fail=1
returns_ 1 grep 'copy offload:.*reflink:.*sparse detection:' cp.out || fail=1
+touch file.cp || framework_failure_
+cp --debug --update=none file file.cp >cp.out || fail=1
+grep 'skipped' cp.out || fail=1
+
Exit $fail
diff --git a/tests/mv/mv-n.sh b/tests/mv/mv-n.sh
index 45d74eb93..60547807c 100755
--- a/tests/mv/mv-n.sh
+++ b/tests/mv/mv-n.sh
@@ -23,14 +23,13 @@ print_ver_ mv
# test miscellaneous combinations of -f -i -n parameters
touch a b || framework_failure_
echo "renamed 'a' -> 'b'" > out_move
-echo "skipped 'b'" > out_skip || framework_failure_
echo "mv: not replacing 'b'" > err_skip || framework_failure_
> out_empty
# ask for overwrite, answer no
touch a b || framework_failure_
echo n | returns_ 1 mv -vi a b 2>/dev/null > out1 || fail=1
-compare out1 out_skip || fail=1
+compare out1 out_empty || fail=1
# ask for overwrite, answer yes
touch a b || framework_failure_
@@ -40,7 +39,7 @@ compare out2 out_move || fail=1
# -n wins (as the last option)
touch a b || framework_failure_
echo y | returns_ 1 mv -vin a b 2>/dev/null > out3 || fail=1
-compare out3 out_skip || fail=1
+compare out3 out_empty || fail=1
# -n wins (non verbose)
touch a b || framework_failure_
@@ -51,12 +50,12 @@ compare err3 err_skip || fail=1
# -n wins (as the last option)
touch a b || framework_failure_
echo y | returns_ 1 mv -vfn a b 2>/dev/null > out4 || fail=1
-compare out4 out_skip || fail=1
+compare out4 out_empty || fail=1
# -n wins (as the last option)
touch a b || framework_failure_
echo y | returns_ 1 mv -vifn a b 2>/dev/null > out5 || fail=1
-compare out5 out_skip || fail=1
+compare out5 out_empty || fail=1
# options --backup and --no-clobber are mutually exclusive
touch a || framework_failure_

View file

@ -1,28 +0,0 @@
From 95044cb5eaea83d02f768feb5ab79fcf5e6ad782 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Mon, 22 Dec 2025 17:12:48 +0000
Subject: [PATCH] tests: avoid false failure due to ulimit on aarch64
* tests/cut/cut-huge-range.sh: Add an extra 1MiB headroom,
which was seen with aarch64.
Reported at https://bugzilla.redhat.com/2424302
Cherry-picked-by: Lukáš Zaoral <lzaoral@redhat.com>
Upstream-commit: 95044cb5eaea83d02f768feb5ab79fcf5e6ad782
---
tests/cut/cut-huge-range.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/cut/cut-huge-range.sh b/tests/cut/cut-huge-range.sh
index 4bd1b129d8..98d7e8f0b9 100755
--- a/tests/cut/cut-huge-range.sh
+++ b/tests/cut/cut-huge-range.sh
@@ -22,6 +22,7 @@ getlimits_
vm=$(get_min_ulimit_v_ returns_ 0 cut -b1 /dev/null) \
|| skip_ 'shell lacks ulimit, or ASAN enabled'
+vm=$(($vm+1000)) # https://bugzilla.redhat.com/2424302
# Ensure we can cut up to our sentinel value.
# Don't use expr to subtract one,

View file

@ -1,169 +0,0 @@
From 891761bca1aa78336e5b18c121075b6e4696c5d4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 23 Nov 2025 00:50:40 -0800
Subject: [PATCH] Port to C23 qualifier-generic fns like strchr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This ports Gnulib to strict C23 platforms that reject code
like char *q = strchr (P, 'x'); when P is a pointer to const,
because in C23 strchr is a qualifier-generic function so
strchr (P, 'x') returns char const *.
This patch does not attempt to do the following two things,
which might be useful in the future:
1. When compiling on non-C23 platforms, check user code for
portability to platforms that define qualifier-generic functions.
2. Port Gnulib to platforms that have qualifier-generic functions
not listed in the C23 standard, e.g., strchrnul. I dont know
of any such platforms.
* lib/mbschr.c (mbschr):
* lib/memchr2.c (memchr2):
Port to C23, where functions like strchr are qualifier-generic.
* lib/c++defs.h (_GL_FUNCDECL_SYS_NAME): New macro.
* lib/c++defs.h (_GL_FUNCDECL_SYS):
* lib/stdlib.in.h (bsearch):
Use it, to prevent C23 names like strchr from acting like macros.
* lib/string.in.h (memchr, strchr, strpbrk, strrchr):
Do not #undef when GNULIB_POSIXCHECK is defined, as this could
cause conforming C23 code to fail to conform. Its not clear why
_GL_WARN_ON_USE_CXX; perhaps it was needed but isnt any more?
But for now, limit the removal of #undef to these four functions
where #undeffing is clearly undesirable in C23.
* lib/wchar.in.h (wmemchr): Parenthesize function name in decl,
to prevent it from acting like a macro.
Cherry-picked-by: Lukáš Zaoral <lzaoral@redhat.com>
Upstream-commit: df17f4f37ed3ca373d23ad42eae51122bdb96626
---
lib/c++defs.h | 12 +++++++++++-
lib/mbschr.c | 2 +-
lib/memchr2.c | 2 +-
lib/stdlib.in.h | 6 +++---
lib/string.in.h | 4 ----
lib/wchar.in.h | 2 +-
6 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/lib/c++defs.h b/lib/c++defs.h
index b77979a..7384457 100644
--- a/lib/c++defs.h
+++ b/lib/c++defs.h
@@ -127,6 +127,16 @@
#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \
_GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters
+/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to
+ parenthsized func otherwise. Parenthesization is needed in C23 if
+ the function is like strchr and so is a qualifier-generic macro
+ that expands to something more complicated. */
+#ifdef __cplusplus
+# define _GL_FUNCDECL_SYS_NAME(func) func
+#else
+# define _GL_FUNCDECL_SYS_NAME(func) (func)
+#endif
+
/* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]);
declares the system function, named func, with the given prototype,
consisting of return type, parameters, and attributes.
@@ -139,7 +149,7 @@
_GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
*/
#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \
- _GL_EXTERN_C_FUNC __VA_ARGS__ rettype func parameters
+ _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters
/* _GL_CXXALIAS_RPL (func, rettype, parameters);
declares a C++ alias called GNULIB_NAMESPACE::func
diff --git a/lib/mbschr.c b/lib/mbschr.c
index c9e14b5..6582134 100644
--- a/lib/mbschr.c
+++ b/lib/mbschr.c
@@ -65,5 +65,5 @@ mbschr (const char *string, int c)
return NULL;
}
else
- return strchr (string, c);
+ return (char *) strchr (string, c);
}
diff --git a/lib/memchr2.c b/lib/memchr2.c
index 7493823..d7724ae 100644
--- a/lib/memchr2.c
+++ b/lib/memchr2.c
@@ -55,7 +55,7 @@ memchr2 (void const *s, int c1_in, int c2_in, size_t n)
c2 = (unsigned char) c2_in;
if (c1 == c2)
- return memchr (s, c1, n);
+ return (void *) memchr (s, c1, n);
/* Handle the first few bytes by reading one byte at a time.
Do this until VOID_PTR is aligned on a longword boundary. */
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index bef0aaa..fd0e1e0 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -224,9 +224,9 @@ _GL_INLINE_HEADER_BEGIN
/* Declarations for ISO C N3322. */
#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
-_GL_EXTERN_C void *bsearch (const void *__key,
- const void *__base, size_t __nmemb, size_t __size,
- int (*__compare) (const void *, const void *))
+_GL_EXTERN_C void *_GL_FUNCDECL_SYS_NAME (bsearch)
+ (const void *__key, const void *__base, size_t __nmemb, size_t __size,
+ int (*__compare) (const void *, const void *))
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3) _GL_ARG_NONNULL ((5));
_GL_EXTERN_C void qsort (void *__base, size_t __nmemb, size_t __size,
int (*__compare) (const void *, const void *))
diff --git a/lib/string.in.h b/lib/string.in.h
index fdcdd21..8b56acf 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -409,7 +409,6 @@ _GL_CXXALIASWARN1 (memchr, void const *,
_GL_CXXALIASWARN (memchr);
# endif
#elif defined GNULIB_POSIXCHECK
-# undef memchr
/* Assume memchr is always declared. */
_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
"use gnulib module memchr for portability" );
@@ -674,7 +673,6 @@ _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
#if defined GNULIB_POSIXCHECK
/* strchr() does not work with multibyte strings if the locale encoding is
GB18030 and the character to be searched is a digit. */
-# undef strchr
/* Assume strchr is always declared. */
_GL_WARN_ON_USE_CXX (strchr,
const char *, char *, (const char *, int),
@@ -981,7 +979,6 @@ _GL_CXXALIASWARN (strpbrk);
Even in this simple case, it does not work with multibyte strings if the
locale encoding is GB18030 and one of the characters to be searched is a
digit. */
-# undef strpbrk
_GL_WARN_ON_USE_CXX (strpbrk,
const char *, char *, (const char *, const char *),
"strpbrk cannot work correctly on character strings "
@@ -1011,7 +1008,6 @@ _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
#if defined GNULIB_POSIXCHECK
/* strrchr() does not work with multibyte strings if the locale encoding is
GB18030 and the character to be searched is a digit. */
-# undef strrchr
/* Assume strrchr is always declared. */
_GL_WARN_ON_USE_CXX (strrchr,
const char *, char *, (const char *, int),
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index ab602a2..6be4515 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -301,7 +301,7 @@ _GL_EXTERN_C int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
# ifndef __cplusplus
-_GL_EXTERN_C wchar_t *wmemchr (const wchar_t *__s, wchar_t __wc, size_t __n)
+_GL_EXTERN_C wchar_t *(wmemchr) (const wchar_t *__s, wchar_t __wc, size_t __n)
_GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
# endif
_GL_EXTERN_C wchar_t *wmemset (wchar_t *__s, wchar_t __wc, size_t __n)
--
2.52.0

View file

@ -1,4 +1,4 @@
From 91be1a584108a6a3d96f64382bbf206c4213b3db Mon Sep 17 00:00:00 2001
From 6e36198f10a2f63b89c89ebb5d5c185b20fb3a63 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Mon, 29 Mar 2010 17:20:34 +0000
Subject: [PATCH] coreutils-df-direct.patch
@ -11,10 +11,10 @@ Subject: [PATCH] coreutils-df-direct.patch
create mode 100755 tests/df/direct.sh
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index b420606..0ccb368 100644
index 5b9a597..6810c15 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -12597,6 +12597,13 @@ some systems (notably Solaris), doing this yields more up to date results,
@@ -12074,6 +12074,13 @@ some systems (notably Solaris), doing this yields more up to date results,
but in general this option makes @command{df} much slower, especially when
there are many or very busy file systems.
@ -29,10 +29,10 @@ index b420606..0ccb368 100644
@opindex --total
@cindex grand total of file system size, usage and available space
diff --git a/src/df.c b/src/df.c
index 75e638c..ef9f0a7 100644
index 48025b9..c8efa5b 100644
--- a/src/df.c
+++ b/src/df.c
@@ -121,6 +121,9 @@ static bool print_type;
@@ -125,6 +125,9 @@ static bool print_type;
/* If true, print a grand total at the end. */
static bool print_grand_total;
@ -42,7 +42,7 @@ index 75e638c..ef9f0a7 100644
/* Grand total data. */
static struct fs_usage grand_fsu;
@@ -248,13 +251,15 @@ enum
@@ -252,13 +255,15 @@ enum
NO_SYNC_OPTION = CHAR_MAX + 1,
SYNC_OPTION,
TOTAL_OPTION,
@ -53,16 +53,16 @@ index 75e638c..ef9f0a7 100644
static struct option const long_options[] =
{
{"all", no_argument, nullptr, 'a'},
{"block-size", required_argument, nullptr, 'B'},
+ {"direct", no_argument, nullptr, DIRECT_OPTION},
{"inodes", no_argument, nullptr, 'i'},
{"human-readable", no_argument, nullptr, 'h'},
{"si", no_argument, nullptr, 'H'},
@@ -571,7 +576,10 @@ get_header (void)
for (idx_t col = 0; col < ncolumns; col++)
{"all", no_argument, NULL, 'a'},
{"block-size", required_argument, NULL, 'B'},
+ {"direct", no_argument, NULL, DIRECT_OPTION},
{"inodes", no_argument, NULL, 'i'},
{"human-readable", no_argument, NULL, 'h'},
{"si", no_argument, NULL, 'H'},
@@ -583,7 +588,10 @@ get_header (void)
for (col = 0; col < ncolumns; col++)
{
char *cell;
char *cell = NULL;
- char const *header = _(columns[col]->caption);
+ char const *header = (columns[col]->field == TARGET_FIELD
+ && direct_statfs)?
@ -71,7 +71,7 @@ index 75e638c..ef9f0a7 100644
if (columns[col]->field == SIZE_FIELD
&& (header_mode == DEFAULT_MODE
@@ -1446,6 +1454,17 @@ get_point (char const *point, const struct stat *statp)
@@ -1486,6 +1494,17 @@ get_point (char const *point, const struct stat *statp)
static void
get_entry (char const *name, struct stat const *statp)
{
@ -79,17 +79,17 @@ index 75e638c..ef9f0a7 100644
+ {
+ char *resolved = canonicalize_file_name (name);
+ if (resolved)
+ {
+ get_dev (NULL, resolved, name, NULL, NULL, false, false, NULL, false);
+ free (resolved);
+ return;
+ }
+ {
+ get_dev (NULL, resolved, name, NULL, NULL, false, false, NULL, false);
+ free (resolved);
+ return;
+ }
+ }
+
if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
&& get_device (name))
return;
@@ -1516,6 +1535,7 @@ or all file systems by default.\n\
@@ -1556,6 +1575,7 @@ or all file systems by default.\n\
-B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\
'-BM' prints sizes in units of 1,048,576 bytes;\n\
see SIZE format below\n\
@ -97,7 +97,7 @@ index 75e638c..ef9f0a7 100644
-h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\
-H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\
"), stdout);
@@ -1610,6 +1630,9 @@ main (int argc, char **argv)
@@ -1646,6 +1666,9 @@ main (int argc, char **argv)
xstrtol_fatal (e, oi, c, long_options, optarg);
}
break;
@ -107,14 +107,14 @@ index 75e638c..ef9f0a7 100644
case 'i':
if (header_mode == OUTPUT_MODE)
{
@@ -1706,6 +1729,13 @@ main (int argc, char **argv)
@@ -1742,6 +1765,13 @@ main (int argc, char **argv)
}
}
+ if (direct_statfs && show_local_fs)
+ {
+ error (0, 0, _("options --direct and --local (-l) are mutually "
+ "exclusive"));
+ "exclusive"));
+ usage (EXIT_FAILURE);
+ }
+
@ -183,5 +183,5 @@ index 0000000..8e4cfb8
+
+Exit $fail
--
2.52.0
2.31.1

File diff suppressed because it is too large Load diff

View file

@ -1,65 +0,0 @@
From 8927d505ecb5334f09c48ef98ef1f464f581d0f7 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 2 Apr 2024 14:11:26 +0100
Subject: [PATCH] coreutils-python3.patch
---
init.cfg | 4 ++--
tests/d_type-check | 2 +-
tests/du/move-dir-while-traversing.sh | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/init.cfg b/init.cfg
index ac05f7b..26d9516 100644
--- a/init.cfg
+++ b/init.cfg
@@ -601,10 +601,10 @@ seek_data_capable_()
# Skip the current test if "." lacks d_type support.
require_dirent_d_type_()
{
- python < /dev/null \
+ python3 < /dev/null \
|| skip_ python missing: assuming no d_type support
- python "$abs_srcdir"/tests/d_type-check \
+ python3 "$abs_srcdir"/tests/d_type-check \
|| skip_ requires d_type support
}
diff --git a/tests/d_type-check b/tests/d_type-check
index 1a2f76f..42d3924 100644
--- a/tests/d_type-check
+++ b/tests/d_type-check
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Exit 0 if "." and "./tempfile" have useful d_type information, else 1.
# Intended to exit 0 only on Linux/GNU systems.
import os
diff --git a/tests/du/move-dir-while-traversing.sh b/tests/du/move-dir-while-traversing.sh
index adf482b..cf9214a 100755
--- a/tests/du/move-dir-while-traversing.sh
+++ b/tests/du/move-dir-while-traversing.sh
@@ -21,8 +21,8 @@ print_ver_ du
require_trap_signame_
# We use a python-inotify script, so...
-python -m pyinotify -h > /dev/null \
- || skip_ 'python inotify package not installed'
+python3 -m pyinotify -h > /dev/null \
+ || skip_ 'python3 inotify package not installed'
# Move a directory "up" while du is processing its sub-directories.
# While du is processing a hierarchy .../B/C/D/... this script
@@ -33,7 +33,7 @@ python -m pyinotify -h > /dev/null \
# rename syscall before du finishes processing the subtree under D/.
cat <<'EOF' > inotify-watch-for-dir-access.py
-#!/usr/bin/env python
+#!/usr/bin/env python3
import pyinotify as pn
import os,sys
--
2.51.0

87
coreutils-selinux.patch Normal file
View file

@ -0,0 +1,87 @@
From d70ddb3eb845c494280e7365e2b889242e7e1bb9 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 4 Oct 2021 08:45:53 +0200
Subject: [PATCH] coreutils-selinux.patch
---
src/cp.c | 19 ++++++++++++++++++-
src/install.c | 12 +++++++++++-
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/src/cp.c b/src/cp.c
index c97a675..89fb8ec 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -952,7 +952,7 @@ main (int argc, char **argv)
selinux_enabled = (0 < is_selinux_enabled ());
cp_option_init (&x);
- while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:TZ",
+ while ((c = getopt_long (argc, argv, "abcdfHilLnprst:uvxPRS:TZ",
long_opts, NULL))
!= -1)
{
@@ -1000,6 +1000,23 @@ main (int argc, char **argv)
copy_contents = true;
break;
+ case 'c':
+ fprintf (stderr, "%s: warning: option '-c' is deprecated,"
+ " please use '--preserve=context' instead\n", argv[0]);
+ if (x.set_security_context)
+ {
+ fprintf (stderr,
+ "%s: cannot force target context and preserve it\n",
+ argv[0]);
+ exit (1);
+ }
+ else if (selinux_enabled)
+ {
+ x.preserve_security_context = true;
+ x.require_preserve_context = true;
+ }
+ break;
+
case 'd':
x.preserve_links = true;
x.dereference = DEREF_NEVER;
diff --git a/src/install.c b/src/install.c
index c9456fe..2b1bee9 100644
--- a/src/install.c
+++ b/src/install.c
@@ -794,7 +794,7 @@ main (int argc, char **argv)
dir_arg = false;
umask (0);
- while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z", long_options,
+ while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pPt:TvS:Z", long_options,
NULL)) != -1)
{
switch (optc)
@@ -855,6 +855,9 @@ main (int argc, char **argv)
no_target_directory = true;
break;
+ case 'P':
+ fprintf (stderr, "%s: warning: option '-P' is deprecated,"
+ " please use '--preserve-context' instead\n", argv[0]);
case PRESERVE_CONTEXT_OPTION:
if (! selinux_enabled)
{
@@ -862,6 +865,13 @@ main (int argc, char **argv)
"this kernel is not SELinux-enabled"));
break;
}
+ if (x.set_security_context)
+ {
+ fprintf (stderr,
+ "%s: cannot force target context and preserve it\n",
+ argv[0]);
+ exit (1);
+ }
x.preserve_security_context = true;
use_default_selinux_context = false;
break;
--
2.31.1

View file

@ -1,9 +1,8 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 9.9
Release: 2%{?dist}
# some used parts of gnulib are under various variants of LGPL
License: GPL-3.0-or-later AND GFDL-1.3-no-invariants-or-later AND LGPL-2.1-or-later AND LGPL-3.0-or-later
Version: 9.3
Release: 7%{?dist}
License: GPL-3.0-or-later
Url: https://www.gnu.org/software/coreutils/
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig
@ -14,6 +13,9 @@ Source50: supported_utils
Source105: coreutils-colorls.sh
Source106: coreutils-colorls.csh
# revert a gnulib patch that broke the build
Patch1: coreutils-9.3-gnulib-strtol.patch
# do not make coreutils-single depend on /usr/bin/coreutils
%global __requires_exclude ^%{_bindir}/coreutils$
@ -26,23 +28,26 @@ Patch101: coreutils-8.26-selinuxenable.patch
# downstream changes to default DIR_COLORS
Patch102: coreutils-8.32-DIR_COLORS.patch
# use python3 in tests
Patch103: coreutils-python3.patch
# df --direct
Patch104: coreutils-df-direct.patch
# gnulib C23 support
# https://github.com/coreutils/gnulib/commit/df17f4f37ed3ca373d23ad42eae51122bdb96626
Patch105: coreutils-9.9-gnulib-c23.patch
# copy: reduce verbosity of -i and -u with --verbose (#2236321)
# backport of cc078f747f3db00e70b2ae2ad2ab34e8d54316d3.
Patch105: coreutils-9.3-reduce--iu-verbosity-with-verbose.patch
# fix cut test failure on aarch64 rawhide (rhbz#2424302)
# https://github.com/coreutils/coreutils/commit/95044cb5eaea83d02f768feb5ab79fcf5e6ad782
Patch106: coreutils-9.9-fix-cut-test-aarch64.patch
# cp -p should copy NFSv4 acls (#2160675)
# see the patch for the list of backported commits
Patch106: coreutils-9.3-cp--p-should-copy-NFSv4-acls.patch
# fix buffer overflow in split (CVE-2024-0684)
Patch107: coreutils-9.2-CVE-2024-0684.patch
# (sb) lin18nux/lsb compliance - multibyte functionality patch
Patch800: coreutils-i18n.patch
# downstream SELinux options deprecated since 2009
Patch950: coreutils-selinux.patch
Conflicts: filesystem < 3
# To avoid clobbering installs
@ -63,34 +68,19 @@ BuildRequires: libselinux-utils
BuildRequires: make
BuildRequires: openssl-devel
BuildRequires: strace
BuildRequires: systemd-devel
BuildRequires: texinfo
# For gpg verification of source tarball
BuildRequires: gnupg2
# test-only dependencies
BuildRequires: acl
BuildRequires: gdb
BuildRequires: perl-interpreter
BuildRequires: perl(FileHandle)
BuildRequires: python3
BuildRequires: tzdata
%ifarch %valgrind_arches
BuildRequires: valgrind
%endif
%if 0%{?fedora}
BuildRequires: perl(Expect)
BuildRequires: python3-inotify
%endif
%if 23 < 0%{?fedora} || 7 < 0%{?rhel}
# needed by i18n test-cases
BuildRequires: glibc-langpack-en
BuildRequires: glibc-langpack-fr
BuildRequires: glibc-langpack-ko
BuildRequires: glibc-langpack-sv
%endif
Requires: %{name}-common = %{version}-%{release}
@ -125,9 +115,6 @@ packaged as a single multicall binary.
# https://bugzilla.redhat.com/show_bug.cgi?id=1107973#c7
Obsoletes: %{name} < 8.24-100
# Gnulib translations are maintained seprately since coreutils 9.6 (#2393892)
Requires: gnulib-l10n
# info doc refers to "Specifying the Time Zone" from glibc-doc (#959597)
Suggests: glibc-doc
@ -162,15 +149,16 @@ sed src/dircolors.hin \
find tests -name '*.sh' -perm 0644 -print -exec chmod 0755 '{}' '+'
(echo "<<< done") 2>/dev/null
# FIXME: Force a newer gettext version to workaround `autoreconf -i` errors
# with coreutils 9.6 and bundled gettext 0.19.2 from gettext-common-devel.
sed -i "s/0.19.2/$(rpm -q --queryformat '%%{VERSION}\n' gettext-devel)/" bootstrap.conf configure.ac
autoreconf -fiv
%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fpic"
# disable -flto on ppc64le to make test-float pass (#1789115)
%ifarch ppc64le
CFLAGS="$CFLAGS -fno-lto"
%endif
# Upstream suggests to build with -Dlint for static analyzers:
# https://lists.gnu.org/archive/html/coreutils/2018-06/msg00110.html
# ... and even for production binary RPMs:
@ -199,7 +187,6 @@ for type in separate single; do
--cache-file=../config.cache \
--enable-install-program=arch \
--enable-no-install-program=kill,uptime \
--enable-systemd \
--with-tty-group \
DEFAULT_POSIX2_VERSION=200112 alternative=199209 || :
%make_build all V=1
@ -226,20 +213,14 @@ for type in separate single; do
fi
(cd $type && make DESTDIR=$RPM_BUILD_ROOT/$subdir $install)
%if "%{_sbindir}" != "%{_bindir}"
# chroot was in /usr/sbin :
mkdir -p $RPM_BUILD_ROOT/$subdir/%_sbindir
mkdir -p $RPM_BUILD_ROOT/$subdir/{%{_bindir},%{_sbindir}}
mv $RPM_BUILD_ROOT/$subdir/{%_bindir,%_sbindir}/chroot
%endif
# Move multicall variants to *.single.
# RemovePathPostfixes will strip that later.
if test $type = 'single'; then
for dir in %{_bindir} \
%if "%{_sbindir}" != "%{_bindir}"
%{_sbindir} \
%endif
%{_libexecdir}/%{name}; do
for dir in %{_bindir} %{_sbindir} %{_libexecdir}/%{name}; do
for bin in $RPM_BUILD_ROOT/%{_libexecdir}/%{name}/$dir/*; do
basebin=$(basename $bin)
mv $bin $RPM_BUILD_ROOT/$dir/$basebin.single
@ -267,9 +248,7 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%files single
%{_bindir}/*.single
%if "%{_sbindir}" != "%{_bindir}"
%{_sbindir}/chroot.single
%endif
%dir %{_libexecdir}/coreutils
%{_libexecdir}/coreutils/*.so.single
# duplicate the license because coreutils-common does not need to be installed
@ -286,104 +265,20 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%license COPYING
%changelog
* Tue Jan 13 2026 Lukáš Zaoral <lzaoral@redhat.com> - 9.9-2
- fix cut test failure on aarch64 rawhide (rhbz#2424302)
* Wed Nov 26 2025 Lukáš Zaoral <lzaoral@redhat.com> - 9.9-1
- rebase to latest upstream release (rhbz#2413803)
* Mon Sep 29 2025 Lukáš Zaoral <lzaoral@redhat.com> - 9.8-3
- require gnulib-l10n for translations of gnulib messages (rhbz#2393892)
* Thu Sep 25 2025 Lukáš Zaoral <lzaoral@redhat.com> - 9.8-2
- tail: fix tailing larger number of lines in regular files (rhbz#2398008)
* Wed Sep 24 2025 Lukáš Zaoral <lzaoral@redhat.com> - 9.8-1
- rebase to latest upstream release (rhbz#2397467)
- remove downstream patch for selinux options deprecated since 2009
* Wed Jul 23 2025 Fedora Release Engineering <releng@fedoraproject.org> - 9.7-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Mon Jun 30 2025 Lukáš Zaoral <lzaoral@redhat.com> - 9.7-4
- stty: add support for arbitrary baud rates (rhbz#2375439)
* Wed May 28 2025 Lukáš Zaoral <lzaoral@redhat.com> - 9.7-3
- sort: fix buffer under-read (CVE-2025-5278)
* Mon May 19 2025 Lukáš Zaoral <lzaoral@redhat.com> - 9.7-2
- cp/mv: do not fail when copying of trivial NFSv4 ACLs fails (rhbz#2363149)
* Wed Apr 09 2025 Lukáš Zaoral <lzaoral@redhat.com> - 9.7-1
- rebase to latest upstream release (rhbz#2358624)
* Tue Feb 25 2025 Lukáš Zaoral <lzaoral@redhat.com> - 9.6-2
- fix 'who -m' with guessed tty names (rhbz#2343998)
* Mon Jan 20 2025 Lukáš Zaoral <lzaoral@redhat.com> - 9.6-1
- rebase to latest upstream version (rhbz#2338620)
- sync i18n patch with SUSE (Kudos to Berny Völker!)
* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 9.5-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Sun Jan 12 2025 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 9.5-12
- Rebuilt for the bin-sbin merge (2nd attempt)
* Wed Nov 13 2024 Florian Weimer <fweimer@redhat.com> - 9.5-11
- Affinity mask handling in nproc for large CPU counts (rhbz#2325167)
* Fri Sep 27 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.5-10
* Fri Sep 27 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.3-7
- fix fold -b with UTF8 locale (RHEL-60295)
* Tue Aug 27 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.5-9
- show web sessions in who output (rhbz#2307847)
* Wed Aug 21 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.5-8
- add missing systemd-devel buildrequires
* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 9.5-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Mon Jul 15 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.5-6
- Rebuilt for the bin-sbin merge
* Mon Jul 15 2024 Sohum Mendon <sohum.mendon@proton.me> - 9.5-5
* Mon Jul 15 2024 Sohum Mendon <sohum.mendon@proton.me> - 9.3-6
- fix incorrect exit status when fold is called with a non-existent file
* Tue Jul 09 2024 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 9.5-4
- Rebuilt for the bin-sbin merge
* Thu Jul 04 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.5-3
- do not buildrequire perl(Expect) on ELN
* Tue Jun 04 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.5-2
- enable LTO on ppc64le
* Tue Apr 02 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.5-1
- rebase to latest upstream version (rhbz#2272063)
- sync i18n patch with SUSE (Kudos to Berny Völker!)
- add some test dependencies to execute additional part of the upstream test-suite
* Mon Jan 29 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.4-6
- fix tail on kernels with 64k page sizes (RHEL-22866)
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 9.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 9.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jan 18 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.4-3
- fix compilation on i686
* Thu Jan 18 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.4-2
* Thu Jan 18 2024 Lukáš Zaoral <lzaoral@redhat.com> - 9.3-5
- fix buffer overflow in split (CVE-2024-0684)
* Fri Sep 15 2023 Lukáš Zaoral <lzaoral@redhat.com> - 9.4-1
- new upstream release 9.4 (#2235759)
- enable integration with systemd
- fix the license field
* Mon Sep 11 2023 Lukáš Zaoral <lzaoral@redhat.com> - 9.3-4
- fix cp -p not copying NFSv4 acls (rhbz#2160675)
* Thu Aug 31 2023 Lukáš Zaoral <lzaoral@redhat.com> - 9.3-3
- copy: reduce verbosity of -i and -u with --verbose (#2236321)
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 9.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

View file

@ -1,2 +1,2 @@
SHA512 (coreutils-9.9.tar.xz.sig) = 0a3dfdfa6b4234e2e1d42142269f959bdf3cf8f6605a50270a27eff84dd22588f182121f7dd3eeb04be45f5109d02690215065b3d3b43882874d0e165a1435d0
SHA512 (coreutils-9.9.tar.xz) = e7b0e59f7732d2c098ea4934014f470248bd5c4764210e9200a698010a8e3b95bbb26e543f0cd73ed5a4b8e1f8cda932c73f39954d68175e4deaa47526610c65
SHA512 (coreutils-9.3.tar.xz) = 242271f212a6860bdc6c8d7e5c4f85ce66c1b48ef781aca9daa56e0fe7c2b7809ef72b4392120219fe5b687637c83ce89ceef8bb35f6274f43f8f968a6901694
SHA512 (coreutils-9.3.tar.xz.sig) = 522a2072f8ef940228ccdd856a4041c3c16b98e309168ccf2066fe7c1013685ba6cdea8a7317dfa1f4507b37ca016ecedaf54438d4a5007927b0e1a8fd223eb5

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/coreutils/readlink-cannot-handle-recursive-symlink s
# Description: Test for readlink cannot handle recursive symlinks
# Author: Jan Scotka <jscotka@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/coreutils/readlink-cannot-handle-recursive-symlinks
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Jan Scotka <jscotka@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for readlink cannot handle recursive symlinks" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: coreutils" >> $(METADATA)
@echo "Requires: coreutils" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,54 @@
PURPOSE of /CoreOS/coreutils/readlink-cannot-handle-recursive-symlinks
Description: Test for readlink cannot handle recursive symlinks
Author: Jan Scotka <jscotka@redhat.com>
Bug summary: readlink cannot handle recursive symlinks
Description:
Description of problem:
The readlink command fails with an error "Too many levels of symbolic links", even if there are only 2 levels.
The readlink command from RHEL 3 and RHEL 4 and from Fedora 11 all work fine.
Among other changes between RHEL 4 and RHEL 5, RHEL 5's coreutils added calls to cycle_check() in lib/canonicalize.c, but in upstream canonicalize.c (now in gnulib instead of coreutils), we see the comment:
/* Detect loops. We cannot use the cycle-check module here,
since it's actually possible to encounter the same symlink
more than once in a given traversal. However, encountering
the same symlink,NAME pair twice does indicate a loop. */
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/canonicalize.c;h=4f348398fd69ae516396313d18ac294a4ca3dde3;hb=b653eda3ac4864de205419d9f41eec267cb89eeb#l262
The latest canonicalize.c uses seen_triple() instead of cycle_check().
Version-Release number of selected component (if applicable):
coreutils-5.97-19.el5
How reproducible:
every time
Steps to Reproduce:
1. Create a directory with a symlink to itself
mkdir /tmp/dir
cd /tmp/dir
ln -s ../dir dirlink
2. Run readlink using the 'dirlink' symlink recursively
readlink -v -f dirlink
readlink -v -f dirlink/dirlink
readlink -v -f dirlink/dirlink/dirlink
Actual results:
The first readlink command on just dirlink succeeds, but the 2nd and 3rd commands fail with
readlink: dirlink/dirlink: Too many levels of symbolic links
Expected results:
$ readlink -v -f dirlink
/tmp/dir
$ readlink -v -f dirlink/dirlink
/tmp/dir
$ readlink -v -f dirlink/dirlink/dirlink
/tmp/dir
Additional info:

View file

@ -0,0 +1,60 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/coreutils/readlink-cannot-handle-recursive-symlinks
# Description: Test for readlink cannot handle recursive symlinks
# Author: Jan Scotka <jscotka@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2010 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh
. /usr/lib/beakerlib/beakerlib.sh
PACKAGE="coreutils"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "mkdir link" 0 "Creating test directory"
rlRun "cd link" 0 "cd to this dir"
rlRun "ln -s ../link link" 0 "creating symlink to ../link -> link"
rlPhaseEnd
rlPhaseStartTest
rlLog "Test of readlink up to 20 iteration"
export TMPVAR="link"
for foo in `seq 20`
do echo $TMPVAR
rlRun "readlink -v -f $TMPVAR" 0 "readlink of $TMPVAR"
TMPVAR="$TMPVAR/link"
done
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

39
tests/test-basics Executable file
View file

@ -0,0 +1,39 @@
#!/bin/sh
# Checks that touch ls rm and foo work
# https://www.mankier.com/1/beakerlib#Examples
. /usr/share/beakerlib/beakerlib.sh
# Set the full test name
TEST="/examples/beakerlib/Sanity/phases"
# Package being tested
PACKAGE="coreutils"
rlJournalStart
# Setup phase: Prepare test directory
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun 'TmpDir=$(mktemp -d)' 0 'Creating tmp directory' # no-reboot
rlRun "pushd $TmpDir"
rlPhaseEnd
# Test phase: Testing touch, ls and rm commands
rlPhaseStartTest
rlRun "touch foo" 0 "Creating the foo test file"
rlAssertExists "foo"
rlRun "ls -l foo" 0 "Listing the foo test file"
rlRun "rm foo" 0 "Removing the foo test file"
rlAssertNotExists "foo"
rlRun "ls -l foo" 2 "Listing foo should now report an error"
rlPhaseEnd
# Cleanup phase: Remove test directory
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalEnd
# Print the test report
rlJournalPrintText

9
tests/test_basics.yml Normal file
View file

@ -0,0 +1,9 @@
---
# This first play always runs on the local staging system
- hosts: localhost
tags:
- atomic
- classic
- container
roles:
- { role: standard-test-beakerlib, tests: [ test-basics, readlink-cannot-handle-recursive-symlinks ] }

2
tests/tests.yml Normal file
View file

@ -0,0 +1,2 @@
# Fedora Continuous Integration: https://fedoraproject.org/wiki/CI
- include: test_basics.yml