Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Kamil Dudka | b879c36d82 | |
Kamil Dudka | 962ac382b0 | |
Kamil Dudka | bd22bdca47 | |
Kamil Dudka | 8ae32dadfe | |
Kamil Dudka | 82494c9a33 | |
Kamil Dudka | f2a92ef65d | |
Kamil Dudka | 7286eb560b |
|
@ -0,0 +1,228 @@
|
||||||
|
From 42b0e609390e62a900c0d73de60282c8b0f15121 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
Date: Thu, 5 Apr 2018 08:48:01 -0700
|
||||||
|
Subject: [PATCH 1/2] fts: treat CIFS like NFS
|
||||||
|
|
||||||
|
Problem reported by Kamil Dudka in:
|
||||||
|
https://lists.gnu.org/r/bug-gnulib/2018-04/msg00015.html
|
||||||
|
* lib/fts.c (S_MAGIC_CIFS): New macro.
|
||||||
|
(dirent_inode_sort_may_be_useful, leaf_optimization):
|
||||||
|
Treat CIFS like NFS.
|
||||||
|
|
||||||
|
Upstream-commit: 2e53df541a30d438859087ed4b5a396e04697b9b
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
lib/fts.c | 8 +++++++-
|
||||||
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/lib/fts.c b/lib/fts.c
|
||||||
|
index 8f2595d..0689da6 100644
|
||||||
|
--- a/lib/fts.c
|
||||||
|
+++ b/lib/fts.c
|
||||||
|
@@ -685,6 +685,7 @@ enum leaf_optimization
|
||||||
|
|
||||||
|
/* Linux-specific constants from coreutils' src/fs.h */
|
||||||
|
# define S_MAGIC_AFS 0x5346414F
|
||||||
|
+# define S_MAGIC_CIFS 0xFF534D42
|
||||||
|
# define S_MAGIC_NFS 0x6969
|
||||||
|
# define S_MAGIC_PROC 0x9FA0
|
||||||
|
# define S_MAGIC_REISERFS 0x52654973
|
||||||
|
@@ -792,8 +793,9 @@ dirent_inode_sort_may_be_useful (FTSENT const *p)
|
||||||
|
|
||||||
|
switch (filesystem_type (p))
|
||||||
|
{
|
||||||
|
- case S_MAGIC_TMPFS:
|
||||||
|
+ case S_MAGIC_CIFS:
|
||||||
|
case S_MAGIC_NFS:
|
||||||
|
+ case S_MAGIC_TMPFS:
|
||||||
|
/* On a file system of any of these types, sorting
|
||||||
|
is unnecessary, and hence wasteful. */
|
||||||
|
return false;
|
||||||
|
@@ -827,6 +829,10 @@ leaf_optimization (FTSENT const *p)
|
||||||
|
/* Although AFS mount points are not counted in st_nlink, they
|
||||||
|
act like directories. See <https://bugs.debian.org/143111>. */
|
||||||
|
FALLTHROUGH;
|
||||||
|
+ case S_MAGIC_CIFS:
|
||||||
|
+ /* Leaf optimization causes 'find' to abort. See
|
||||||
|
+ <https://lists.gnu.org/r/bug-gnulib/2018-04/msg00015.html>. */
|
||||||
|
+ FALLTHROUGH;
|
||||||
|
case S_MAGIC_NFS:
|
||||||
|
/* NFS provides usable dirent.d_type but not necessarily for all entries
|
||||||
|
of large directories, so as per <https://bugzilla.redhat.com/1252549>
|
||||||
|
--
|
||||||
|
2.14.3
|
||||||
|
|
||||||
|
|
||||||
|
From bf96f62507931eb296c5b16d7e46c141ad505a1f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
Date: Wed, 11 Apr 2018 12:50:35 -0700
|
||||||
|
Subject: [PATCH 2/2] fts: fix bug in find across filesystems
|
||||||
|
|
||||||
|
This fixes a bug I introduced last summer.
|
||||||
|
Problem reported by Kamil Dudka in:
|
||||||
|
https://lists.gnu.org/r/bug-gnulib/2018-04/msg00033.html
|
||||||
|
* lib/fts.c (filesystem_type, dirent_inode_sort_may_be_useful)
|
||||||
|
(leaf_optimization):
|
||||||
|
New arg for file descriptor. All callers changed.
|
||||||
|
(fts_build): Check for whether inodes should be sorted
|
||||||
|
before closing the directory.
|
||||||
|
|
||||||
|
Upstream-commit: 81b8c0d3be98f5a77403599de3d06329b3e7673e
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
lib/fts.c | 55 +++++++++++++++++++++++++++++++------------------------
|
||||||
|
1 file changed, 31 insertions(+), 24 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/fts.c b/lib/fts.c
|
||||||
|
index 0689da6..6420ba1 100644
|
||||||
|
--- a/lib/fts.c
|
||||||
|
+++ b/lib/fts.c
|
||||||
|
@@ -726,11 +726,12 @@ dev_type_compare (void const *x, void const *y)
|
||||||
|
return ax->st_dev == ay->st_dev;
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* Return the file system type of P, or 0 if not known.
|
||||||
|
+/* Return the file system type of P with file descriptor FD, or 0 if not known.
|
||||||
|
+ If FD is negative, P's file descriptor is unavailable.
|
||||||
|
Try to cache known values. */
|
||||||
|
|
||||||
|
static fsword
|
||||||
|
-filesystem_type (FTSENT const *p)
|
||||||
|
+filesystem_type (FTSENT const *p, int fd)
|
||||||
|
{
|
||||||
|
FTS *sp = p->fts_fts;
|
||||||
|
Hash_table *h = sp->fts_leaf_optimization_works_ht;
|
||||||
|
@@ -756,7 +757,7 @@ filesystem_type (FTSENT const *p)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Look-up failed. Query directly and cache the result. */
|
||||||
|
- if (fstatfs (p->fts_fts->fts_cwd_fd, &fs_buf) != 0)
|
||||||
|
+ if (fd < 0 || fstatfs (fd, &fs_buf) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (h)
|
||||||
|
@@ -778,12 +779,12 @@ filesystem_type (FTSENT const *p)
|
||||||
|
return fs_buf.f_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* Return false if it is easy to determine the file system type of the
|
||||||
|
- directory P, and sorting dirents on inode numbers is known not to
|
||||||
|
- improve traversal performance with that type of file system.
|
||||||
|
- Otherwise, return true. */
|
||||||
|
+/* Return true if sorting dirents on inode numbers is known to improve
|
||||||
|
+ traversal performance for the directory P with descriptor DIR_FD.
|
||||||
|
+ Return false otherwise. When in doubt, return true.
|
||||||
|
+ DIR_FD is negative if unavailable. */
|
||||||
|
static bool
|
||||||
|
-dirent_inode_sort_may_be_useful (FTSENT const *p)
|
||||||
|
+dirent_inode_sort_may_be_useful (FTSENT const *p, int dir_fd)
|
||||||
|
{
|
||||||
|
/* Skip the sort only if we can determine efficiently
|
||||||
|
that skipping it is the right thing to do.
|
||||||
|
@@ -791,7 +792,7 @@ dirent_inode_sort_may_be_useful (FTSENT const *p)
|
||||||
|
while the cost of *not* performing it can be O(N^2) with
|
||||||
|
a very large constant. */
|
||||||
|
|
||||||
|
- switch (filesystem_type (p))
|
||||||
|
+ switch (filesystem_type (p, dir_fd))
|
||||||
|
{
|
||||||
|
case S_MAGIC_CIFS:
|
||||||
|
case S_MAGIC_NFS:
|
||||||
|
@@ -805,16 +806,17 @@ dirent_inode_sort_may_be_useful (FTSENT const *p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* Given an FTS entry P for a directory D,
|
||||||
|
+/* Given an FTS entry P for a directory with descriptor DIR_FD,
|
||||||
|
return true if it is both useful and valid to apply leaf optimization.
|
||||||
|
The optimization is useful only for file systems that lack usable
|
||||||
|
dirent.d_type info. The optimization is valid if an st_nlink value
|
||||||
|
of at least MIN_DIR_NLINK is an upper bound on the number of
|
||||||
|
- subdirectories of D, counting "." and ".." as subdirectories. */
|
||||||
|
+ subdirectories of D, counting "." and ".." as subdirectories.
|
||||||
|
+ DIR_FD is negative if unavailable. */
|
||||||
|
static enum leaf_optimization
|
||||||
|
-leaf_optimization (FTSENT const *p)
|
||||||
|
+leaf_optimization (FTSENT const *p, int dir_fd)
|
||||||
|
{
|
||||||
|
- switch (filesystem_type (p))
|
||||||
|
+ switch (filesystem_type (p, dir_fd))
|
||||||
|
{
|
||||||
|
/* List here the file system types that may lack usable dirent.d_type
|
||||||
|
info, yet for which the optimization does apply. */
|
||||||
|
@@ -851,12 +853,13 @@ leaf_optimization (FTSENT const *p)
|
||||||
|
|
||||||
|
#else
|
||||||
|
static bool
|
||||||
|
-dirent_inode_sort_may_be_useful (FTSENT const *p _GL_UNUSED)
|
||||||
|
+dirent_inode_sort_may_be_useful (FTSENT const *p _GL_UNUSED,
|
||||||
|
+ int dir_fd _GL_UNUSED)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
static enum leaf_optimization
|
||||||
|
-leaf_optimization (FTSENT const *p _GL_UNUSED)
|
||||||
|
+leaf_optimization (FTSENT const *p _GL_UNUSED, int dir_fd _GL_UNUSED)
|
||||||
|
{
|
||||||
|
return NO_LEAF_OPTIMIZATION;
|
||||||
|
}
|
||||||
|
@@ -1050,7 +1053,7 @@ check_for_dir:
|
||||||
|
if (parent->fts_n_dirs_remaining == 0
|
||||||
|
&& ISSET(FTS_NOSTAT)
|
||||||
|
&& ISSET(FTS_PHYSICAL)
|
||||||
|
- && (leaf_optimization (parent)
|
||||||
|
+ && (leaf_optimization (parent, sp->fts_cwd_fd)
|
||||||
|
== NOSTAT_LEAF_OPTIMIZATION))
|
||||||
|
{
|
||||||
|
/* nothing more needed */
|
||||||
|
@@ -1335,6 +1338,7 @@ fts_build (register FTS *sp, int type)
|
||||||
|
int dir_fd;
|
||||||
|
FTSENT *cur = sp->fts_cur;
|
||||||
|
bool continue_readdir = !!cur->fts_dirp;
|
||||||
|
+ bool sort_by_inode = false;
|
||||||
|
size_t max_entries;
|
||||||
|
|
||||||
|
/* When cur->fts_dirp is non-NULL, that means we should
|
||||||
|
@@ -1428,7 +1432,7 @@ fts_build (register FTS *sp, int type)
|
||||||
|
&& ! (ISSET (FTS_NOSTAT) && ISSET (FTS_PHYSICAL)
|
||||||
|
&& ! ISSET (FTS_SEEDOT)
|
||||||
|
&& cur->fts_statp->st_nlink == MIN_DIR_NLINK
|
||||||
|
- && (leaf_optimization (cur)
|
||||||
|
+ && (leaf_optimization (cur, dir_fd)
|
||||||
|
!= NO_LEAF_OPTIMIZATION)));
|
||||||
|
if (descend || type == BREAD)
|
||||||
|
{
|
||||||
|
@@ -1589,6 +1593,15 @@ mem1: saved_errno = errno;
|
||||||
|
tail->fts_link = p;
|
||||||
|
tail = p;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ /* If there are many entries, no sorting function has been
|
||||||
|
+ specified, and this file system is of a type that may be
|
||||||
|
+ slow with a large number of entries, arrange to sort the
|
||||||
|
+ directory entries on increasing inode numbers. */
|
||||||
|
+ if (nitems == _FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD
|
||||||
|
+ && !sp->fts_compar)
|
||||||
|
+ sort_by_inode = dirent_inode_sort_may_be_useful (cur, dir_fd);
|
||||||
|
+
|
||||||
|
++nitems;
|
||||||
|
if (max_entries <= nitems) {
|
||||||
|
/* When there are too many dir entries, leave
|
||||||
|
@@ -1646,13 +1659,7 @@ mem1: saved_errno = errno;
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* If there are many entries, no sorting function has been specified,
|
||||||
|
- and this file system is of a type that may be slow with a large
|
||||||
|
- number of entries, then sort the directory entries on increasing
|
||||||
|
- inode numbers. */
|
||||||
|
- if (nitems > _FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD
|
||||||
|
- && !sp->fts_compar
|
||||||
|
- && dirent_inode_sort_may_be_useful (cur)) {
|
||||||
|
+ if (sort_by_inode) {
|
||||||
|
sp->fts_compar = fts_compare_ino;
|
||||||
|
head = fts_sort (sp, head, nitems);
|
||||||
|
sp->fts_compar = NULL;
|
||||||
|
--
|
||||||
|
2.14.3
|
||||||
|
|
|
@ -0,0 +1,202 @@
|
||||||
|
From 08d69db2f3c0e8506a1d126dd4dcdd0f14071161 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
Date: Mon, 5 Mar 2018 10:56:29 -0800
|
||||||
|
Subject: [PATCH] fflush: adjust to glibc 2.28 libio.h removal
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Problem reported by Daniel P. Berrangé in:
|
||||||
|
https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
|
||||||
|
* lib/fflush.c (clear_ungetc_buffer_preserving_position)
|
||||||
|
(disable_seek_optimization, rpl_fflush):
|
||||||
|
* lib/fpending.c (__fpending):
|
||||||
|
* lib/fpurge.c (fpurge):
|
||||||
|
* lib/freadahead.c (freadahead):
|
||||||
|
* lib/freading.c (freading):
|
||||||
|
* lib/freadptr.c (freadptr):
|
||||||
|
* lib/freadseek.c (freadptrinc):
|
||||||
|
* lib/fseeko.c (fseeko):
|
||||||
|
* lib/fseterr.c (fseterr):
|
||||||
|
* lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]:
|
||||||
|
Define if not already defined.
|
||||||
|
|
||||||
|
Upstream-commit: 4af4a4a71827c0bc5e0ec67af23edef4f15cee8e
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
lib/fflush.c | 6 +++---
|
||||||
|
lib/fpending.c | 2 +-
|
||||||
|
lib/fpurge.c | 2 +-
|
||||||
|
lib/freadahead.c | 2 +-
|
||||||
|
lib/freading.c | 2 +-
|
||||||
|
lib/freadptr.c | 2 +-
|
||||||
|
lib/freadseek.c | 2 +-
|
||||||
|
lib/fseeko.c | 4 ++--
|
||||||
|
lib/fseterr.c | 2 +-
|
||||||
|
lib/stdio-impl.h | 6 ++++++
|
||||||
|
10 files changed, 18 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/fflush.c b/lib/fflush.c
|
||||||
|
index 4e65692..c16da5f 100644
|
||||||
|
--- a/lib/fflush.c
|
||||||
|
+++ b/lib/fflush.c
|
||||||
|
@@ -33,7 +33,7 @@
|
||||||
|
#undef fflush
|
||||||
|
|
||||||
|
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
|
||||||
|
/* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
|
||||||
|
static void
|
||||||
|
@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
|
||||||
|
+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
|
||||||
|
|
||||||
|
# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
|
||||||
|
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
|
||||||
|
@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
|
||||||
|
if (stream == NULL || ! freading (stream))
|
||||||
|
return fflush (stream);
|
||||||
|
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
|
||||||
|
clear_ungetc_buffer_preserving_position (stream);
|
||||||
|
|
||||||
|
diff --git a/lib/fpending.c b/lib/fpending.c
|
||||||
|
index 5811a4a..9e21a16 100644
|
||||||
|
--- a/lib/fpending.c
|
||||||
|
+++ b/lib/fpending.c
|
||||||
|
@@ -32,7 +32,7 @@ __fpending (FILE *fp)
|
||||||
|
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||||
|
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||||
|
fast macros. */
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
return fp->_IO_write_ptr - fp->_IO_write_base;
|
||||||
|
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
|
||||||
|
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
|
||||||
|
diff --git a/lib/fpurge.c b/lib/fpurge.c
|
||||||
|
index 408b8fc..3a16000 100644
|
||||||
|
--- a/lib/fpurge.c
|
||||||
|
+++ b/lib/fpurge.c
|
||||||
|
@@ -62,7 +62,7 @@ fpurge (FILE *fp)
|
||||||
|
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||||
|
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||||
|
fast macros. */
|
||||||
|
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
fp->_IO_read_end = fp->_IO_read_ptr;
|
||||||
|
fp->_IO_write_ptr = fp->_IO_write_base;
|
||||||
|
/* Avoid memory leak when there is an active ungetc buffer. */
|
||||||
|
diff --git a/lib/freadahead.c b/lib/freadahead.c
|
||||||
|
index f335f04..e7cb77b 100644
|
||||||
|
--- a/lib/freadahead.c
|
||||||
|
+++ b/lib/freadahead.c
|
||||||
|
@@ -30,7 +30,7 @@ extern size_t __sreadahead (FILE *);
|
||||||
|
size_t
|
||||||
|
freadahead (FILE *fp)
|
||||||
|
{
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||||
|
return 0;
|
||||||
|
return (fp->_IO_read_end - fp->_IO_read_ptr)
|
||||||
|
diff --git a/lib/freading.c b/lib/freading.c
|
||||||
|
index 78140d2..c9d3344 100644
|
||||||
|
--- a/lib/freading.c
|
||||||
|
+++ b/lib/freading.c
|
||||||
|
@@ -31,7 +31,7 @@ freading (FILE *fp)
|
||||||
|
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||||
|
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||||
|
fast macros. */
|
||||||
|
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
return ((fp->_flags & _IO_NO_WRITES) != 0
|
||||||
|
|| ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
|
||||||
|
&& fp->_IO_read_base != NULL));
|
||||||
|
diff --git a/lib/freadptr.c b/lib/freadptr.c
|
||||||
|
index e4cc0b0..aba8dd5 100644
|
||||||
|
--- a/lib/freadptr.c
|
||||||
|
+++ b/lib/freadptr.c
|
||||||
|
@@ -29,7 +29,7 @@ freadptr (FILE *fp, size_t *sizep)
|
||||||
|
size_t size;
|
||||||
|
|
||||||
|
/* Keep this code in sync with freadahead! */
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
||||||
|
return NULL;
|
||||||
|
size = fp->_IO_read_end - fp->_IO_read_ptr;
|
||||||
|
diff --git a/lib/freadseek.c b/lib/freadseek.c
|
||||||
|
index fcecba6..98726f8 100644
|
||||||
|
--- a/lib/freadseek.c
|
||||||
|
+++ b/lib/freadseek.c
|
||||||
|
@@ -36,7 +36,7 @@ freadptrinc (FILE *fp, size_t increment)
|
||||||
|
/* Keep this code in sync with freadptr! */
|
||||||
|
#if HAVE___FREADPTRINC /* musl libc */
|
||||||
|
__freadptrinc (fp, increment);
|
||||||
|
-#elif defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#elif defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
fp->_IO_read_ptr += increment;
|
||||||
|
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
|
||||||
|
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
|
||||||
|
diff --git a/lib/fseeko.c b/lib/fseeko.c
|
||||||
|
index d0f24d8..0ae2b15 100644
|
||||||
|
--- a/lib/fseeko.c
|
||||||
|
+++ b/lib/fseeko.c
|
||||||
|
@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These tests are based on fpurge.c. */
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
if (fp->_IO_read_end == fp->_IO_read_ptr
|
||||||
|
&& fp->_IO_write_ptr == fp->_IO_write_base
|
||||||
|
&& fp->_IO_save_base == NULL)
|
||||||
|
@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
fp->_flags &= ~_IO_EOF_SEEN;
|
||||||
|
fp->_offset = pos;
|
||||||
|
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
|
||||||
|
diff --git a/lib/fseterr.c b/lib/fseterr.c
|
||||||
|
index 739e545..d998619 100644
|
||||||
|
--- a/lib/fseterr.c
|
||||||
|
+++ b/lib/fseterr.c
|
||||||
|
@@ -29,7 +29,7 @@ fseterr (FILE *fp)
|
||||||
|
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||||
|
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||||
|
fast macros. */
|
||||||
|
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||||
|
fp->_flags |= _IO_ERR_SEEN;
|
||||||
|
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
|
||||||
|
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
|
||||||
|
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
|
||||||
|
index 329801a..eeaabab 100644
|
||||||
|
--- a/lib/stdio-impl.h
|
||||||
|
+++ b/lib/stdio-impl.h
|
||||||
|
@@ -18,6 +18,12 @@
|
||||||
|
the same implementation of stdio extension API, except that some fields
|
||||||
|
have different naming conventions, or their access requires some casts. */
|
||||||
|
|
||||||
|
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
|
||||||
|
+ problem by defining it ourselves. FIXME: Do not rely on glibc
|
||||||
|
+ internals. */
|
||||||
|
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
|
||||||
|
+# define _IO_IN_BACKUP 0x100
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/* BSD stdio derived implementations. */
|
||||||
|
|
||||||
|
--
|
||||||
|
2.16.2
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
From 67defe5a29936c20a2c102b1b947ce9ea9afc081 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
Date: Tue, 23 Jan 2018 00:42:04 -0800
|
||||||
|
Subject: [PATCH] Merge strftime.c changes from glibc
|
||||||
|
|
||||||
|
This incorporates:
|
||||||
|
2017-11-14 [BZ #10871] Implement alternative month names
|
||||||
|
2017-11-14 [BZ #10871] Abbreviated alternative month names (%Ob)
|
||||||
|
2017-06-20 Use locale_t, not __locale_t, throughout glibc
|
||||||
|
* lib/nstrftime.c (ABALTMON_1) [!COMPILE_WIDE]: New macro.
|
||||||
|
(LOCALE_PARAM) [_LIBC && USE_IN_EXTENDED_LOCALE_MODEL]:
|
||||||
|
Use locale_t, not __locale_t.
|
||||||
|
(a_altmonth, f_altmonth, aam_len) [_NL_CURRENT]: New macros.
|
||||||
|
(__strftime_internal): Add support for alternate months.
|
||||||
|
|
||||||
|
Upstream-commit: 4a236f16ce0ef97094ff2f6538d4dba90e72a523
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
lib/nstrftime.c | 24 +++++++++++++++++++-----
|
||||||
|
1 file changed, 19 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/nstrftime.c b/lib/nstrftime.c
|
||||||
|
index 8795cd7..5902c49 100644
|
||||||
|
--- a/lib/nstrftime.c
|
||||||
|
+++ b/lib/nstrftime.c
|
||||||
|
@@ -91,6 +91,7 @@ extern char *tzname[];
|
||||||
|
# define UCHAR_T unsigned char
|
||||||
|
# define L_(Str) Str
|
||||||
|
# define NLW(Sym) Sym
|
||||||
|
+# define ABALTMON_1 _NL_ABALTMON_1
|
||||||
|
|
||||||
|
# define MEMCPY(d, s, n) memcpy (d, s, n)
|
||||||
|
# define STRLEN(s) strlen (s)
|
||||||
|
@@ -255,7 +256,7 @@ extern char *tzname[];
|
||||||
|
# undef _NL_CURRENT
|
||||||
|
# define _NL_CURRENT(category, item) \
|
||||||
|
(current->values[_NL_ITEM_INDEX (item)].string)
|
||||||
|
-# define LOCALE_PARAM , __locale_t loc
|
||||||
|
+# define LOCALE_PARAM , locale_t loc
|
||||||
|
# define LOCALE_ARG , loc
|
||||||
|
# define HELPER_LOCALE_ARG , current
|
||||||
|
#else
|
||||||
|
@@ -475,12 +476,19 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
||||||
|
# define f_month \
|
||||||
|
((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \
|
||||||
|
? "?" : _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon)))
|
||||||
|
+# define a_altmonth \
|
||||||
|
+ ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \
|
||||||
|
+ ? "?" : _NL_CURRENT (LC_TIME, NLW(ABALTMON_1) + tp->tm_mon)))
|
||||||
|
+# define f_altmonth \
|
||||||
|
+ ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \
|
||||||
|
+ ? "?" : _NL_CURRENT (LC_TIME, NLW(ALTMON_1) + tp->tm_mon)))
|
||||||
|
# define ampm \
|
||||||
|
((const CHAR_T *) _NL_CURRENT (LC_TIME, tp->tm_hour > 11 \
|
||||||
|
? NLW(PM_STR) : NLW(AM_STR)))
|
||||||
|
|
||||||
|
# define aw_len STRLEN (a_wkday)
|
||||||
|
# define am_len STRLEN (a_month)
|
||||||
|
+# define aam_len STRLEN (a_altmonth)
|
||||||
|
# define ap_len STRLEN (ampm)
|
||||||
|
#endif
|
||||||
|
#if HAVE_TZNAME
|
||||||
|
@@ -808,17 +816,20 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
||||||
|
to_uppcase = true;
|
||||||
|
to_lowcase = false;
|
||||||
|
}
|
||||||
|
- if (modifier != 0)
|
||||||
|
+ if (modifier == L_('E'))
|
||||||
|
goto bad_format;
|
||||||
|
#ifdef _NL_CURRENT
|
||||||
|
- cpy (am_len, a_month);
|
||||||
|
+ if (modifier == L_('O'))
|
||||||
|
+ cpy (aam_len, a_altmonth);
|
||||||
|
+ else
|
||||||
|
+ cpy (am_len, a_month);
|
||||||
|
break;
|
||||||
|
#else
|
||||||
|
goto underlying_strftime;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case L_('B'):
|
||||||
|
- if (modifier != 0)
|
||||||
|
+ if (modifier == L_('E'))
|
||||||
|
goto bad_format;
|
||||||
|
if (change_case)
|
||||||
|
{
|
||||||
|
@@ -826,7 +837,10 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
||||||
|
to_lowcase = false;
|
||||||
|
}
|
||||||
|
#ifdef _NL_CURRENT
|
||||||
|
- cpy (STRLEN (f_month), f_month);
|
||||||
|
+ if (modifier == L_('O'))
|
||||||
|
+ cpy (STRLEN (f_altmonth), f_altmonth);
|
||||||
|
+ else
|
||||||
|
+ cpy (STRLEN (f_month), f_month);
|
||||||
|
break;
|
||||||
|
#else
|
||||||
|
goto underlying_strftime;
|
||||||
|
--
|
||||||
|
2.14.3
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
From 5a820c5a312d6a5b7a1a755cd0f81c84f7c676d7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||||
|
Date: Wed, 14 Mar 2018 11:31:43 -0700
|
||||||
|
Subject: [PATCH] ls: increase the allowed abmon width from 5 to 12
|
||||||
|
|
||||||
|
This will impact relatively few languages,
|
||||||
|
and will make Arabic or Catalan etc.
|
||||||
|
output unambiguous abbreviated month names.
|
||||||
|
|
||||||
|
* src/ls.c (MAX_MON_WIDTH): Increase from 5 to 12.
|
||||||
|
* tests/ls/abmon-align.sh: Augment to check for ambiguous output.
|
||||||
|
Fixes https://bugs.gnu.org/30814
|
||||||
|
|
||||||
|
Upstream-commit: 5ed2018360ba44f673b1dc74fb3d2927f7fcfae3
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
src/ls.c | 7 +++++--
|
||||||
|
tests/ls/abmon-align.sh | 9 ++++++---
|
||||||
|
2 files changed, 11 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/ls.c b/src/ls.c
|
||||||
|
index 4becd06..b2983aa 100644
|
||||||
|
--- a/src/ls.c
|
||||||
|
+++ b/src/ls.c
|
||||||
|
@@ -1095,8 +1095,11 @@ file_escape_init (void)
|
||||||
|
variable width abbreviated months and also precomputing/caching
|
||||||
|
the names was seen to increase the performance of ls significantly. */
|
||||||
|
|
||||||
|
-/* max number of display cells to use */
|
||||||
|
-enum { MAX_MON_WIDTH = 5 };
|
||||||
|
+/* max number of display cells to use.
|
||||||
|
+ As of 2018 the abmon for Arabic has entries with width 12.
|
||||||
|
+ It doesn't make much sense to support wider than this
|
||||||
|
+ and locales should aim for abmon entries of width <= 5. */
|
||||||
|
+enum { MAX_MON_WIDTH = 12 };
|
||||||
|
/* abformat[RECENT][MON] is the format to use for timestamps with
|
||||||
|
recentness RECENT and month MON. */
|
||||||
|
enum { ABFORMAT_SIZE = 128 };
|
||||||
|
diff --git a/tests/ls/abmon-align.sh b/tests/ls/abmon-align.sh
|
||||||
|
index e474047..a81266b 100755
|
||||||
|
--- a/tests/ls/abmon-align.sh
|
||||||
|
+++ b/tests/ls/abmon-align.sh
|
||||||
|
@@ -32,17 +32,20 @@ for format in "%b" "[%b" "%b]" "[%b]"; do
|
||||||
|
# The sed usage here is slightly different from the original,
|
||||||
|
# removing the \(.*\), to avoid triggering misbehavior in at least
|
||||||
|
# GNU sed 4.2 (possibly miscompiled) on Mac OS X (Darwin 9.8.0).
|
||||||
|
- n_widths=$(
|
||||||
|
+ months="$(
|
||||||
|
LC_ALL=$LOC TIME_STYLE=+"$format" ls -lgG *.ts |
|
||||||
|
- LC_ALL=C sed 's/.\{15\}//;s/ ..\.ts$//;s/ /./g' |
|
||||||
|
+ LC_ALL=C sed 's/.\{15\}//;s/ ..\.ts$//;s/ /./g')"
|
||||||
|
+ n_widths=$(echo "$months" |
|
||||||
|
while read mon; do echo "$mon" | LC_ALL=$LOC wc -L; done |
|
||||||
|
uniq | wc -l
|
||||||
|
)
|
||||||
|
+ n_dupes=$(echo "$months" | sort | uniq -d | wc -l)
|
||||||
|
test "$n_widths" = "1" || { fail=1; break 2; }
|
||||||
|
+ #test "$n_dupes" = "0" || { fail=1; break 2; }
|
||||||
|
done
|
||||||
|
done
|
||||||
|
if test "$fail" = "1"; then
|
||||||
|
- echo "misalignment detected in $LOC locale:"
|
||||||
|
+ echo "misalignment or ambiguous output in $LOC locale:"
|
||||||
|
LC_ALL=$LOC TIME_STYLE=+%b ls -lgG *.ts
|
||||||
|
fi
|
||||||
|
|
||||||
|
--
|
||||||
|
2.14.3
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||||
Name: coreutils
|
Name: coreutils
|
||||||
Version: 8.29
|
Version: 8.29
|
||||||
Release: 4%{?dist}
|
Release: 7%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
Url: https://www.gnu.org/software/coreutils/
|
Url: https://www.gnu.org/software/coreutils/
|
||||||
|
@ -20,6 +20,19 @@ Patch1: coreutils-8.29-mv-n-noreplace.patch
|
||||||
# doc: warn about following symlinks recursively in chown/chgrp (CVE-2017-18018)
|
# doc: warn about following symlinks recursively in chown/chgrp (CVE-2017-18018)
|
||||||
Patch2: coreutils-8.29-CVE-2017-18018.patch
|
Patch2: coreutils-8.29-CVE-2017-18018.patch
|
||||||
|
|
||||||
|
# fix build failure with glibc-2.28
|
||||||
|
# https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
|
||||||
|
Patch3: coreutils-8.29-gnulib-fflush.patch
|
||||||
|
|
||||||
|
# fix crash caused by mistakenly enabled leaf optimization (#1558249)
|
||||||
|
Patch4: coreutils-8.29-fts-leaf-opt.patch
|
||||||
|
|
||||||
|
# date, ls: pick strftime fixes from glibc to improve locale support (#1577872)
|
||||||
|
Patch5: coreutils-8.29-gnulib-strftime.patch
|
||||||
|
|
||||||
|
# ls: increase the allowed abmon width from 5 to 12 (#1577872)
|
||||||
|
Patch6: coreutils-8.29-ls-abmon-width.patch
|
||||||
|
|
||||||
# disable the test-lock gnulib test prone to deadlock
|
# disable the test-lock gnulib test prone to deadlock
|
||||||
Patch100: coreutils-8.26-test-lock.patch
|
Patch100: coreutils-8.26-test-lock.patch
|
||||||
|
|
||||||
|
@ -104,7 +117,6 @@ Provides: /bin/uname
|
||||||
BuildRequires: attr
|
BuildRequires: attr
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: bison
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: gettext-devel
|
BuildRequires: gettext-devel
|
||||||
BuildRequires: gmp-devel
|
BuildRequires: gmp-devel
|
||||||
|
@ -196,7 +208,11 @@ for type in separate single; do
|
||||||
--enable-no-install-program=kill,uptime \
|
--enable-no-install-program=kill,uptime \
|
||||||
--with-tty-group \
|
--with-tty-group \
|
||||||
DEFAULT_POSIX2_VERSION=200112 alternative=199209 || :
|
DEFAULT_POSIX2_VERSION=200112 alternative=199209 || :
|
||||||
make all %{?_smp_mflags})
|
make all %{?_smp_mflags}
|
||||||
|
|
||||||
|
# make sure that parse-datetime.{c,y} ends up in debuginfo (#1555079)
|
||||||
|
ln -v ../lib/parse-datetime.{c,y} .
|
||||||
|
)
|
||||||
done
|
done
|
||||||
|
|
||||||
# Get the list of supported utilities
|
# Get the list of supported utilities
|
||||||
|
@ -281,6 +297,18 @@ fi
|
||||||
%license COPYING
|
%license COPYING
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon May 28 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-7
|
||||||
|
- ls: increase the allowed abmon width from 5 to 12 (#1577872)
|
||||||
|
- date, ls: pick strftime fixes from glibc to improve locale support (#1577872)
|
||||||
|
|
||||||
|
* Fri Apr 20 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-6
|
||||||
|
- fix crash caused by mistakenly enabled leaf optimization (#1558249)
|
||||||
|
|
||||||
|
* Wed Mar 21 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-5
|
||||||
|
- drop BR for bison, which is not used during the build
|
||||||
|
- make sure that parse-datetime.{c,y} ends up in debuginfo (#1555079)
|
||||||
|
- fix build failure with glibc-2.28
|
||||||
|
|
||||||
* Mon Feb 19 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-4
|
* Mon Feb 19 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-4
|
||||||
- add explicit BR for the gcc compiler
|
- add explicit BR for the gcc compiler
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue