Compare commits

...

No commits in common. "c8" and "c9-beta" have entirely different histories.
c8 ... c9-beta

38 changed files with 3329 additions and 3827 deletions

View File

@ -1 +1 @@
bd5d495c162730873a2774acd1c5091fbf0c55a4 SOURCES/coreutils-8.30.tar.xz b2b12195e276c64c8e850cf40ea2cff9b3aa53f6 SOURCES/coreutils-8.32.tar.xz

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/coreutils-8.30.tar.xz SOURCES/coreutils-8.32.tar.xz

View File

@ -1,32 +0,0 @@
From c6418e3a5cb3a65af79117162a93a66026cc8c36 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 6 Dec 2018 14:28:00 +0100
Subject: [PATCH] doc: improve wording of the --kibibytes option description
Bug: https://bugzilla.redhat.com/1527391
---
doc/coreutils.texi | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 88d6506..772aab6 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -7615,9 +7615,11 @@ Append @samp{*} for executable regular files, otherwise behave as for
@opindex --kibibytes
Set the default block size to its normal value of 1024 bytes,
overriding any contrary specification in environment variables
-(@pxref{Block size}). This option is in turn overridden by the
-@option{--block-size}, @option{-h} or @option{--human-readable}, and
-@option{--si} options.
+(@pxref{Block size}). If @option{--block-size}, @option{-h},
+@option{--human-readable}, or @option{--si} options are used,
+they take precedence over @option{-k} or @option{--kibibytes}
+even if @option{-k} or @option{--kibibytes} is placed after
+the other options.
The @option{-k} or @option{--kibibytes} option affects the
per-directory block count written by the @option{-l} and similar
--
2.17.2

View File

@ -1,686 +0,0 @@
From a13bc34f1eeebdf8b87e4b5a570341bb77a62f76 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
---
DIR_COLORS | 41 ++++---
DIR_COLORS.256color | 300 ++++++++++++++++++++++++------------------------
DIR_COLORS.lightbgcolor | 211 ++++++++++++++++++----------------
3 files changed, 283 insertions(+), 269 deletions(-)
diff --git a/DIR_COLORS b/DIR_COLORS
index d2ea453..27af9d7 100644
--- a/DIR_COLORS
+++ b/DIR_COLORS
@@ -1,6 +1,10 @@
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
+# This file goes in the /etc directory, and must be world readable.
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
+
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copying and distribution of this file, with or without modification,
# are permitted provided the copyright notice and this notice are preserved.
@@ -8,6 +12,9 @@
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
+# For compatibility, the pattern "^COLOR.*none" is recognized as a way to
+# disable colorization. See https://bugzilla.redhat.com/1349579 for details.
+
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
TERM Eterm
@@ -56,7 +63,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;05;37;41 # ... and the files they point to
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
@@ -184,21 +191,21 @@ EXEC 01;32
.ogx 01;35
# audio formats
-.aac 00;36
-.au 00;36
-.flac 00;36
-.m4a 00;36
-.mid 00;36
-.midi 00;36
-.mka 00;36
-.mp3 00;36
-.mpc 00;36
-.ogg 00;36
-.ra 00;36
-.wav 00;36
+.aac 01;36
+.au 01;36
+.flac 01;36
+.m4a 01;36
+.mid 01;36
+.midi 01;36
+.mka 01;36
+.mp3 01;36
+.mpc 01;36
+.ogg 01;36
+.ra 01;36
+.wav 01;36
# https://wiki.xiph.org/MIME_Types_and_File_Extensions
-.oga 00;36
-.opus 00;36
-.spx 00;36
-.xspf 00;36
+.oga 01;36
+.opus 01;36
+.spx 01;36
+.xspf 01;36
diff --git a/DIR_COLORS.256color b/DIR_COLORS.256color
index d2ea453..74c34ba 100644
--- a/DIR_COLORS.256color
+++ b/DIR_COLORS.256color
@@ -1,3 +1,9 @@
+# Configuration file for the 256color ls utility
+
+# This file goes in the /etc directory, and must be world readable.
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
+
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
@@ -8,32 +14,13 @@
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
+# For compatibility, the pattern "^COLOR.*none" is recognized as a way to
+# disable colorization. See https://bugzilla.redhat.com/1349579 for details.
+
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
-TERM Eterm
-TERM ansi
-TERM *color*
-TERM con[0-9]*x[0-9]*
-TERM cons25
-TERM console
-TERM cygwin
-TERM dtterm
-TERM gnome
-TERM hurd
-TERM jfbterm
-TERM konsole
-TERM kterm
-TERM linux
-TERM linux-c
-TERM mlterm
-TERM putty
-TERM rxvt*
-TERM screen*
-TERM st
-TERM terminator
-TERM tmux*
-TERM vt100
-TERM xterm*
+TERM *256color*
+TERM rxvt-unicode256
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
@@ -43,29 +30,40 @@ TERM xterm*
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
+# Text color(256 colors mode) codes:
+# Valid syntax for text 256color is 38;5;<color number> , where color number
+# is number between 0 and 255.
+# You may find following command useful to search the best one for you:
+# for ((x=0; x<=255; x++));do echo -e "${x}:\033[38;5;${x}mcolor\033[000m";done
+# Background color(256 colors mode) codes:
+# Valid syntax for background 256color is 48;5;<color number> , where
+# color number is number between 0 and 255.
+# You may find following command useful to search the best one for you:
+# for ((x=0; x<=255; x++));do echo -e "${x}:\033[48;5;${x}mcolor\033[000m";done
+
#NORMAL 00 # no color code at all
#FILE 00 # regular file: use no color at all
RESET 0 # reset to "normal" color
-DIR 01;34 # directory
-LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
+DIR 38;5;33 # directory
+LINK 38;5;51 # symbolic link. (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.)
MULTIHARDLINK 00 # regular file with more than one link
-FIFO 40;33 # pipe
-SOCK 01;35 # socket
-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
-SETUID 37;41 # file that is setuid (u+s)
-SETGID 30;43 # file that is setgid (g+s)
-CAPABILITY 30;41 # file with capability
-STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
-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
+FIFO 40;38;5;11 # pipe
+SOCK 38;5;13 # socket
+DOOR 38;5;5 # door
+BLK 48;5;232;38;5;11 # block device driver
+CHR 48;5;232;38;5;3 # character device driver
+ORPHAN 48;5;232;38;5;9 # symlink to nonexistent file, or non-stat'able file ...
+MISSING 01;05;37;41 # ... and the files they point to
+SETUID 48;5;196;38;5;15 # file that is setuid (u+s)
+SETGID 48;5;11;38;5;16 # file that is setgid (g+s)
+CAPABILITY 48;5;196;38;5;226 # file with capability
+STICKY_OTHER_WRITABLE 48;5;10;38;5;16 # dir that is sticky and other-writable (+t,o+w)
+OTHER_WRITABLE 48;5;10;38;5;21 # dir that is other-writable (o+w) and not sticky
+STICKY 48;5;21;38;5;15 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
-EXEC 01;32
+EXEC 38;5;40
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
@@ -83,122 +81,122 @@ EXEC 01;32
#.csh 01;32
# archives or compressed (bright red)
-.tar 01;31
-.tgz 01;31
-.arc 01;31
-.arj 01;31
-.taz 01;31
-.lha 01;31
-.lz4 01;31
-.lzh 01;31
-.lzma 01;31
-.tlz 01;31
-.txz 01;31
-.tzo 01;31
-.t7z 01;31
-.zip 01;31
-.z 01;31
-.dz 01;31
-.gz 01;31
-.lrz 01;31
-.lz 01;31
-.lzo 01;31
-.xz 01;31
-.zst 01;31
-.tzst 01;31
-.bz2 01;31
-.bz 01;31
-.tbz 01;31
-.tbz2 01;31
-.tz 01;31
-.deb 01;31
-.rpm 01;31
-.jar 01;31
-.war 01;31
-.ear 01;31
-.sar 01;31
-.rar 01;31
-.alz 01;31
-.ace 01;31
-.zoo 01;31
-.cpio 01;31
-.7z 01;31
-.rz 01;31
-.cab 01;31
-.wim 01;31
-.swm 01;31
-.dwm 01;31
-.esd 01;31
+.tar 38;5;9
+.tgz 38;5;9
+.arc 38;5;9
+.arj 38;5;9
+.taz 38;5;9
+.lha 38;5;9
+.lz4 38;5;9
+.lzh 38;5;9
+.lzma 38;5;9
+.tlz 38;5;9
+.txz 38;5;9
+.tzo 38;5;9
+.t7z 38;5;9
+.zip 38;5;9
+.z 38;5;9
+.dz 38;5;9
+.gz 38;5;9
+.lrz 38;5;9
+.lz 38;5;9
+.lzo 38;5;9
+.xz 38;5;9
+.zst 38;5;9
+.tzst 38;5;9
+.bz2 38;5;9
+.bz 38;5;9
+.tbz 38;5;9
+.tbz2 38;5;9
+.tz 38;5;9
+.deb 38;5;9
+.rpm 38;5;9
+.jar 38;5;9
+.war 38;5;9
+.ear 38;5;9
+.sar 38;5;9
+.rar 38;5;9
+.alz 38;5;9
+.ace 38;5;9
+.zoo 38;5;9
+.cpio 38;5;9
+.7z 38;5;9
+.rz 38;5;9
+.cab 38;5;9
+.wim 38;5;9
+.swm 38;5;9
+.dwm 38;5;9
+.esd 38;5;9
# image formats
-.jpg 01;35
-.jpeg 01;35
-.mjpg 01;35
-.mjpeg 01;35
-.gif 01;35
-.bmp 01;35
-.pbm 01;35
-.pgm 01;35
-.ppm 01;35
-.tga 01;35
-.xbm 01;35
-.xpm 01;35
-.tif 01;35
-.tiff 01;35
-.png 01;35
-.svg 01;35
-.svgz 01;35
-.mng 01;35
-.pcx 01;35
-.mov 01;35
-.mpg 01;35
-.mpeg 01;35
-.m2v 01;35
-.mkv 01;35
-.webm 01;35
-.ogm 01;35
-.mp4 01;35
-.m4v 01;35
-.mp4v 01;35
-.vob 01;35
-.qt 01;35
-.nuv 01;35
-.wmv 01;35
-.asf 01;35
-.rm 01;35
-.rmvb 01;35
-.flc 01;35
-.avi 01;35
-.fli 01;35
-.flv 01;35
-.gl 01;35
-.dl 01;35
-.xcf 01;35
-.xwd 01;35
-.yuv 01;35
-.cgm 01;35
-.emf 01;35
+.jpg 38;5;13
+.jpeg 38;5;13
+.mjpg 38;5;13
+.mjpeg 38;5;13
+.gif 38;5;13
+.bmp 38;5;13
+.pbm 38;5;13
+.pgm 38;5;13
+.ppm 38;5;13
+.tga 38;5;13
+.xbm 38;5;13
+.xpm 38;5;13
+.tif 38;5;13
+.tiff 38;5;13
+.png 38;5;13
+.svg 38;5;13
+.svgz 38;5;13
+.mng 38;5;13
+.pcx 38;5;13
+.mov 38;5;13
+.mpg 38;5;13
+.mpeg 38;5;13
+.m2v 38;5;13
+.mkv 38;5;13
+.webm 38;5;13
+.ogm 38;5;13
+.mp4 38;5;13
+.m4v 38;5;13
+.mp4v 38;5;13
+.vob 38;5;13
+.qt 38;5;13
+.nuv 38;5;13
+.wmv 38;5;13
+.asf 38;5;13
+.rm 38;5;13
+.rmvb 38;5;13
+.flc 38;5;13
+.avi 38;5;13
+.fli 38;5;13
+.flv 38;5;13
+.gl 38;5;13
+.dl 38;5;13
+.xcf 38;5;13
+.xwd 38;5;13
+.yuv 38;5;13
+.cgm 38;5;13
+.emf 38;5;13
# https://wiki.xiph.org/MIME_Types_and_File_Extensions
-.ogv 01;35
-.ogx 01;35
+.ogv 38;5;13
+.ogx 38;5;13
# audio formats
-.aac 00;36
-.au 00;36
-.flac 00;36
-.m4a 00;36
-.mid 00;36
-.midi 00;36
-.mka 00;36
-.mp3 00;36
-.mpc 00;36
-.ogg 00;36
-.ra 00;36
-.wav 00;36
+.aac 38;5;45
+.au 38;5;45
+.flac 38;5;45
+.m4a 38;5;45
+.mid 38;5;45
+.midi 38;5;45
+.mka 38;5;45
+.mp3 38;5;45
+.mpc 38;5;45
+.ogg 38;5;45
+.ra 38;5;45
+.wav 38;5;45
# https://wiki.xiph.org/MIME_Types_and_File_Extensions
-.oga 00;36
-.opus 00;36
-.spx 00;36
-.xspf 00;36
+.oga 38;5;45
+.opus 38;5;45
+.spx 38;5;45
+.xspf 38;5;45
diff --git a/DIR_COLORS.lightbgcolor b/DIR_COLORS.lightbgcolor
index d2ea453..95d6879 100644
--- a/DIR_COLORS.lightbgcolor
+++ b/DIR_COLORS.lightbgcolor
@@ -1,3 +1,9 @@
+# Configuration file for the color ls utility - modified for lighter backgrounds
+
+# This file goes in the /etc directory, and must be world readable.
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
+
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
@@ -8,6 +14,9 @@
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
+# For compatibility, the pattern "^COLOR.*none" is recognized as a way to
+# disable colorization. See https://bugzilla.redhat.com/1349579 for details.
+
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
TERM Eterm
@@ -46,17 +55,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
-DIR 01;34 # directory
-LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
+DIR 00;34 # directory
+LINK 00;36 # symbolic link. (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.)
MULTIHARDLINK 00 # regular file with more than one link
FIFO 40;33 # pipe
-SOCK 01;35 # socket
-DOOR 01;35 # door
+SOCK 00;35 # socket
+DOOR 00;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;05;37;41 # ... and the files they point to
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
@@ -65,7 +74,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 files with execute permission:
-EXEC 01;32
+EXEC 00;32
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
@@ -83,105 +92,105 @@ EXEC 01;32
#.csh 01;32
# archives or compressed (bright red)
-.tar 01;31
-.tgz 01;31
-.arc 01;31
-.arj 01;31
-.taz 01;31
-.lha 01;31
-.lz4 01;31
-.lzh 01;31
-.lzma 01;31
-.tlz 01;31
-.txz 01;31
-.tzo 01;31
-.t7z 01;31
-.zip 01;31
-.z 01;31
-.dz 01;31
-.gz 01;31
-.lrz 01;31
-.lz 01;31
-.lzo 01;31
-.xz 01;31
-.zst 01;31
-.tzst 01;31
-.bz2 01;31
-.bz 01;31
-.tbz 01;31
-.tbz2 01;31
-.tz 01;31
-.deb 01;31
-.rpm 01;31
-.jar 01;31
-.war 01;31
-.ear 01;31
-.sar 01;31
-.rar 01;31
-.alz 01;31
-.ace 01;31
-.zoo 01;31
-.cpio 01;31
-.7z 01;31
-.rz 01;31
-.cab 01;31
-.wim 01;31
-.swm 01;31
-.dwm 01;31
-.esd 01;31
+.tar 00;31
+.tgz 00;31
+.arc 00;31
+.arj 00;31
+.taz 00;31
+.lha 00;31
+.lz4 00;31
+.lzh 00;31
+.lzma 00;31
+.tlz 00;31
+.txz 00;31
+.tzo 00;31
+.t7z 00;31
+.zip 00;31
+.z 00;31
+.dz 00;31
+.gz 00;31
+.lrz 00;31
+.lz 00;31
+.lzo 00;31
+.xz 00;31
+.zst 00;31
+.tzst 00;31
+.bz2 00;31
+.bz 00;31
+.tbz 00;31
+.tbz2 00;31
+.tz 00;31
+.deb 00;31
+.rpm 00;31
+.jar 00;31
+.war 00;31
+.ear 00;31
+.sar 00;31
+.rar 00;31
+.alz 00;31
+.ace 00;31
+.zoo 00;31
+.cpio 00;31
+.7z 00;31
+.rz 00;31
+.cab 00;31
+.wim 00;31
+.swm 00;31
+.dwm 00;31
+.esd 00;31
# image formats
-.jpg 01;35
-.jpeg 01;35
-.mjpg 01;35
-.mjpeg 01;35
-.gif 01;35
-.bmp 01;35
-.pbm 01;35
-.pgm 01;35
-.ppm 01;35
-.tga 01;35
-.xbm 01;35
-.xpm 01;35
-.tif 01;35
-.tiff 01;35
-.png 01;35
-.svg 01;35
-.svgz 01;35
-.mng 01;35
-.pcx 01;35
-.mov 01;35
-.mpg 01;35
-.mpeg 01;35
-.m2v 01;35
-.mkv 01;35
-.webm 01;35
-.ogm 01;35
-.mp4 01;35
-.m4v 01;35
-.mp4v 01;35
-.vob 01;35
-.qt 01;35
-.nuv 01;35
-.wmv 01;35
-.asf 01;35
-.rm 01;35
-.rmvb 01;35
-.flc 01;35
-.avi 01;35
-.fli 01;35
-.flv 01;35
-.gl 01;35
-.dl 01;35
-.xcf 01;35
-.xwd 01;35
-.yuv 01;35
-.cgm 01;35
-.emf 01;35
+.jpg 00;35
+.jpeg 00;35
+.mjpg 00;35
+.mjpeg 00;35
+.gif 00;35
+.bmp 00;35
+.pbm 00;35
+.pgm 00;35
+.ppm 00;35
+.tga 00;35
+.xbm 00;35
+.xpm 00;35
+.tif 00;35
+.tiff 00;35
+.png 00;35
+.svg 00;35
+.svgz 00;35
+.mng 00;35
+.pcx 00;35
+.mov 00;35
+.mpg 00;35
+.mpeg 00;35
+.m2v 00;35
+.mkv 00;35
+.webm 00;35
+.ogm 00;35
+.mp4 00;35
+.m4v 00;35
+.mp4v 00;35
+.vob 00;35
+.qt 00;35
+.nuv 00;35
+.wmv 00;35
+.asf 00;35
+.rm 00;35
+.rmvb 00;35
+.flc 00;35
+.avi 00;35
+.fli 00;35
+.flv 00;35
+.gl 00;35
+.dl 00;35
+.xcf 00;35
+.xwd 00;35
+.yuv 00;35
+.cgm 00;35
+.emf 00;35
# https://wiki.xiph.org/MIME_Types_and_File_Extensions
-.ogv 01;35
-.ogx 01;35
+.ogv 00;35
+.ogx 00;35
# audio formats
.aac 00;36
--
2.5.5

View File

@ -1,69 +0,0 @@
From 6d059cebfdefbdf56910a858f8b603d37f10ef6d Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sun, 23 Sep 2018 14:13:52 +0200
Subject: [PATCH] vasnprintf: Fix heap memory overrun bug.
Reported by Ben Pfaff <blp@cs.stanford.edu> in
<https://lists.gnu.org/archive/html/bug-gnulib/2018-09/msg00107.html>.
* lib/vasnprintf.c (convert_to_decimal): Allocate one more byte of
memory.
* tests/test-vasnprintf.c (test_function): Add another test.
Upstream-commit: 278b4175c9d7dd47c1a3071554aac02add3b3c35
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
gnulib-tests/test-vasnprintf.c | 21 ++++++++++++++++++++-
lib/vasnprintf.c | 4 +++-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/gnulib-tests/test-vasnprintf.c b/gnulib-tests/test-vasnprintf.c
index 19731bc..93d81d7 100644
--- a/gnulib-tests/test-vasnprintf.c
+++ b/gnulib-tests/test-vasnprintf.c
@@ -53,7 +53,26 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
ASSERT (result != NULL);
ASSERT (strcmp (result, "12345") == 0);
ASSERT (length == 5);
- if (size < 6)
+ if (size < 5 + 1)
+ ASSERT (result != buf);
+ ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0);
+ if (result != buf)
+ free (result);
+ }
+
+ /* Note: This test assumes IEEE 754 representation of 'double' floats. */
+ for (size = 0; size <= 8; size++)
+ {
+ size_t length;
+ char *result;
+
+ memcpy (buf, "DEADBEEF", 8);
+ length = size;
+ result = my_asnprintf (buf, &length, "%2.0f", 1.6314159265358979e+125);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "163141592653589790215729350939528493057529598899734151772468186268423257777068536614838678161083520756952076273094236944990208") == 0);
+ ASSERT (length == 126);
+ if (size < 126 + 1)
ASSERT (result != buf);
ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0);
if (result != buf)
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 3b441d0..48ef7a6 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -860,7 +860,9 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
size_t a_len = a.nlimbs;
/* 0.03345 is slightly larger than log(2)/(9*log(10)). */
size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1);
- char *c_ptr = (char *) malloc (xsum (c_len, extra_zeroes));
+ /* We need extra_zeroes bytes for zeroes, followed by c_len bytes for the
+ digits of a, followed by 1 byte for the terminating NUL. */
+ char *c_ptr = (char *) malloc (xsum (xsum (extra_zeroes, c_len), 1));
if (c_ptr != NULL)
{
char *d_ptr = c_ptr;
--
2.17.1

View File

@ -1,42 +0,0 @@
From 5d6c2c9b3869938592025ce169659f0c7e9970fc Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Mon, 2 Dec 2019 14:02:02 +0100
Subject: [PATCH] chcon: do not validate security context if SELinux is
disabled
* src/chcon.c (main): Skip call of security_check_context()
in case SELinux is disabled to avoid unnecessary failure.
Bug: https://bugzilla.redhat.com/1777831
Upstream-commit: 5118a2e392c8cffb3c26eaffbb75e2b1ef7607f9
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/chcon.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/chcon.c b/src/chcon.c
index 6414406..eea4235 100644
--- a/src/chcon.c
+++ b/src/chcon.c
@@ -18,6 +18,7 @@
#include <stdio.h>
#include <sys/types.h>
#include <getopt.h>
+#include <selinux/selinux.h>
#include "system.h"
#include "dev-ino.h"
@@ -557,7 +558,8 @@ main (int argc, char **argv)
else
{
specified_context = argv[optind++];
- if (security_check_context (se_const (specified_context)) < 0)
+ if (0 < is_selinux_enabled ()
+ && security_check_context (se_const (specified_context)) < 0)
die (EXIT_FAILURE, errno, _("invalid context: %s"),
quote (specified_context));
}
--
2.21.1

View File

@ -1,69 +0,0 @@
From ce137aaf4b0d62b3e4c88816485a3ab0f5c4b3f3 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 6 Dec 2018 13:14:00 +0100
Subject: [PATCH] cp --preserve=xattr: preserve NFSv4 ACL extended attributes
... that cannot be preserved by other means
---
src/copy.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/copy.c b/src/copy.c
index 1a9cdd1..d227e3e 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -640,6 +640,17 @@ copy_attr_free (struct error_context *ctx _GL_UNUSED,
{
}
+/* Include NFSv4 ACL extended attributes that cannot be preserved by
+ other means. Otherwise honor attributes configured for exclusion
+ in /etc/xattr.conf. Return zero to skip. */
+static int
+check_not_nfs4_acl (const char *name, struct error_context *ctx)
+{
+ return attr_copy_check_permissions(name, ctx)
+ || !STRNCMP_LIT (name, "system.nfs4_acl")
+ || !STRNCMP_LIT (name, "system.nfs4acl");
+}
+
/* Exclude SELinux extended attributes that are otherwise handled,
and are problematic to copy again. Also honor attributes
configured for exclusion in /etc/xattr.conf.
@@ -649,7 +660,7 @@ static int
check_selinux_attr (const char *name, struct error_context *ctx)
{
return STRNCMP_LIT (name, "security.selinux")
- && attr_copy_check_permissions (name, ctx);
+ && check_not_nfs4_acl (name, ctx);
}
/* If positive SRC_FD and DST_FD descriptors are passed,
@@ -663,6 +674,9 @@ copy_attr (char const *src_path, int src_fd,
bool all_errors = (!x->data_copy_required || x->require_preserve_xattr);
bool some_errors = (!all_errors && !x->reduce_diagnostics);
bool selinux_done = (x->preserve_security_context || x->set_security_context);
+ int (*check) (const char *, struct error_context *) = (selinux_done)
+ ? check_selinux_attr
+ : check_not_nfs4_acl;
struct error_context ctx =
{
.error = all_errors ? copy_attr_allerror : copy_attr_error,
@@ -670,12 +684,10 @@ copy_attr (char const *src_path, int src_fd,
.quote_free = copy_attr_free
};
if (0 <= src_fd && 0 <= dst_fd)
- ret = attr_copy_fd (src_path, src_fd, dst_path, dst_fd,
- selinux_done ? check_selinux_attr : NULL,
+ ret = attr_copy_fd (src_path, src_fd, dst_path, dst_fd, check,
(all_errors || some_errors ? &ctx : NULL));
else
- ret = attr_copy_file (src_path, dst_path,
- selinux_done ? check_selinux_attr : NULL,
+ ret = attr_copy_file (src_path, dst_path, check,
(all_errors || some_errors ? &ctx : NULL));
return ret == 0;
--
2.17.2

View File

@ -1,74 +0,0 @@
From b60a61d7e5f6504518095d9ee8c7c8b185bedb23 Mon Sep 17 00:00:00 2001
From: Marc Dionne <marc.dionne@auristor.com>
Date: Wed, 5 Feb 2020 13:35:12 -0800
Subject: [PATCH 1/2] mountlist: Consider AFS filesystems as remote
df --local relies on the ME_REMOTE macro to determine if a given
mount entry should be considered "local". There is special logic
for nfs and smb/cifs mounts, but /afs as mounted by OpenAFS, the
kernel's kafs module or AuriStorFS is treated as a local mount.
* lib/mountlist.c (ME_REMOTE): Treat mounts of type 'afs'
(OpenAFS, kernel kafs) and 'auristorfs' (AuriStorFS) as remote.
Copyright-paperwork-exempt: yes
Upstream-commit: 7a15069b68a376f26c5dca34ae2689c5bf8adc99
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
lib/mountlist.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/mountlist.c b/lib/mountlist.c
index b691f38..1b1e5e4 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -224,6 +224,7 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
#ifndef ME_REMOTE
/* A file system is "remote" if its Fs_name contains a ':'
or if (it is of type (smbfs or cifs) and its Fs_name starts with '//')
+ or if it is of type (afs or auristorfs)
or Fs_name is equal to "-hosts" (used by autofs to mount remote fs). */
# define ME_REMOTE(Fs_name, Fs_type) \
(strchr (Fs_name, ':') != NULL \
@@ -231,6 +232,8 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
&& (Fs_name)[1] == '/' \
&& (strcmp (Fs_type, "smbfs") == 0 \
|| strcmp (Fs_type, "cifs") == 0)) \
+ || strcmp (Fs_type, "afs") == 0 \
+ || strcmp (Fs_type, "auristorfs") == 0 \
|| (strcmp("-hosts", Fs_name) == 0))
#endif
--
2.21.1
From 41010dfb0cc100f41fb16d93f9fa36dc07e63ac6 Mon Sep 17 00:00:00 2001
From: Kenneth D'souza <kdsouza@redhat.com>
Date: Sat, 8 Feb 2020 13:54:35 +0000
Subject: [PATCH 2/2] mountlist: consider smb3 file systems as remote
* lib/mountlist.c (ME_REMOTE): Recognize file systems of type
"smb3" as remote.
Upstream-commit: 4d4a22ab1f719b7c6c3fe3dbf45d11baafd3c563
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
lib/mountlist.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/mountlist.c b/lib/mountlist.c
index 1b1e5e4..8ad74a2 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -231,6 +231,7 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
|| ((Fs_name)[0] == '/' \
&& (Fs_name)[1] == '/' \
&& (strcmp (Fs_type, "smbfs") == 0 \
+ || strcmp (Fs_type, "smb3") == 0 \
|| strcmp (Fs_type, "cifs") == 0)) \
|| strcmp (Fs_type, "afs") == 0 \
|| strcmp (Fs_type, "auristorfs") == 0 \
--
2.21.1

View File

@ -1,77 +0,0 @@
From 2eabfbee57be82f755c74cbb05755dce1469ea7c Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 6 Nov 2018 10:35:16 -0800
Subject: [PATCH 1/2] sync: fix open fallback bug
Problem caught by Coverity Analysis
and reported by Kamil Dudka (Bug#33287).
* src/sync.c (sync_arg): Fix typo in fallback code.
Upstream-commit: 94d364f157f007f2b23c70863ac8eefe9b21229d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/sync.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/sync.c b/src/sync.c
index bd3671a..607fa8f 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -111,8 +111,10 @@ sync_arg (enum sync_mode mode, char const *file)
if (open_flags != (O_WRONLY | O_NONBLOCK))
fd = open (file, O_WRONLY | O_NONBLOCK);
if (fd < 0)
- error (0, rd_errno, _("error opening %s"), quoteaf (file));
- return false;
+ {
+ error (0, rd_errno, _("error opening %s"), quoteaf (file));
+ return false;
+ }
}
/* We used O_NONBLOCK above to not hang with fifos,
--
2.17.2
From e62ff3068f1f1b1e84d3319f54f1b869bb0bf6cc Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Wed, 7 Nov 2018 00:26:01 +0100
Subject: [PATCH 2/2] sync: add test for the fix in the previous commit
* tests/misc/sync.sh: Add a test with a write-only file for the fix.
Upstream-commit: 4711c49312d54e84996c13c612f7081c95f821a6
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
tests/misc/sync.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/misc/sync.sh b/tests/misc/sync.sh
index f60d28c..3bb6e17 100755
--- a/tests/misc/sync.sh
+++ b/tests/misc/sync.sh
@@ -19,7 +19,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ sync
-touch file
+touch file || framework_failure_
# fdatasync+syncfs is nonsensical
returns_ 1 sync --data --file-system || fail=1
@@ -30,6 +30,11 @@ returns_ 1 sync -d || fail=1
# Test syncing of file (fsync) (little side effects)
sync file || fail=1
+# Test syncing of write-only file - which failed since adding argument
+# support to sync in coreutils-8.24.
+chmod 0200 file || framework_failure_
+sync file || fail=1
+
# Ensure multiple args are processed and diagnosed
returns_ 1 sync file nofile || fail=1
--
2.17.2

View File

@ -1,451 +0,0 @@
From 57ee8db4fee8eb6772df1ff18d275594c0b034d4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 5 Jul 2018 09:22:09 -0700
Subject: [PATCH 1/2] renameatu: rename from renameat2
It's looking like Glibc will add a renameat2 function
that is incompatible with Gnulib renameat2; see:
https://sourceware.org/ml/libc-alpha/2018-07/msg00064.html
To help avoid future confusion, rename renameat2 to something else.
Use the name 'renameatu', as the Gnulib function is close to the
Glibc function. Perhaps someday there will also be a renameat2
Gnulib module, which mimicks the future glibc renameat2, but that
can wait as nobody seems to need such a module now.
* NEWS: Mention this.
* lib/renameatu.c: Rename from lib/renameat2.c.
* lib/renameatu.h: Rename from lib/renameat2.h.
* modules/renameatu: Rename from modules/renameat2.
* modules/renameatu-tests: Rename from modules/renameat2-tests.
All uses of "renameat2" in identifiers or file name
changed to "renameatu", except for two instances in
lib/renameatu.c that deal with the Linux kernel's
renameat2 syscall.
Upstream-commit: 2522322e5304e7d86c63e607e2bc83c8d8b0a889
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
gnulib-tests/gnulib.mk | 12 +++---
.../{test-renameat2.c => test-renameatu.c} | 48 +++++++++++-----------
lib/backupfile.c | 4 +-
lib/gnulib.mk | 10 ++---
lib/renameat.c | 4 +-
lib/{renameat2.c => renameatu.c} | 9 ++--
lib/{renameat2.h => renameatu.h} | 8 ++--
7 files changed, 48 insertions(+), 47 deletions(-)
rename gnulib-tests/{test-renameat2.c => test-renameatu.c} (80%)
rename lib/{renameat2.c => renameatu.c} (94%)
rename lib/{renameat2.h => renameatu.h} (84%)
diff --git a/gnulib-tests/gnulib.mk b/gnulib-tests/gnulib.mk
index be2b99e..891425b 100644
--- a/gnulib-tests/gnulib.mk
+++ b/gnulib-tests/gnulib.mk
@@ -1750,14 +1750,14 @@ EXTRA_DIST += test-rename.h test-renameat.c signature.h macros.h
## end gnulib module renameat-tests
-## begin gnulib module renameat2-tests
+## begin gnulib module renameatu-tests
-TESTS += test-renameat2
-check_PROGRAMS += test-renameat2
-test_renameat2_LDADD = $(LDADD) @LIBINTL@
-EXTRA_DIST += test-rename.h test-renameat2.c signature.h macros.h
+TESTS += test-renameatu
+check_PROGRAMS += test-renameatu
+test_renameatu_LDADD = $(LDADD) @LIBINTL@
+EXTRA_DIST += test-rename.h test-renameatu.c signature.h macros.h
-## end gnulib module renameat2-tests
+## end gnulib module renameatu-tests
## begin gnulib module rmdir-tests
diff --git a/gnulib-tests/test-renameat2.c b/gnulib-tests/test-renameatu.c
similarity index 80%
rename from gnulib-tests/test-renameat2.c
rename to gnulib-tests/test-renameatu.c
index 0104890..988428b 100644
--- a/gnulib-tests/test-renameat2.c
+++ b/gnulib-tests/test-renameatu.c
@@ -1,4 +1,4 @@
-/* Test renameat2.
+/* Test renameatu.
Copyright (C) 2009-2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -18,12 +18,12 @@
#include <config.h>
-#include <renameat2.h>
+#include <renameatu.h>
#include <stdio.h>
#include "signature.h"
-SIGNATURE_CHECK (renameat2, int,
+SIGNATURE_CHECK (renameatu, int,
(int, char const *, int, char const *, unsigned int));
#include <dirent.h>
@@ -39,18 +39,18 @@ SIGNATURE_CHECK (renameat2, int,
#include "ignore-value.h"
#include "macros.h"
-#define BASE "test-renameat2.t"
+#define BASE "test-renameatu.t"
#include "test-rename.h"
static int dfd1 = AT_FDCWD;
static int dfd2 = AT_FDCWD;
-/* Wrapper to test renameat2 like rename. */
+/* Wrapper to test renameatu like rename. */
static int
do_rename (char const *name1, char const *name2)
{
- return renameat2 (dfd1, name1, dfd2, name2, 0);
+ return renameatu (dfd1, name1, dfd2, name2, 0);
}
int
@@ -67,24 +67,24 @@ main (void)
/* Test behaviour for invalid file descriptors. */
{
errno = 0;
- ASSERT (renameat2 (-1, "foo", AT_FDCWD, "bar", 0) == -1);
+ ASSERT (renameatu (-1, "foo", AT_FDCWD, "bar", 0) == -1);
ASSERT (errno == EBADF);
}
{
close (99);
errno = 0;
- ASSERT (renameat2 (99, "foo", AT_FDCWD, "bar", 0) == -1);
+ ASSERT (renameatu (99, "foo", AT_FDCWD, "bar", 0) == -1);
ASSERT (errno == EBADF);
}
ASSERT (close (creat (BASE "oo", 0600)) == 0);
{
errno = 0;
- ASSERT (renameat2 (AT_FDCWD, BASE "oo", -1, "bar", 0) == -1);
+ ASSERT (renameatu (AT_FDCWD, BASE "oo", -1, "bar", 0) == -1);
ASSERT (errno == EBADF);
}
{
errno = 0;
- ASSERT (renameat2 (AT_FDCWD, BASE "oo", 99, "bar", 0) == -1);
+ ASSERT (renameatu (AT_FDCWD, BASE "oo", 99, "bar", 0) == -1);
ASSERT (errno == EBADF);
}
ASSERT (unlink (BASE "oo") == 0);
@@ -133,13 +133,13 @@ main (void)
ASSERT (sprintf (strchr (file1, '\0') - 2, "%02d", i) == 2);
ASSERT (sprintf (strchr (file2, '\0') - 2, "%02d", i + 1) == 2);
- ASSERT (renameat2 (fd1, file1, fd2, file2, 0) == 0);
+ ASSERT (renameatu (fd1, file1, fd2, file2, 0) == 0);
free (file1);
free (file2);
}
dfd2 = open ("..", O_RDONLY);
ASSERT (0 <= dfd2);
- ASSERT (renameat2 (dfd, "../" BASE "16", dfd2, BASE "17", 0) == 0);
+ ASSERT (renameatu (dfd, "../" BASE "16", dfd2, BASE "17", 0) == 0);
ASSERT (close (dfd2) == 0);
/* Now we change back to the parent directory, and set dfd to ".";
@@ -152,47 +152,47 @@ main (void)
ASSERT (close (creat (BASE "sub2/file", 0600)) == 0);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "sub1", dfd, BASE "sub2", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "sub1", dfd, BASE "sub2", 0) == -1);
ASSERT (errno == EEXIST || errno == ENOTEMPTY);
ASSERT (unlink (BASE "sub2/file") == 0);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "sub2", dfd, BASE "sub1/.", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "sub2", dfd, BASE "sub1/.", 0) == -1);
ASSERT (errno == EINVAL || errno == EISDIR || errno == EBUSY
|| errno == ENOTEMPTY || errno == EEXIST
|| errno == ENOENT /* WSL */);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "sub2/.", dfd, BASE "sub1", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "sub2/.", dfd, BASE "sub1", 0) == -1);
ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST
|| errno == ENOENT /* WSL */);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "17", dfd, BASE "sub1", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "17", dfd, BASE "sub1", 0) == -1);
ASSERT (errno == EISDIR);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "nosuch", dfd, BASE "18", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "nosuch", dfd, BASE "18", 0) == -1);
ASSERT (errno == ENOENT);
errno = 0;
- ASSERT (renameat2 (dfd, "", dfd, BASE "17", 0) == -1);
+ ASSERT (renameatu (dfd, "", dfd, BASE "17", 0) == -1);
ASSERT (errno == ENOENT);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "17", dfd, "", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "17", dfd, "", 0) == -1);
ASSERT (errno == ENOENT);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "sub2", dfd, BASE "17", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "sub2", dfd, BASE "17", 0) == -1);
ASSERT (errno == ENOTDIR);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "17/", dfd, BASE "18", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "17/", dfd, BASE "18", 0) == -1);
ASSERT (errno == ENOTDIR);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "17", dfd, BASE "18/", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "17", dfd, BASE "18/", 0) == -1);
ASSERT (errno == ENOTDIR || errno == ENOENT);
/* Finally, make sure we cannot overwrite existing files. */
ASSERT (close (creat (BASE "sub2/file", 0600)) == 0);
errno = 0;
- ASSERT ((renameat2 (dfd, BASE "sub2", dfd, BASE "sub1", RENAME_NOREPLACE)
+ ASSERT ((renameatu (dfd, BASE "sub2", dfd, BASE "sub1", RENAME_NOREPLACE)
== -1)
&& errno == EEXIST);
- ASSERT ((renameat2 (dfd, BASE "sub2/file", dfd, BASE "17", RENAME_NOREPLACE)
+ ASSERT ((renameatu (dfd, BASE "sub2/file", dfd, BASE "17", RENAME_NOREPLACE)
== -1)
&& errno == EEXIST);
diff --git a/lib/backupfile.c b/lib/backupfile.c
index d438455..637be6c 100644
--- a/lib/backupfile.c
+++ b/lib/backupfile.c
@@ -23,7 +23,7 @@
#include "backup-internal.h"
#include "dirname.h"
-#include "renameat2.h"
+#include "renameatu.h"
#include "xalloc-oversized.h"
#include <fcntl.h>
@@ -353,7 +353,7 @@ backupfile_internal (char const *file, enum backup_type backup_type, bool rename
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)
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 04473d5..0b747e3 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --local-dir=gl --lib=libcoreutils --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=gnulib-tests --aux-dir=build-aux --with-tests --avoid=canonicalize-lgpl --avoid=dummy --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl acl alignof alloca announce-gen areadlink-with-size argmatch argv-iter assert autobuild backup-rename backupfile base32 base64 buffer-lcm c-strcase c-strtod c-strtold calloc-gnu canon-host canonicalize chown cloexec closein closeout config-h configmake crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 cycle-check d-ino d-type di-set diacrit dirfd dirname do-release-commit-and-tag dtoastr dup2 environ error euidaccess exclude exitfail explicit_bzero faccessat fadvise fchdir fchmodat fchownat fclose fcntl fcntl-safer fd-reopen fdatasync fdl fdopen fdutimensat file-has-acl file-type fileblocks filemode filenamecat filevercmp flexmember fnmatch-gnu fopen-safer fprintftime freopen freopen-safer fseeko fstatat fsusage fsync ftoastr ftruncate fts full-read full-write getgroups gethrxtime getline getloadavg getlogin getndelim2 getopt-gnu getpagesize getpass-gnu gettext-h gettime gettimeofday getugroups getusershell git-version-gen gitlog-to-changelog gnu-make gnu-web-doc-update gnumakefile gnupload group-member hard-locale hash hash-pjw heap host-os human idcache ignore-value inttostr inttypes isapipe isatty isblank largefile lchmod lchown ldtoastr lib-ignore linebuffer link link-follow linkat long-options lstat maintainer-makefile malloc-gnu manywarnings mbrlen mbrtowc mbsalign mbschr mbslen mbswidth memcasecmp memchr memcmp2 mempcpy memrchr mgetgroups mkancesdirs mkdir mkdir-p mkfifo mknod mkostemp mkstemp mktime modechange mountlist mpsort netinet_in non-recursive-gnulib-prefix-hack nproc nstrftime obstack open parse-datetime pathmax perl physmem pipe-posix pipe2 posix-shell posixtm posixver priv-set progname propername pthread putenv quote quotearg randint randperm read-file readlink readtokens readtokens0 readutmp realloc-gnu regex remove rename renameat renameat2 rmdir root-dev-ino rpmatch safe-read same save-cwd savedir savewd selinux-at setenv settime sig2str sigaction smack ssize_t stat-macros stat-size stat-time statat stdbool stdlib-safer stpcpy stpncpy strdup-posix strncat strnumcmp strsignal strtod strtoimax strtoumax symlinkat sys_ioctl sys_resource sys_stat sys_wait tempname termios time_rz timer-time timespec tzset uname unicodeio unistd-safer unlink-busy unlinkat unlocked-io unsetenv update-copyright uptime useless-if-before-free userspec utimecmp utimens vasprintf-posix vc-list-files verify verror version-etc-fsf wchar-single wcswidth wcwidth winsz-ioctl winsz-termios write-any-file xalloc xbinary-io xdectoint xfts xgetcwd xgetgroups xgethostname xmemcoll xnanosleep xprintf xprintf-posix xreadlink xstrtod xstrtoimax xstrtol xstrtold xstrtoumax year2038 yesno
+# Reproduce by: gnulib-tool --import --local-dir=gl --lib=libcoreutils --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=gnulib-tests --aux-dir=build-aux --with-tests --avoid=canonicalize-lgpl --avoid=dummy --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl acl alignof alloca announce-gen areadlink-with-size argmatch argv-iter assert autobuild backup-rename backupfile base32 base64 buffer-lcm c-strcase c-strtod c-strtold calloc-gnu canon-host canonicalize chown cloexec closein closeout config-h configmake crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 cycle-check d-ino d-type di-set diacrit dirfd dirname do-release-commit-and-tag dtoastr dup2 environ error euidaccess exclude exitfail explicit_bzero faccessat fadvise fchdir fchmodat fchownat fclose fcntl fcntl-safer fd-reopen fdatasync fdl fdopen fdutimensat file-has-acl file-type fileblocks filemode filenamecat filevercmp flexmember fnmatch-gnu fopen-safer fprintftime freopen freopen-safer fseeko fstatat fsusage fsync ftoastr ftruncate fts full-read full-write getgroups gethrxtime getline getloadavg getlogin getndelim2 getopt-gnu getpagesize getpass-gnu gettext-h gettime gettimeofday getugroups getusershell git-version-gen gitlog-to-changelog gnu-make gnu-web-doc-update gnumakefile gnupload group-member hard-locale hash hash-pjw heap host-os human idcache ignore-value inttostr inttypes isapipe isatty isblank largefile lchmod lchown ldtoastr lib-ignore linebuffer link link-follow linkat long-options lstat maintainer-makefile malloc-gnu manywarnings mbrlen mbrtowc mbsalign mbschr mbslen mbswidth memcasecmp memchr memcmp2 mempcpy memrchr mgetgroups mkancesdirs mkdir mkdir-p mkfifo mknod mkostemp mkstemp mktime modechange mountlist mpsort netinet_in non-recursive-gnulib-prefix-hack nproc nstrftime obstack open parse-datetime pathmax perl physmem pipe-posix pipe2 posix-shell posixtm posixver priv-set progname propername pthread putenv quote quotearg randint randperm read-file readlink readtokens readtokens0 readutmp realloc-gnu regex remove rename renameat renameatu rmdir root-dev-ino rpmatch safe-read same save-cwd savedir savewd selinux-at setenv settime sig2str sigaction smack ssize_t stat-macros stat-size stat-time statat stdbool stdlib-safer stpcpy stpncpy strdup-posix strncat strnumcmp strsignal strtod strtoimax strtoumax symlinkat sys_ioctl sys_resource sys_stat sys_wait tempname termios time_rz timer-time timespec tzset uname unicodeio unistd-safer unlink-busy unlinkat unlocked-io unsetenv update-copyright uptime useless-if-before-free userspec utimecmp utimens vasprintf-posix vc-list-files verify verror version-etc-fsf wchar-single wcswidth wcwidth winsz-ioctl winsz-termios write-any-file xalloc xbinary-io xdectoint xfts xgetcwd xgetgroups xgethostname xmemcoll xnanosleep xprintf xprintf-posix xreadlink xstrtod xstrtoimax xstrtol xstrtold xstrtoumax year2038 yesno
MOSTLYCLEANFILES += lib/core lib/*.stackdump
@@ -3218,15 +3218,15 @@ EXTRA_lib_libcoreutils_a_SOURCES += lib/renameat.c
## end gnulib module renameat
-## begin gnulib module renameat2
+## begin gnulib module renameatu
-lib_libcoreutils_a_SOURCES += lib/renameat2.c
+lib_libcoreutils_a_SOURCES += lib/renameatu.c
-EXTRA_DIST += lib/at-func2.c lib/renameat2.h
+EXTRA_DIST += lib/at-func2.c lib/renameatu.h
EXTRA_lib_libcoreutils_a_SOURCES += lib/at-func2.c
-## end gnulib module renameat2
+## end gnulib module renameatu
## begin gnulib module rewinddir
diff --git a/lib/renameat.c b/lib/renameat.c
index 0cb7d33..67be22b 100644
--- a/lib/renameat.c
+++ b/lib/renameat.c
@@ -16,10 +16,10 @@
#include <config.h>
#include <stdio.h>
-#include "renameat2.h"
+#include "renameatu.h"
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);
}
diff --git a/lib/renameat2.c b/lib/renameatu.c
similarity index 94%
rename from lib/renameat2.c
rename to lib/renameatu.c
index a295ec3..b013ad6 100644
--- a/lib/renameat2.c
+++ b/lib/renameatu.c
@@ -18,7 +18,7 @@
#include <config.h>
-#include "renameat2.h"
+#include "renameatu.h"
#include <errno.h>
#include <stdio.h>
@@ -68,10 +68,13 @@ rename_noreplace (char const *src, char const *dst)
the restore_cwd fails, then give a diagnostic and exit nonzero.
Obey FLAGS when doing the renaming. If FLAGS is zero, this
- function is equivalent to renameat (FD1, SRC, FD2, DST). */
+ function is equivalent to renameat (FD1, SRC, FD2, DST).
+ Otherwise, attempt to implement FLAGS even if the implementation is
+ not atomic; this differs from the GNU/Linux native renameat2,
+ which fails if it cannot guarantee atomicity. */
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;
diff --git a/lib/renameat2.h b/lib/renameatu.h
similarity index 84%
rename from lib/renameat2.h
rename to lib/renameatu.h
index aba7966..7d79775 100644
--- a/lib/renameat2.h
+++ b/lib/renameatu.h
@@ -16,15 +16,13 @@
/* written by Paul Eggert */
-/* Get RENAME_* macros from linux/fs.h if present, otherwise supply
+/* Get RENAME_* macros from <stdio.h> if present, otherwise supply
the traditional Linux values. */
-#if HAVE_LINUX_FS_H
-# include <linux/fs.h>
-#endif
+#include <stdio.h>
#ifndef RENAME_NOREPLACE
# define RENAME_NOREPLACE (1 << 0)
# define RENAME_EXCHANGE (1 << 1)
# 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);
--
2.14.4
From a6b7ff5ef538bbdff4550a56fed878e9cd951d6d Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 5 Jul 2018 09:33:48 -0700
Subject: [PATCH 2/2] build: update gnulib submodule to latest
* bootstrap.conf, src/copy.c, src/mv.c, src/shred.c:
Adjust to renaming of renameat2 to renameatu.
Upstream-commit: 439741053256618eb651e6d43919df29625b8714
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
bootstrap.conf | 2 +-
src/copy.c | 4 ++--
src/mv.c | 4 ++--
src/shred.c | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 4da4f94..fcf29dc 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -210,7 +210,7 @@ gnulib_modules="
remove
rename
renameat
- renameat2
+ renameatu
rmdir
root-dev-ino
rpmatch
diff --git a/src/copy.c b/src/copy.c
index 58d2f6e..1a9cdd1 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -53,7 +53,7 @@
#include "ignore-value.h"
#include "ioblksize.h"
#include "quote.h"
-#include "renameat2.h"
+#include "renameatu.h"
#include "root-uid.h"
#include "same.h"
#include "savedir.h"
@@ -1873,7 +1873,7 @@ copy_internal (char const *src_name, char const *dst_name,
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;
diff --git a/src/mv.c b/src/mv.c
index b6dd72d..36fd1af 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -31,7 +31,7 @@
#include "error.h"
#include "filenamecat.h"
#include "remove.h"
-#include "renameat2.h"
+#include "renameatu.h"
#include "root-dev-ino.h"
#include "priv-set.h"
@@ -456,7 +456,7 @@ main (int argc, char **argv)
{
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]))
diff --git a/src/shred.c b/src/shred.c
index 2ddaadd..270b1e9 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -93,7 +93,7 @@
#include "human.h"
#include "randint.h"
#include "randread.h"
-#include "renameat2.h"
+#include "renameatu.h"
#include "stat-size.h"
/* Default number of times to overwrite. */
@@ -1096,7 +1096,7 @@ wipename (char *oldname, char const *qoldname, struct Options const *flags)
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))
--
2.14.4

File diff suppressed because it is too large Load Diff

View File

@ -1,469 +0,0 @@
From 95f427178720d047316e95f44777cfdf2ecf2b46 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Fri, 4 Jan 2019 09:29:13 -0800
Subject: [PATCH 1/4] tail: don't exit immediately with filters on AIX
* src/tail.c: Fix the check_output_available check on AIX.
Note we don't use poll for all systems as the overhead
of adding the gnulib poll module wouldn't be worth it
just for this single use.
* tests/tail-2/pipe-f.sh: Fix the test which always passed
due to only the exit code of sleep being checked.
* NEWS: Mention the bug fix and rearrange alphabetically.
Fixes http://bugs.gnu.org/33946
Upstream-commit: d5ab4cbe424e3e95140eec22ef828f50b2fb3067
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/tail.c | 13 +++++++++++++
tests/tail-2/pipe-f.sh | 5 ++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/tail.c b/src/tail.c
index ac001d7..d63aacc 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -30,6 +30,9 @@
#include <getopt.h>
#include <sys/types.h>
#include <signal.h>
+#ifdef _AIX
+# include <poll.h>
+#endif
#include "system.h"
#include "argmatch.h"
@@ -335,6 +338,16 @@ named file in a way that accommodates renaming, removal and creation.\n\
static void
check_output_alive (void)
{
+#ifdef _AIX
+ /* select on AIX was seen to give a readable event immediately. */
+ struct pollfd pfd;
+ pfd.fd = STDOUT_FILENO;
+ pfd.events = POLLERR;
+
+ if (poll (&pfd, 1, 0) >= 0 && (pfd.revents & POLLERR))
+ raise (SIGPIPE);
+#endif
+
if (! monitor_output)
return;
diff --git a/tests/tail-2/pipe-f.sh b/tests/tail-2/pipe-f.sh
index 76b0d90..1126c93 100755
--- a/tests/tail-2/pipe-f.sh
+++ b/tests/tail-2/pipe-f.sh
@@ -37,7 +37,10 @@ compare exp out || fail=1
# This would wait indefinitely before v8.28 due to no EPIPE being
# generated due to no data written after the first small amount
-timeout 10 tail -f $mode $fastpoll out | sleep .1 || fail=1
+(returns_ 124 timeout 10 tail -n2 -f $mode $fastpoll out && touch timed_out) |
+ sed 2q > out2
+test -e timed_out && fail=1
+compare exp out2 || fail=1
# This would wait indefinitely before v8.28 (until first write)
(returns_ 1 timeout 10 tail -f $mode $fastpoll /dev/null >&-) || fail=1
--
2.31.1
From 125bb79d3e9f414533b1c29237ee3f647053d0d6 Mon Sep 17 00:00:00 2001
From: Ayappan <ayappap2@in.ibm.com>
Date: Sun, 20 Jan 2019 00:17:33 -0800
Subject: [PATCH 2/4] tail: fix recent ineffective AIX change
* src/tail.c: Fix commit v8.30-40-gd5ab4cb which was ineffective.
Fixes http://bugs.gnu.org/33946
Upstream-commit: 17983b2cb3bccbb4fa69691178caddd99269bda9
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/tail.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/tail.c b/src/tail.c
index d63aacc..9ed6d48 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -338,6 +338,9 @@ named file in a way that accommodates renaming, removal and creation.\n\
static void
check_output_alive (void)
{
+ if (! monitor_output)
+ return;
+
#ifdef _AIX
/* select on AIX was seen to give a readable event immediately. */
struct pollfd pfd;
@@ -346,11 +349,7 @@ check_output_alive (void)
if (poll (&pfd, 1, 0) >= 0 && (pfd.revents & POLLERR))
raise (SIGPIPE);
-#endif
-
- if (! monitor_output)
- return;
-
+#else
struct timeval delay;
delay.tv_sec = delay.tv_usec = 0;
@@ -362,6 +361,7 @@ check_output_alive (void)
and implies an error condition on output like broken pipe. */
if (select (STDOUT_FILENO + 1, &rfd, NULL, NULL, &delay) == 1)
raise (SIGPIPE);
+#endif
}
static bool
--
2.31.1
From 7741989c3e633aa44f01d8f91332cb65a9280ba3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Sun, 20 Jan 2019 00:13:15 -0800
Subject: [PATCH 3/4] tail: fix handling of broken pipes with SIGPIPE ignored
* init.cfg (trap_sigpipe_or_skip_): A new function refactored from...
* tests/misc/printf-surprise.sh: ...here.
* tests/misc/seq-epipe.sh. Likewise.
* src/tail.c (die_pipe): Ensure we exit upon sending SIGPIPE.
* tests/tail-2/pipe-f.sh: Ensure we exit even if SIGPIPE is ignored.
* NEWS: Mention the bug fix.
Upstream-commit: fa50623394f491b975dbd7ad73193519dd721771
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
init.cfg | 6 ++++++
src/tail.c | 14 +++++++++++---
tests/misc/printf-surprise.sh | 4 +---
tests/misc/seq-epipe.sh | 4 +---
tests/tail-2/pipe-f.sh | 19 ++++++++++++++-----
5 files changed, 33 insertions(+), 14 deletions(-)
diff --git a/init.cfg b/init.cfg
index b6c81ab..985c8d3 100644
--- a/init.cfg
+++ b/init.cfg
@@ -613,6 +613,12 @@ mkfifo_or_skip_()
fi
}
+trap_sigpipe_or_skip_()
+{
+ (trap '' PIPE && yes | :) 2>&1 | grep -qF 'Broken pipe' ||
+ skip_ 'trapping SIGPIPE is not supported'
+}
+
# Disable the current test if the working directory seems to have
# the setgid bit set.
skip_if_setgid_()
diff --git a/src/tail.c b/src/tail.c
index 9ed6d48..16e0d73 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -333,6 +333,14 @@ named file in a way that accommodates renaming, removal and creation.\n\
exit (status);
}
+/* Ensure exit, either with SIGPIPE or EXIT_FAILURE status. */
+static void ATTRIBUTE_NORETURN
+die_pipe (void)
+{
+ raise (SIGPIPE);
+ exit (EXIT_FAILURE);
+}
+
/* If the output has gone away, then terminate
as we would if we had written to this output. */
static void
@@ -348,7 +356,7 @@ check_output_alive (void)
pfd.events = POLLERR;
if (poll (&pfd, 1, 0) >= 0 && (pfd.revents & POLLERR))
- raise (SIGPIPE);
+ die_pipe ();
#else
struct timeval delay;
delay.tv_sec = delay.tv_usec = 0;
@@ -360,7 +368,7 @@ check_output_alive (void)
/* readable event on STDOUT is equivalent to POLLERR,
and implies an error condition on output like broken pipe. */
if (select (STDOUT_FILENO + 1, &rfd, NULL, NULL, &delay) == 1)
- raise (SIGPIPE);
+ die_pipe ();
#endif
}
@@ -1658,7 +1666,7 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
{
/* readable event on STDOUT is equivalent to POLLERR,
and implies an error on output like broken pipe. */
- raise (SIGPIPE);
+ die_pipe ();
}
else
break;
diff --git a/tests/misc/printf-surprise.sh b/tests/misc/printf-surprise.sh
index fd88133..acac0b1 100755
--- a/tests/misc/printf-surprise.sh
+++ b/tests/misc/printf-surprise.sh
@@ -49,9 +49,7 @@ vm=$(get_min_ulimit_v_ env $prog %20f 0) \
# triggering the printf(3) misbehavior -- which, btw, is required by ISO C99.
mkfifo_or_skip_ fifo
-
-(trap '' PIPE && yes | :) 2>&1 | grep -qF 'Broken pipe' ||
- skip_ 'trapping SIGPIPE is not supported'
+trap_sigpipe_or_skip_
# Disable MALLOC_PERTURB_, to avoid triggering this bug
# https://bugs.debian.org/481543#77
diff --git a/tests/misc/seq-epipe.sh b/tests/misc/seq-epipe.sh
index 3e89158..127d61c 100755
--- a/tests/misc/seq-epipe.sh
+++ b/tests/misc/seq-epipe.sh
@@ -18,9 +18,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ seq
-
-(trap '' PIPE && yes | :) 2>&1 | grep -qF 'Broken pipe' ||
- skip_ 'trapping SIGPIPE is not supported'
+trap_sigpipe_or_skip_
# upon EPIPE with signals ignored, 'seq' should exit with an error.
timeout 10 sh -c \
diff --git a/tests/tail-2/pipe-f.sh b/tests/tail-2/pipe-f.sh
index 1126c93..f734a61 100755
--- a/tests/tail-2/pipe-f.sh
+++ b/tests/tail-2/pipe-f.sh
@@ -18,6 +18,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ tail
+trap_sigpipe_or_skip_
# Speedup the non inotify case
fastpoll='-s.1 --max-unchanged-stats=1'
@@ -36,11 +37,19 @@ echo bar | returns_ 1 \
compare exp out || fail=1
# This would wait indefinitely before v8.28 due to no EPIPE being
-# generated due to no data written after the first small amount
-(returns_ 124 timeout 10 tail -n2 -f $mode $fastpoll out && touch timed_out) |
- sed 2q > out2
-test -e timed_out && fail=1
-compare exp out2 || fail=1
+# generated due to no data written after the first small amount.
+# Also check tail exits if SIGPIPE is being ignored.
+# Note 'trap - SIGPIPE' is ineffective if the initiating shell
+# has ignored SIGPIPE, but that's not the normal case.
+for disposition in '' '-'; do
+ (trap "$disposition" PIPE;
+ returns_ 124 timeout 10 \
+ tail -n2 -f $mode $fastpoll out && touch timed_out) |
+ sed 2q > out2
+ test -e timed_out && fail=1
+ compare exp out2 || fail=1
+ rm -f timed_out
+done
# This would wait indefinitely before v8.28 (until first write)
(returns_ 1 timeout 10 tail -f $mode $fastpoll /dev/null >&-) || fail=1
--
2.31.1
From 0f5760466d167e955d28a1250ffd0af347d48dc9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 26 Jun 2021 18:23:52 -0700
Subject: [PATCH 4/4] tail: use poll, not select
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This fixes an unlikely stack out-of-bounds write reported by
Stepan Broz via Kamil Dudka (Bug#49209).
* src/tail.c: Do not include <sys/select.h>.
[!_AIX]: Include poll.h.
(check_output_alive) [!_AIX]: Use poll instead of select.
(tail_forever_inotify): Likewise. Simplify logic, as there is no
need for a while (len <= evbuf_off) loop.
Upstream-commit: da0d448bca62c6305fc432f67e2c5ccc2da75346
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/tail.c | 101 +++++++++++++++++++++--------------------------------
1 file changed, 39 insertions(+), 62 deletions(-)
diff --git a/src/tail.c b/src/tail.c
index 16e0d73..d77c660 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -29,10 +29,8 @@
#include <assert.h>
#include <getopt.h>
#include <sys/types.h>
+#include <poll.h>
#include <signal.h>
-#ifdef _AIX
-# include <poll.h>
-#endif
#include "system.h"
#include "argmatch.h"
@@ -55,8 +53,6 @@
#if HAVE_INOTIFY
# include "hash.h"
# include <sys/inotify.h>
-/* 'select' is used by tail_forever_inotify. */
-# include <sys/select.h>
/* inotify needs to know if a file is local. */
# include "fs.h"
@@ -349,27 +345,12 @@ check_output_alive (void)
if (! monitor_output)
return;
-#ifdef _AIX
- /* select on AIX was seen to give a readable event immediately. */
struct pollfd pfd;
pfd.fd = STDOUT_FILENO;
pfd.events = POLLERR;
if (poll (&pfd, 1, 0) >= 0 && (pfd.revents & POLLERR))
die_pipe ();
-#else
- struct timeval delay;
- delay.tv_sec = delay.tv_usec = 0;
-
- fd_set rfd;
- FD_ZERO (&rfd);
- FD_SET (STDOUT_FILENO, &rfd);
-
- /* readable event on STDOUT is equivalent to POLLERR,
- and implies an error condition on output like broken pipe. */
- if (select (STDOUT_FILENO + 1, &rfd, NULL, NULL, &delay) == 1)
- die_pipe ();
-#endif
}
static bool
@@ -1609,7 +1590,7 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
/* Wait for inotify events and handle them. Events on directories
ensure that watched files can be re-added when following by name.
This loop blocks on the 'safe_read' call until a new event is notified.
- But when --pid=P is specified, tail usually waits via the select. */
+ But when --pid=P is specified, tail usually waits via poll. */
while (1)
{
struct File_spec *fspec;
@@ -1626,54 +1607,51 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
return false;
}
- /* When watching a PID, ensure that a read from WD will not block
- indefinitely. */
- while (len <= evbuf_off)
+ if (len <= evbuf_off)
{
- struct timeval delay; /* how long to wait for file changes. */
+ /* Poll for inotify events. When watching a PID, ensure
+ that a read from WD will not block indefinitely.
+ If MONITOR_OUTPUT, also poll for a broken output pipe. */
- if (pid)
+ int file_change;
+ struct pollfd pfd[2];
+ do
{
- if (writer_is_dead)
- exit (EXIT_SUCCESS);
+ /* How many ms to wait for changes. -1 means wait forever. */
+ int delay = -1;
- writer_is_dead = (kill (pid, 0) != 0 && errno != EPERM);
-
- if (writer_is_dead)
- delay.tv_sec = delay.tv_usec = 0;
- else
+ if (pid)
{
- delay.tv_sec = (time_t) sleep_interval;
- delay.tv_usec = 1000000 * (sleep_interval - delay.tv_sec);
+ if (writer_is_dead)
+ exit (EXIT_SUCCESS);
+
+ writer_is_dead = (kill (pid, 0) != 0 && errno != EPERM);
+
+ if (writer_is_dead || sleep_interval <= 0)
+ delay = 0;
+ else if (sleep_interval < INT_MAX / 1000 - 1)
+ {
+ /* delay = ceil (sleep_interval * 1000), sans libm. */
+ double ddelay = sleep_interval * 1000;
+ delay = ddelay;
+ delay += delay < ddelay;
+ }
}
+
+ pfd[0].fd = wd;
+ pfd[0].events = POLLIN;
+ pfd[1].fd = STDOUT_FILENO;
+ pfd[1].events = pfd[1].revents = 0;
+ file_change = poll (pfd, monitor_output + 1, delay);
}
+ while (file_change == 0);
- fd_set rfd;
- FD_ZERO (&rfd);
- FD_SET (wd, &rfd);
- if (monitor_output)
- FD_SET (STDOUT_FILENO, &rfd);
-
- int file_change = select (MAX (wd, STDOUT_FILENO) + 1,
- &rfd, NULL, NULL, pid ? &delay: NULL);
-
- if (file_change == 0)
- continue;
- else if (file_change == -1)
- die (EXIT_FAILURE, errno,
- _("error waiting for inotify and output events"));
- else if (FD_ISSET (STDOUT_FILENO, &rfd))
- {
- /* readable event on STDOUT is equivalent to POLLERR,
- and implies an error on output like broken pipe. */
- die_pipe ();
- }
- else
- break;
- }
+ if (file_change < 0)
+ die (EXIT_FAILURE, errno,
+ _("error waiting for inotify and output events"));
+ if (pfd[1].revents)
+ die_pipe ();
- if (len <= evbuf_off)
- {
len = safe_read (wd, evbuf, evlen);
evbuf_off = 0;
@@ -2434,8 +2412,7 @@ main (int argc, char **argv)
if (forever && ignore_fifo_and_pipe (F, n_files))
{
/* If stdout is a fifo or pipe, then monitor it
- so that we exit if the reader goes away.
- Note select() on a regular file is always readable. */
+ so that we exit if the reader goes away. */
struct stat out_stat;
if (fstat (STDOUT_FILENO, &out_stat) < 0)
die (EXIT_FAILURE, errno, _("standard output"));
--
2.31.1

View File

@ -1,36 +0,0 @@
From ef6be60dcaf424bdb21392aff42331bd4dc272e0 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 14 Mar 2019 13:48:01 +0100
Subject: [PATCH] md5sum,b2sum,sha*sum: --help: add note about binary/text mode
* src/md5sum.c (usage): Make it clear that there is no difference
between binary mode and text mode on GNU systems.
Bug: https://bugzilla.redhat.com/406981
Bug: https://bugzilla.redhat.com/1688740
Upstream-commit: ae61b1066351bb784b54fbfd7b52caf129ec286c
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/md5sum.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/md5sum.c b/src/md5sum.c
index 3532f7b7a..f75b6de02 100644
--- a/src/md5sum.c
+++ b/src/md5sum.c
@@ -287,7 +287,10 @@ The following five options are useful only when verifying checksums:\n\
The sums are computed as described in %s. When checking, the input\n\
should be a former output of this program. The default mode is to print a\n\
line with checksum, a space, a character indicating input mode ('*' for binary,\
-\n' ' for text or where binary is insignificant), and name for each FILE.\n"),
+\n' ' for text or where binary is insignificant), and name for each FILE.\n\
+\n\
+Note: There is no difference between binary mode and text mode on GNU systems.\
+\n"),
DIGEST_REFERENCE);
emit_ancillary_info (PROGRAM_NAME);
}
--
2.17.2

View File

@ -0,0 +1,100 @@
From 81e25c8521937ecf7f444bab11fddaaf81cc3efd 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
---
DIR_COLORS | 9 ++++++++-
DIR_COLORS.lightbgcolor | 21 +++++++++++++++------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/DIR_COLORS b/DIR_COLORS
index bd5df23..84f2417 100644
--- a/DIR_COLORS
+++ b/DIR_COLORS
@@ -1,3 +1,7 @@
+# This file goes in the /etc directory, and must be world readable.
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
+
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
@@ -8,6 +12,9 @@
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
+# For compatibility, the pattern "^COLOR.*none" is recognized as a way to
+# disable colorization. See https://bugzilla.redhat.com/1349579 for details.
+
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
TERM Eterm
@@ -58,7 +65,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 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
diff --git a/DIR_COLORS.lightbgcolor b/DIR_COLORS.lightbgcolor
index 4316832..6402854 100644
--- a/DIR_COLORS.lightbgcolor
+++ b/DIR_COLORS.lightbgcolor
@@ -1,3 +1,9 @@
+# Configuration file for the color ls utility - modified for lighter backgrounds
+
+# This file goes in the /etc directory, and must be world readable.
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
+
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
@@ -8,6 +14,9 @@
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
+# For compatibility, the pattern "^COLOR.*none" is recognized as a way to
+# disable colorization. See https://bugzilla.redhat.com/1349579 for details.
+
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
TERM Eterm
@@ -48,17 +57,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
-DIR 01;34 # directory
-LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
+DIR 00;34 # directory
+LINK 00;36 # symbolic link. (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.)
MULTIHARDLINK 00 # regular file with more than one link
FIFO 40;33 # pipe
-SOCK 01;35 # socket
-DOOR 01;35 # door
+SOCK 00;35 # socket
+DOOR 00;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 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
@@ -67,7 +76,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 files with execute permission:
-EXEC 01;32
+EXEC 00;32
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
--
2.21.1

View File

@ -0,0 +1,52 @@
From 51b9a8ba0974d262e0b0f81a2078b3c7907b25ed Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 7 Apr 2021 17:29:59 -0700
Subject: [PATCH] utimens: fix confusing arg type in internal func
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Although the old code was technically correct, this was accidental
and it understandably confused Coverity. Reported by Ondrej Dubaj in:
https://lists.gnu.org/r/bug-tar/2021-04/msg00000.html
* lib/utimens.c (update_timespec): Change arg type from struct
timespec *[2] (pointer to array of 2 pointers to timespecs) to
struct timespec ** (pointer to pointer to the first timespec in
an array of 2 timespecs). Although the old code happened to be
technically correct, it was misleading and confused Coverity.
And though the type struct timespec (**)[2] (pointer to pointer
to array of 2 timespecs) would perhaps be more technically
correct, it would be almost as confusing and would require changes
elsewhere in this file; lets quit while were ahead.
Upstream-commit: a3a946f670718d0dee5a7425ad5ac0a29fb46ea1
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
lib/utimens.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/utimens.c b/lib/utimens.c
index 3f53942..ea8c672 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -123,14 +123,14 @@ validate_timespec (struct timespec timespec[2])
return result + (utime_omit_count == 1);
}
-/* Normalize any UTIME_NOW or UTIME_OMIT values in *TS, using stat
- buffer STATBUF to obtain the current timestamps of the file. If
+/* Normalize any UTIME_NOW or UTIME_OMIT values in (*TS)[0] and (*TS)[1],
+ using STATBUF to obtain the current timestamps of the file. If
both times are UTIME_NOW, set *TS to NULL (as this can avoid some
permissions issues). If both times are UTIME_OMIT, return true
(nothing further beyond the prior collection of STATBUF is
necessary); otherwise return false. */
static bool
-update_timespec (struct stat const *statbuf, struct timespec *ts[2])
+update_timespec (struct stat const *statbuf, struct timespec **ts)
{
struct timespec *timespec = *ts;
if (timespec[0].tv_nsec == UTIME_OMIT
--
2.26.3

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,119 @@
From 76126e2831580d0df20530f4d6f72189bd4f0b9a Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 18 Jun 2020 22:16:24 -0700
Subject: [PATCH] cp: default to COW
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Likewise for install. Proposed in Bug#24400, and long past due.
* NEWS:
* doc/coreutils.texi (cp invocation):
* src/copy.h (enum Reflink_type): Document this.
* src/cp.c (cp_option_init):
* src/install.c (cp_option_init): Implement this.
Upstream-commit: 25725f9d41735d176d73a757430739fb71c7d043
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
doc/coreutils.texi | 19 ++++++++++++-------
src/copy.h | 4 ++--
src/cp.c | 2 +-
src/install.c | 2 +-
4 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 02e0c1c..2382a16 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -8854,12 +8854,14 @@ The @var{when} value can be one of the following:
@table @samp
@item always
-The default behavior: if the copy-on-write operation is not supported
+If the copy-on-write operation is not supported
then report the failure for each file and exit with a failure status.
+Plain @option{--reflink} is equivalent to @option{--reflink=when}.
@item auto
If the copy-on-write operation is not supported then fall back
to the standard copy behavior.
+This is the default if no @option{--reflink} option is given.
@item never
Disable copy-on-write operation and use the standard copy behavior.
@@ -8868,12 +8870,6 @@ Disable copy-on-write operation and use the standard copy behavior.
This option is overridden by the @option{--link}, @option{--symbolic-link}
and @option{--attributes-only} options, thus allowing it to be used
to configure the default data copying behavior for @command{cp}.
-For example, with the following alias, @command{cp} will use the
-minimum amount of space supported by the file system.
-
-@example
-alias cp='cp --reflink=auto --sparse=always'
-@end example
@item --remove-destination
@opindex --remove-destination
@@ -8918,6 +8914,15 @@ This is useful in creating a file for use with the @command{mkswap} command,
since such a file must not have any holes.
@end table
+For example, with the following alias, @command{cp} will use the
+minimum amount of space supported by the file system.
+(Older versions of @command{cp} can also benefit from
+@option{--reflink=auto} here.)
+
+@example
+alias cp='cp --sparse=always'
+@end example
+
@optStripTrailingSlashes
@item -s
diff --git a/src/copy.h b/src/copy.h
index 874d6f7..a0ad494 100644
--- a/src/copy.h
+++ b/src/copy.h
@@ -46,10 +46,10 @@ enum Sparse_type
/* Control creation of COW files. */
enum Reflink_type
{
- /* Default to a standard copy. */
+ /* Do a standard copy. */
REFLINK_NEVER,
- /* Try a COW copy and fall back to a standard copy. */
+ /* Try a COW copy and fall back to a standard copy; this is the default. */
REFLINK_AUTO,
/* Require a COW copy and fail if not available. */
diff --git a/src/cp.c b/src/cp.c
index 0193df8..9e7ad14 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -796,7 +796,7 @@ cp_option_init (struct cp_options *x)
x->move_mode = false;
x->install_mode = false;
x->one_file_system = false;
- x->reflink_mode = REFLINK_NEVER;
+ x->reflink_mode = REFLINK_AUTO;
x->preserve_ownership = false;
x->preserve_links = false;
diff --git a/src/install.c b/src/install.c
index 4ab44a6..aef16ca 100644
--- a/src/install.c
+++ b/src/install.c
@@ -264,7 +264,7 @@ cp_option_init (struct cp_options *x)
{
cp_options_default (x);
x->copy_as_regular = true;
- x->reflink_mode = REFLINK_NEVER;
+ x->reflink_mode = REFLINK_AUTO;
x->dereference = DEREF_ALWAYS;
x->unlink_dest_before_opening = true;
x->unlink_dest_after_failed_open = false;
--
2.25.4

View File

@ -0,0 +1,81 @@
From 9618fb718b75920f37e5be2049ad1d0bb5c4a28c Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 26 Jan 2021 09:23:54 -0800
Subject: [PATCH] expr: fix bug with unmatched \(...\)
Problem reported by Qiuhao Li.
* doc/coreutils.texi (String expressions):
Document the correct behavior, which POSIX requires.
* src/expr.c (docolon): Treat unmatched \(...\) as empty.
* tests/misc/expr.pl: New test.
Upstream-commit: 735083ba24878075235007b4417982ad5700436d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
doc/coreutils.texi | 14 ++++++++------
src/expr.c | 9 +++++++--
tests/misc/expr.pl | 3 +++
3 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 2382a16..5b2bb2c 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -13529,12 +13529,14 @@ second is considered to be a (basic, a la GNU @code{grep}) regular
expression, with a @code{^} implicitly prepended. The first argument is
then matched against this regular expression.
-If the match succeeds and @var{regex} uses @samp{\(} and @samp{\)}, the
-@code{:} expression returns the part of @var{string} that matched the
-subexpression; otherwise, it returns the number of characters matched.
-
-If the match fails, the @code{:} operator returns the null string if
-@samp{\(} and @samp{\)} are used in @var{regex}, otherwise 0.
+If @var{regex} does not use @samp{\(} and @samp{\)}, the @code{:}
+expression returns the number of characters matched, or 0 if the match
+fails.
+
+If @var{regex} uses @samp{\(} and @samp{\)}, the @code{:} expression
+returns the part of @var{string} that matched the subexpression, or
+the null string if the match failed or the subexpression did not
+contribute to the match.
@kindex \( @r{regexp operator}
Only the first @samp{\( @dots{} \)} pair is relevant to the return
diff --git a/src/expr.c b/src/expr.c
index e134872..0616a42 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -721,8 +721,13 @@ docolon (VALUE *sv, VALUE *pv)
/* Were \(...\) used? */
if (re_buffer.re_nsub > 0)
{
- sv->u.s[re_regs.end[1]] = '\0';
- v = str_value (sv->u.s + re_regs.start[1]);
+ if (re_regs.end[1] < 0)
+ v = str_value ("");
+ else
+ {
+ sv->u.s[re_regs.end[1]] = '\0';
+ v = str_value (sv->u.s + re_regs.start[1]);
+ }
}
else
{
diff --git a/tests/misc/expr.pl b/tests/misc/expr.pl
index e45f8e7..e57f79d 100755
--- a/tests/misc/expr.pl
+++ b/tests/misc/expr.pl
@@ -84,6 +84,9 @@ my @Tests =
# In 5.94 and earlier, anchors incorrectly matched newlines.
['anchor', "'a\nb' : 'a\$'", {OUT => '0'}, {EXIT => 1}],
+ # In 8.32, \( ... \) that did not match caused memory errors.
+ ['emptysub', '"a" : "\\(b\\)*"', {OUT => ''}, {EXIT => 1}],
+
# These tests are taken from grep/tests/bre.tests.
['bre1', '"abc" : "a\\(b\\)c"', {OUT => 'b'}],
['bre2', '"a(" : "a("', {OUT => '2'}],
--
2.26.2

View File

@ -25,7 +25,7 @@ diff --git a/lib/mountlist.c b/lib/mountlist.c
index e0227b7..e5f6b07 100644 index e0227b7..e5f6b07 100644
--- a/lib/mountlist.c --- a/lib/mountlist.c
+++ b/lib/mountlist.c +++ b/lib/mountlist.c
@@ -173,6 +173,7 @@ @@ -170,6 +170,7 @@
|| strcmp (Fs_type, "debugfs") == 0 \ || strcmp (Fs_type, "debugfs") == 0 \
|| strcmp (Fs_type, "devpts") == 0 \ || strcmp (Fs_type, "devpts") == 0 \
|| strcmp (Fs_type, "fusectl") == 0 \ || strcmp (Fs_type, "fusectl") == 0 \

View File

@ -0,0 +1,48 @@
From f61085aaa37f169365c56e44f5129d0491913b6a Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 27 Aug 2020 17:52:58 -0700
Subject: [PATCH] perror, strerror_r: remove unportable tests
Problem reported by Florian Weimer in:
https://lists.gnu.org/r/bug-gnulib/2020-08/msg00220.html
* tests/test-perror2.c (main):
* tests/test-strerror_r.c (main): Omit unportable tests.
Upstream-commit: 175e0bc72808d564074c4adcc72aeadb74adfcc6
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
gnulib-tests/test-perror2.c | 3 ---
gnulib-tests/test-strerror_r.c | 3 ---
2 files changed, 6 deletions(-)
diff --git a/gnulib-tests/test-perror2.c b/gnulib-tests/test-perror2.c
index 1d14eda..c6214dd 100644
--- a/gnulib-tests/test-perror2.c
+++ b/gnulib-tests/test-perror2.c
@@ -79,9 +79,6 @@ main (void)
errno = -5;
perror ("");
ASSERT (!ferror (stderr));
- ASSERT (msg1 == msg2 || msg1 == msg4 || STREQ (msg1, str1));
- ASSERT (msg2 == msg4 || STREQ (msg2, str2));
- ASSERT (msg3 == msg4 || STREQ (msg3, str3));
ASSERT (STREQ (msg4, str4));
free (str1);
diff --git a/gnulib-tests/test-strerror_r.c b/gnulib-tests/test-strerror_r.c
index b11d6fd..c1dbcf8 100644
--- a/gnulib-tests/test-strerror_r.c
+++ b/gnulib-tests/test-strerror_r.c
@@ -165,9 +165,6 @@ main (void)
strerror_r (EACCES, buf, sizeof buf);
strerror_r (-5, buf, sizeof buf);
- ASSERT (msg1 == msg2 || msg1 == msg4 || STREQ (msg1, str1));
- ASSERT (msg2 == msg4 || STREQ (msg2, str2));
- ASSERT (msg3 == msg4 || STREQ (msg3, str3));
ASSERT (STREQ (msg4, str4));
free (str1);
--
2.25.4

View File

@ -0,0 +1,164 @@
From b9f9ed14bda93ecb407129b69e6476813c250046 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 15 Apr 2020 20:50:32 -0700
Subject: [PATCH] fts: remove NOSTAT_LEAF_OPTIMIZATION
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It caused find and du to dump core, and it was useful
only for obsolescent Linux filesystems anyway. Problem reported in:
https://lists.gnu.org/r/bug-gnulib/2020-04/msg00068.html
Quite possibly there is still a serious underlying fts bug with
tight-loop-check and mutating file systems, but if so this patch
should cause the bug to be triggered less often.
* lib/fts.c (enum leaf_optimization): Remove
NOSTAT_LEAF_OPTIMIZATION, as its problematic.
(S_MAGIC_REISERFS, S_MAGIC_XFS): Remove; no longer needed.
(leaf_optimization): Remove special cases for ReiserFS and XFS.
(fts_read): Remove NOSTAT_LEAF_OPTIMIZATION code.
* lib/fts_.h (struct _ftsent.fts_n_dirs_remaining):
Remove. All uses removed.
Upstream-commit: 47bf2cf3184027c1eb9c1dfeea5c5b8b2d69710d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
lib/fts.c | 56 ++++++++-------------------------------------------
lib/fts_.h | 5 -----
2 files changed, 8 insertions(+), 53 deletions(-)
diff --git a/lib/fts.c b/lib/fts.c
index 1093ce5..dfe3fef 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -445,7 +445,6 @@ fts_open (char * const *argv,
if ((parent = fts_alloc(sp, "", 0)) == NULL)
goto mem2;
parent->fts_level = FTS_ROOTPARENTLEVEL;
- parent->fts_n_dirs_remaining = -1;
}
/* The classic fts implementation would call fts_stat with
@@ -634,9 +633,8 @@ fts_close (FTS *sp)
}
/* Minimum link count of a traditional Unix directory. When leaf
- optimization is OK and MIN_DIR_NLINK <= st_nlink, then st_nlink is
- an upper bound on the number of subdirectories (counting "." and
- ".."). */
+ optimization is OK and a directory's st_nlink == MIN_DIR_NLINK,
+ then the directory has no subdirectories. */
enum { MIN_DIR_NLINK = 2 };
/* Whether leaf optimization is OK for a directory. */
@@ -645,12 +643,8 @@ enum leaf_optimization
/* st_nlink is not reliable for this directory's subdirectories. */
NO_LEAF_OPTIMIZATION,
- /* Leaf optimization is OK, but is not useful for avoiding stat calls. */
- OK_LEAF_OPTIMIZATION,
-
- /* Leaf optimization is not only OK: it is useful for avoiding
- stat calls, because dirent.d_type does not work. */
- NOSTAT_LEAF_OPTIMIZATION
+ /* st_nlink == 2 means the directory lacks subdirectories. */
+ OK_LEAF_OPTIMIZATION
};
#if (defined __linux__ || defined __ANDROID__) \
@@ -663,9 +657,7 @@ enum leaf_optimization
# define S_MAGIC_CIFS 0xFF534D42
# define S_MAGIC_NFS 0x6969
# define S_MAGIC_PROC 0x9FA0
-# define S_MAGIC_REISERFS 0x52654973
# define S_MAGIC_TMPFS 0x1021994
-# define S_MAGIC_XFS 0x58465342
# ifdef HAVE___FSWORD_T
typedef __fsword_t fsword;
@@ -786,23 +778,15 @@ dirent_inode_sort_may_be_useful (FTSENT const *p, int dir_fd)
}
/* 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.
+ return whether it is valid to apply leaf optimization.
+ The optimization is valid if a directory's st_nlink value equal
+ to MIN_DIR_NLINK means the directory has no subdirectories.
DIR_FD is negative if unavailable. */
static enum leaf_optimization
leaf_optimization (FTSENT const *p, int dir_fd)
{
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. */
- case S_MAGIC_REISERFS:
- case S_MAGIC_XFS: /* XFS lacked it until 2013-08-22 commit. */
- return NOSTAT_LEAF_OPTIMIZATION;
-
case 0:
/* Leaf optimization is unsafe if the file system type is unknown. */
FALLTHROUGH;
@@ -1027,26 +1011,7 @@ check_for_dir:
if (p->fts_info == FTS_NSOK)
{
if (p->fts_statp->st_size == FTS_STAT_REQUIRED)
- {
- FTSENT *parent = p->fts_parent;
- if (parent->fts_n_dirs_remaining == 0
- && ISSET(FTS_NOSTAT)
- && ISSET(FTS_PHYSICAL)
- && (leaf_optimization (parent, sp->fts_cwd_fd)
- == NOSTAT_LEAF_OPTIMIZATION))
- {
- /* nothing more needed */
- }
- else
- {
- p->fts_info = fts_stat(sp, p, false);
- if (S_ISDIR(p->fts_statp->st_mode)
- && p->fts_level != FTS_ROOTLEVEL
- && 0 < parent->fts_n_dirs_remaining
- && parent->fts_n_dirs_remaining != (nlink_t) -1)
- parent->fts_n_dirs_remaining--;
- }
- }
+ p->fts_info = fts_stat(sp, p, false);
else
fts_assert (p->fts_statp->st_size == FTS_NO_STAT_REQUIRED);
}
@@ -1830,11 +1795,6 @@ err: memset(sbp, 0, sizeof(struct stat));
}
if (S_ISDIR(sbp->st_mode)) {
- p->fts_n_dirs_remaining
- = ((sbp->st_nlink < MIN_DIR_NLINK
- || p->fts_level <= FTS_ROOTLEVEL)
- ? -1
- : sbp->st_nlink - (ISSET (FTS_SEEDOT) ? 0 : MIN_DIR_NLINK));
if (ISDOT(p->fts_name)) {
/* Command-line "." and ".." are real directories. */
return (p->fts_level == FTS_ROOTLEVEL ? FTS_D : FTS_DOT);
diff --git a/lib/fts_.h b/lib/fts_.h
index d40a116..2e76cc4 100644
--- a/lib/fts_.h
+++ b/lib/fts_.h
@@ -227,11 +227,6 @@ typedef struct _ftsent {
size_t fts_namelen; /* strlen(fts_name) */
- /* If not (nlink_t) -1, an upper bound on the number of
- remaining subdirectories of interest. If this becomes
- zero, some work can be avoided. */
- nlink_t fts_n_dirs_remaining;
-
# define FTS_D 1 /* preorder directory */
# define FTS_DC 2 /* directory that causes cycles */
# define FTS_DEFAULT 3 /* none of the above */
--
2.21.1

View File

@ -0,0 +1,153 @@
From 8c022656320592dbad146f5d3a3ae1875f419446 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 5 Mar 2020 17:25:29 -0800
Subject: [PATCH 1/2] ls: restore 8.31 behavior on removed directories
* NEWS: Mention this.
* src/ls.c: Do not include <sys/sycall.h>
(print_dir): Don't worry about whether the directory is removed.
* tests/ls/removed-directory.sh: Adjust to match new (i.e., old)
behavior.
Upstream-commit: 10fcb97bd728f09d4a027eddf8ad2900f0819b0a
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/ls.c | 22 ----------------------
tests/ls/removed-directory.sh | 10 ++--------
2 files changed, 2 insertions(+), 30 deletions(-)
diff --git a/src/ls.c b/src/ls.c
index 9d25f62..850ecc2 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -49,10 +49,6 @@
# include <sys/ptem.h>
#endif
-#ifdef __linux__
-# include <sys/syscall.h>
-#endif
-
#include <stdio.h>
#include <assert.h>
#include <setjmp.h>
@@ -2896,7 +2892,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
struct dirent *next;
uintmax_t total_blocks = 0;
static bool first = true;
- bool found_any_entries = false;
errno = 0;
dirp = opendir (name);
@@ -2972,7 +2967,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
next = readdir (dirp);
if (next)
{
- found_any_entries = true;
if (! file_ignored (next->d_name))
{
enum filetype type = unknown;
@@ -3018,22 +3012,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
if (errno != EOVERFLOW)
break;
}
-#ifdef __linux__
- else if (! found_any_entries)
- {
- /* If readdir finds no directory entries at all, not even "." or
- "..", then double check that the directory exists. */
- if (syscall (SYS_getdents, dirfd (dirp), NULL, 0) == -1
- && errno != EINVAL)
- {
- /* We exclude EINVAL as that pertains to buffer handling,
- and we've passed NULL as the buffer for simplicity.
- ENOENT is returned if appropriate before buffer handling. */
- file_failure (command_line_arg, _("reading directory %s"), name);
- }
- break;
- }
-#endif
else
break;
diff --git a/tests/ls/removed-directory.sh b/tests/ls/removed-directory.sh
index e8c835d..fe8f929 100755
--- a/tests/ls/removed-directory.sh
+++ b/tests/ls/removed-directory.sh
@@ -26,20 +26,14 @@ case $host_triplet in
*) skip_ 'non linux kernel' ;;
esac
-LS_FAILURE=2
-
-cat <<\EOF >exp-err || framework_failure_
-ls: reading directory '.': No such file or directory
-EOF
-
cwd=$(pwd)
mkdir d || framework_failure_
cd d || framework_failure_
rmdir ../d || framework_failure_
-returns_ $LS_FAILURE ls >../out 2>../err || fail=1
+ls >../out 2>../err || fail=1
cd "$cwd" || framework_failure_
compare /dev/null out || fail=1
-compare exp-err err || fail=1
+compare /dev/null err || fail=1
Exit $fail
--
2.21.1
From 847324a0debd9d12062c79e7a7a9d3d8ce76390d Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 7 Mar 2020 10:29:51 -0800
Subject: [PATCH 2/2] ls: improve removed-directory test
* tests/ls/removed-directory.sh: Remove host_triplet test.
Skip this test if one cannot remove the working directory.
From a suggestion by Bernhard Voelker (Bug#39929).
Upstream-commit: 672819c73f2e94e61386dc0584bddf9da860cc26
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
tests/ls/removed-directory.sh | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/tests/ls/removed-directory.sh b/tests/ls/removed-directory.sh
index fe8f929..63b209d 100755
--- a/tests/ls/removed-directory.sh
+++ b/tests/ls/removed-directory.sh
@@ -1,7 +1,7 @@
#!/bin/sh
-# If ls is asked to list a removed directory (e.g. the parent process's
-# current working directory that has been removed by another process), it
-# emits an error message.
+# If ls is asked to list a removed directory (e.g., the parent process's
+# current working directory has been removed by another process), it
+# should not emit an error message merely because the directory is removed.
# Copyright (C) 2020 Free Software Foundation, Inc.
@@ -21,15 +21,10 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ ls
-case $host_triplet in
- *linux*) ;;
- *) skip_ 'non linux kernel' ;;
-esac
-
cwd=$(pwd)
mkdir d || framework_failure_
cd d || framework_failure_
-rmdir ../d || framework_failure_
+rmdir ../d || skip_ "can't remove working directory on this platform"
ls >../out 2>../err || fail=1
cd "$cwd" || framework_failure_
--
2.21.1

View File

@ -0,0 +1,85 @@
From 53c6b01e8e3fd338d7f53e5ff817ef86f9efa852 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Wed, 11 Nov 2020 17:22:33 +0000
Subject: [PATCH] ls: fix crash printing SELinux context for unstatable files
This crash was identified by Cyber Independent Testing Lab:
https://cyber-itl.org/2020/10/28/citl-7000-defects.html
and was introduced with commit v6.9.90-11-g4245876e2
* src/ls.c (gobble_file): Ensure scontext is initialized
in the case where files are not statable.
* tests/ls/selinux-segfault.sh: Renamed from proc-selinux-segfault.sh,
and added test case for broken symlinks.
* tests/local.mk: Adjust for the renamed test.
Upstream-commit: 6fc695cb4a26f09dfeef8b1c24895a707055334e
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/ls.c | 3 +++
tests/local.mk | 2 +-
.../{proc-selinux-segfault.sh => selinux-segfault.sh} | 10 ++++++++--
3 files changed, 12 insertions(+), 3 deletions(-)
rename tests/ls/{proc-selinux-segfault.sh => selinux-segfault.sh} (77%)
diff --git a/src/ls.c b/src/ls.c
index 4acf5f4..8eb483d 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -3412,6 +3412,9 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
provokes an exit status of 1. */
file_failure (command_line_arg,
_("cannot access %s"), full_name);
+
+ f->scontext = UNKNOWN_SECURITY_CONTEXT;
+
if (command_line_arg)
return 0;
diff --git a/tests/local.mk b/tests/local.mk
index 2aeff2b..2441fdc 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -616,7 +616,7 @@ all_tests = \
tests/ls/multihardlink.sh \
tests/ls/no-arg.sh \
tests/ls/no-cap.sh \
- tests/ls/proc-selinux-segfault.sh \
+ tests/ls/selinux-segfault.sh \
tests/ls/quote-align.sh \
tests/ls/readdir-mountpoint-inode.sh \
tests/ls/recursive.sh \
diff --git a/tests/ls/proc-selinux-segfault.sh b/tests/ls/selinux-segfault.sh
similarity index 77%
rename from tests/ls/proc-selinux-segfault.sh
rename to tests/ls/selinux-segfault.sh
index 831a00e..e2b7ef6 100755
--- a/tests/ls/proc-selinux-segfault.sh
+++ b/tests/ls/selinux-segfault.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# ls -l /proc/sys would segfault when built against libselinux1 2.0.15-2+b1
+# Ensure we don't segfault in selinux handling
# Copyright (C) 2008-2020 Free Software Foundation, Inc.
@@ -19,9 +19,15 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ ls
+# ls -l /proc/sys would segfault when built against libselinux1 2.0.15-2+b1
f=/proc/sys
test -r $f || f=.
-
ls -l $f > out || fail=1
+# ls <= 8.32 would segfault when printing
+# the security context of broken symlink targets
+mkdir sedir || framework_failure_
+ln -sf missing sedir/broken || framework_failure_
+returns_ 1 ls -L -R -Z -m sedir > out || fail=1
+
Exit $fail
--
2.26.2

View File

@ -0,0 +1,186 @@
From be77b4ab7cb68fd2daf9de90bd75d844392788ac Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 25 Mar 2021 11:57:56 +0100
Subject: [PATCH 1/4] ln: fix memory leaks in do_link
* src/ln.c (do_link): Free memory allocated by convert_abs_rel
on all code paths (Bug#47373).
Upstream-commit: 6e98f67758260579d7d44ea5f2df4c82d28c9f58
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/ln.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/ln.c b/src/ln.c
index ffa278e..9b52602 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -229,14 +229,14 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
if (errno != ENOENT)
{
error (0, errno, _("failed to access %s"), quoteaf (dest));
- return false;
+ goto fail;
}
force = false;
}
else if (S_ISDIR (dest_stats.st_mode))
{
error (0, 0, _("%s: cannot overwrite directory"), quotef (dest));
- return false;
+ goto fail;
}
else if (seen_file (dest_set, dest, &dest_stats))
{
@@ -245,7 +245,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
error (0, 0,
_("will not overwrite just-created %s with %s"),
quoteaf_n (0, dest), quoteaf_n (1, source));
- return false;
+ goto fail;
}
else
{
@@ -274,7 +274,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
{
error (0, 0, _("%s and %s are the same file"),
quoteaf_n (0, source), quoteaf_n (1, dest));
- return false;
+ goto fail;
}
}
@@ -285,7 +285,10 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
fprintf (stderr, _("%s: replace %s? "),
program_name, quoteaf (dest));
if (!yesno ())
- return true;
+ {
+ free(rel_source);
+ return true;
+ }
}
if (backup_type != no_backups)
@@ -304,7 +307,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
{
error (0, rename_errno, _("cannot backup %s"),
quoteaf (dest));
- return false;
+ goto fail;
}
force = false;
}
@@ -397,6 +400,10 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
free (backup_base);
free (rel_source);
return link_errno <= 0;
+
+fail:
+ free (rel_source);
+ return false;
}
void
--
2.26.3
From c051578e69bd8acf8f8a469566ae34e855345532 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 25 Mar 2021 09:15:50 -0700
Subject: [PATCH 2/4] maint: indenting
* src/ln.c: Fix indenting.
Upstream-commit: 8980b7c898046d899646da01c296fd15f0cced21
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/ln.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ln.c b/src/ln.c
index 9b52602..8881d6a 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -286,7 +286,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
program_name, quoteaf (dest));
if (!yesno ())
{
- free(rel_source);
+ free (rel_source);
return true;
}
}
@@ -304,7 +304,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
free (backup_base);
backup_base = NULL;
if (rename_errno != ENOENT)
- {
+ {
error (0, rename_errno, _("cannot backup %s"),
quoteaf (dest));
goto fail;
--
2.26.3
From 0d6a4afe5bee0e397fb2fc3b205a29b32a69af9d Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 25 Mar 2021 09:16:36 -0700
Subject: [PATCH 3/4] hostname: use puts
* src/hostname.c (main): Prefer puts to printf "%s\n".
Upstream-commit: c7a588ac3632aae21642d4d568497177950d36bf
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/hostname.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hostname.c b/src/hostname.c
index 0b5c0cf..62cc98c 100644
--- a/src/hostname.c
+++ b/src/hostname.c
@@ -103,7 +103,7 @@ main (int argc, char **argv)
hostname = xgethostname ();
if (hostname == NULL)
die (EXIT_FAILURE, errno, _("cannot determine hostname"));
- printf ("%s\n", hostname);
+ puts (hostname);
}
if (optind + 1 < argc)
--
2.26.3
From 19c98d2080251edbaad9fb271aa10ad34f953500 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 25 Mar 2021 11:20:18 -0700
Subject: [PATCH 4/4] hostname: pacify valgrind
* src/hostname.c (main) [IF_LINT]: Free hostname (Bug#47384).
Upstream-commit: 4698e284f37844bc9b9f63f00eb556ccaaed5030
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/hostname.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/hostname.c b/src/hostname.c
index 62cc98c..7210248 100644
--- a/src/hostname.c
+++ b/src/hostname.c
@@ -104,6 +104,7 @@ main (int argc, char **argv)
if (hostname == NULL)
die (EXIT_FAILURE, errno, _("cannot determine hostname"));
puts (hostname);
+ IF_LINT (free (hostname));
}
if (optind + 1 < argc)
--
2.26.3

View File

@ -0,0 +1,104 @@
From 09400b7f7f48d8eedc0df55de8073a43bc0aac96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Tue, 27 Oct 2020 20:15:43 +0000
Subject: [PATCH 1/2] stat,tail: sync file system constants from the linux
kernel
* src/stat.c: Add magic constants for "devmem", and
"zonefs" file systems.
* NEWS: Mention the improvement.
Upstream-commit: ff80b6b0a0507e24f39cc1aad09d147f5187430b
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/stat.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/stat.c b/src/stat.c
index 5012622..8cd69da 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -347,6 +347,8 @@ human_fstype (STRUCT_STATVFS const *statfsbuf)
return "debugfs";
case S_MAGIC_DEVFS: /* 0x1373 local */
return "devfs";
+ case S_MAGIC_DEVMEM: /* 0x454D444D local */
+ return "devmem";
case S_MAGIC_DEVPTS: /* 0x1CD1 local */
return "devpts";
case S_MAGIC_DMA_BUF: /* 0x444D4142 local */
@@ -549,6 +551,8 @@ human_fstype (STRUCT_STATVFS const *statfsbuf)
return "z3fold";
case S_MAGIC_ZFS: /* 0x2FC12FC1 local */
return "zfs";
+ case S_MAGIC_ZONEFS: /* 0x5A4F4653 local */
+ return "zonefs";
case S_MAGIC_ZSMALLOC: /* 0x58295829 local */
return "zsmallocfs";
--
2.25.4
From d5948fd41013dfe4d2d10083111821667977c6d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Tue, 27 Oct 2020 21:04:14 +0000
Subject: [PATCH 2/2] mountlist: recognize more file system types as remote
Sync "remote" file systems from stat.c in coreutils.
Note we only consider file systems that do not use host:resource
mount source. I.e. those that don't generally use a colon when
mounting, as that case is already considered. Searching for
"<fstype> /etc/fstab" was informative for identifying these.
The full list of "remote" file systems in coreutils is currently:
acfs afs ceph cifs coda fhgfs fuseblk fusectl
gfs gfs2 gpfs ibrix k-afs lustre novell nfs nfsd
ocfs2 panfs prl_fs smb smb2 snfs vboxsf vmhgfs vxfs
Note also we do not include virtual machine file systems,
as even though they're remote to the current kernel,
they are generally not distributed to separate hosts.
* lib/mountlist.c (ME_REMOTE): Sync previously unconsidered
"remote" file systems from stat.c in coreutils.
Upstream-commit: dd1fc46be12d671c1a9d9dc5a6fa8c766e99aa2f
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
lib/mountlist.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/mountlist.c b/lib/mountlist.c
index 7abe024..e0227b7 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -221,8 +221,9 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
#ifndef ME_REMOTE
/* A file system is "remote" if its Fs_name contains a ':'
or if (it is of type (smbfs or cifs) and its Fs_name starts with '//')
- or if it is of type (afs or auristorfs)
- or Fs_name is equal to "-hosts" (used by autofs to mount remote fs). */
+ or if it is of any other of the listed types
+ or Fs_name is equal to "-hosts" (used by autofs to mount remote fs).
+ "VM" file systems like prl_fs or vboxsf are not considered remote here. */
# define ME_REMOTE(Fs_name, Fs_type) \
(strchr (Fs_name, ':') != NULL \
|| ((Fs_name)[0] == '/' \
@@ -230,8 +231,15 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
&& (strcmp (Fs_type, "smbfs") == 0 \
|| strcmp (Fs_type, "smb3") == 0 \
|| strcmp (Fs_type, "cifs") == 0)) \
+ || strcmp (Fs_type, "acfs") == 0 \
|| strcmp (Fs_type, "afs") == 0 \
+ || strcmp (Fs_type, "coda") == 0 \
|| strcmp (Fs_type, "auristorfs") == 0 \
+ || strcmp (Fs_type, "fhgfs") == 0 \
+ || strcmp (Fs_type, "gpfs") == 0 \
+ || strcmp (Fs_type, "ibrix") == 0 \
+ || strcmp (Fs_type, "ocfs2") == 0 \
+ || strcmp (Fs_type, "vxfs") == 0 \
|| strcmp ("-hosts", Fs_name) == 0)
#endif
--
2.25.4

View File

@ -0,0 +1,32 @@
From b87f944c87ffe04db6e5476b007a8e4979de933d Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 18 Feb 2021 11:18:04 +0100
Subject: [PATCH] stat,tail: add support for the exfat file system
Bug: https://bugzilla.redhat.com/1921427
* src/stat.c (human_fstype): Add case for the 'exfat' file system type.
Fixes https://bugs.gnu.org/46613
Upstream-commit: a5e0d8f387e81e854427addbbaf2504541bbf4b9
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/stat.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/stat.c b/src/stat.c
index 8cd69da..4e1c8e3 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -361,6 +361,8 @@ human_fstype (STRUCT_STATVFS const *statfsbuf)
return "efs";
case S_MAGIC_EROFS_V1: /* 0xE0F5E1E2 local */
return "erofs";
+ case S_MAGIC_EXFAT: /* 0x2011BAB0 local */
+ return "exfat";
case S_MAGIC_EXFS: /* 0x45584653 local */
return "exfs";
case S_MAGIC_EXOFS: /* 0x5DF5 local */
--
2.26.2

View File

@ -0,0 +1,204 @@
From 73d119f4f8052a9fb6cef13cd9e75d5a4e23311a Mon Sep 17 00:00:00 2001
From: dann frazier <dann.frazier@canonical.com>
Date: Wed, 29 Nov 2023 18:32:34 -0700
Subject: [PATCH] tail: fix tailing sysfs files where PAGE_SIZE > BUFSIZ
* src/tail.c (file_lines): Ensure we use a buffer size >= PAGE_SIZE when
searching backwards to avoid seeking within a file,
which on sysfs files is accepted but also returns no data.
* tests/tail/tail-sysfs.sh: Add a new test.
* tests/local.mk: Reference the new test.
Fixes https://bugs.gnu.org/67490
Upstream-commit: 73d119f4f8052a9fb6cef13cd9e75d5a4e23311a
Cherry-picked-by: Lukáš Zaoral <lzaoral@redhat.com>
---
src/tail.c | 57 +++++++++++++++++++++++++++++-----------
tests/local.mk | 1 +
tests/tail-2/tail-sysfs.sh | 34 ++++++++++++++++++++++++
3 files changed, 77 insertions(+), 15 deletions(-)
create mode 100755 tests/tail/tail-sysfs.sh
diff --git a/src/tail.c b/src/tail.c
index c45f3b65a..6979e0ba3 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -208,6 +208,9 @@ static int nbpids = 0;
that is writing to all followed files. */
static pid_t pid;
+/* Used to determine the buffer size when scanning backwards in a file. */
+static int page_size;
+
/* True if we have ever read standard input. */
static bool have_read_stdin;
@@ -515,22 +518,40 @@ xlseek (int fd, off_t offset, int whence, char const *filename)
Return true if successful. */
static bool
-file_lines (const char *pretty_filename, int fd, uintmax_t n_lines,
- off_t start_pos, off_t end_pos, uintmax_t *read_pos)
+file_lines (const char *pretty_filename, int fd, struct stat const *sb,
+ uintmax_t n_lines, off_t start_pos, off_t end_pos,
+ uintmax_t *read_pos)
{
- char buffer[BUFSIZ];
+ char *buffer;
size_t bytes_read;
+ blksize_t bufsize = BUFSIZ;
off_t pos = end_pos;
+ bool ok = true;
if (n_lines == 0)
return true;
+ /* Be careful with files with sizes that are a multiple of the page size,
+ as on /proc or /sys file systems these files accept seeking to within
+ the file, but then return no data when read. So use a buffer that's
+ at least PAGE_SIZE to avoid seeking within such files.
+
+ We could also indirectly use a large enough buffer through io_blksize()
+ however this would be less efficient in the common case, as it would
+ generally pick a larger buffer size, resulting in reading more data
+ from the end of the file. */
+ assert (S_ISREG (sb->st_mode));
+ if (sb->st_size % page_size == 0)
+ bufsize = MAX (BUFSIZ, page_size);
+
+ buffer = xmalloc (bufsize);
+
/* Set 'bytes_read' to the size of the last, probably partial, buffer;
- 0 < 'bytes_read' <= 'BUFSIZ'. */
- bytes_read = (pos - start_pos) % BUFSIZ;
+ 0 < 'bytes_read' <= 'bufsize'. */
+ bytes_read = (pos - start_pos) % bufsize;
if (bytes_read == 0)
- bytes_read = BUFSIZ;
- /* Make 'pos' a multiple of 'BUFSIZ' (0 if the file is short), so that all
+ bytes_read = bufsize;
+ /* Make 'pos' a multiple of 'bufsize' (0 if the file is short), so that all
reads will be on block boundaries, which might increase efficiency. */
pos -= bytes_read;
xlseek (fd, pos, SEEK_SET, pretty_filename);
@@ -538,7 +559,8 @@ file_lines (char const *pretty_filename, int fd, uintmax_t n_lines,
if (bytes_read == SAFE_READ_ERROR)
{
error (0, errno, _("error reading %s"), quoteaf (pretty_filename));
- return false;
+ ok = false;
+ goto free_buffer;
}
*read_pos = pos + bytes_read;
@@ -565,7 +587,7 @@ file_lines (char const *pretty_filename, int fd, uintmax_t n_lines,
xwrite_stdout (nl + 1, bytes_read - (n + 1));
*read_pos += dump_remainder (false, pretty_filename, fd,
end_pos - (pos + bytes_read));
- return true;
+ goto free_buffer;
}
}
@@ -577,23 +599,26 @@ file_lines (char const *pretty_filename, int fd, uintmax_t n_lines,
xlseek (fd, start_pos, SEEK_SET, pretty_filename);
*read_pos = start_pos + dump_remainder (false, pretty_filename, fd,
end_pos);
- return true;
+ goto free_buffer;
}
- pos -= BUFSIZ;
+ pos -= bufsize;
xlseek (fd, pos, SEEK_SET, pretty_filename);
- bytes_read = safe_read (fd, buffer, BUFSIZ);
+ bytes_read = safe_read (fd, buffer, bufsize);
if (bytes_read == SAFE_READ_ERROR)
{
error (0, errno, _("error reading %s"), quoteaf (pretty_filename));
- return false;
+ ok = false;
+ goto free_buffer;
}
*read_pos = pos + bytes_read;
}
while (bytes_read > 0);
- return true;
+free_buffer:
+ free (buffer);
+ return ok;
}
/* Print the last N_LINES lines from the end of the standard input,
@@ -1915,7 +1940,7 @@ tail_lines (char const *pretty_filename, int fd, uintmax_t n_lines,
{
*read_pos = end_pos;
if (end_pos != 0
- && ! file_lines (pretty_filename, fd, n_lines,
+ && ! file_lines (pretty_filename, fd, &stats, n_lines,
start_pos, end_pos, read_pos))
return false;
}
@@ -2337,6 +2362,8 @@ main (int argc, char **argv)
atexit (close_stdout);
+ page_size = getpagesize ();
+
have_read_stdin = false;
count_lines = true;
diff --git a/tests/local.mk b/tests/local.mk
index db4ee7ed8..bf03238c3 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -257,6 +257,7 @@ all_tests = \
tests/misc/seq-precision.sh \
tests/misc/head.pl \
tests/misc/head-elide-tail.pl \
+ tests/tail-2/tail-sysfs.sh \
tests/tail-2/tail-n0f.sh \
tests/misc/ls-misc.pl \
tests/misc/date.pl \
diff --git a/tests/tail/tail-sysfs.sh b/tests/tail-2/tail-sysfs.sh
new file mode 100755
index 000000000..00874b3dc
--- /dev/null
+++ b/tests/tail-2/tail-sysfs.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# sysfs files have weird properties that can be influenced by page size
+
+# Copyright 2023 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# 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, see <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ tail
+
+file='/sys/kernel/profiling'
+
+test -r "$file" || skip_ "No $file file"
+
+cp -f "$file" exp || framework_failure_
+
+tail -n1 "$file" > out || fail=1
+compare exp out || fail=1
+
+tail -c2 "$file" > out || fail=1
+compare exp out || fail=1
+
+Exit $fail

View File

@ -0,0 +1,181 @@
From c7a04cef4075da864a3468e63a5bb79334d8f556 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 26 Jun 2021 18:23:52 -0700
Subject: [PATCH] tail: use poll, not select
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This fixes an unlikely stack out-of-bounds write reported by
Stepan Broz via Kamil Dudka (Bug#49209).
* src/tail.c: Do not include <sys/select.h>.
[!_AIX]: Include poll.h.
(check_output_alive) [!_AIX]: Use poll instead of select.
(tail_forever_inotify): Likewise. Simplify logic, as there is no
need for a while (len <= evbuf_off) loop.
Upstream-commit: da0d448bca62c6305fc432f67e2c5ccc2da75346
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/tail.c | 100 +++++++++++++++++++++--------------------------------
1 file changed, 39 insertions(+), 61 deletions(-)
diff --git a/src/tail.c b/src/tail.c
index 1c88723..5b4f21a 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -28,12 +28,9 @@
#include <stdio.h>
#include <assert.h>
#include <getopt.h>
-#include <sys/select.h>
+#include <poll.h>
#include <sys/types.h>
#include <signal.h>
-#ifdef _AIX
-# include <poll.h>
-#endif
#include "system.h"
#include "argmatch.h"
@@ -351,27 +348,12 @@ check_output_alive (void)
if (! monitor_output)
return;
-#ifdef _AIX
- /* select on AIX was seen to give a readable event immediately. */
struct pollfd pfd;
pfd.fd = STDOUT_FILENO;
pfd.events = POLLERR;
if (poll (&pfd, 1, 0) >= 0 && (pfd.revents & POLLERR))
die_pipe ();
-#else
- struct timeval delay;
- delay.tv_sec = delay.tv_usec = 0;
-
- fd_set rfd;
- FD_ZERO (&rfd);
- FD_SET (STDOUT_FILENO, &rfd);
-
- /* readable event on STDOUT is equivalent to POLLERR,
- and implies an error condition on output like broken pipe. */
- if (select (STDOUT_FILENO + 1, &rfd, NULL, NULL, &delay) == 1)
- die_pipe ();
-#endif
}
static bool
@@ -1612,7 +1594,7 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
/* Wait for inotify events and handle them. Events on directories
ensure that watched files can be re-added when following by name.
This loop blocks on the 'safe_read' call until a new event is notified.
- But when --pid=P is specified, tail usually waits via the select. */
+ But when --pid=P is specified, tail usually waits via poll. */
while (1)
{
struct File_spec *fspec;
@@ -1629,54 +1611,51 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
return false;
}
- /* When watching a PID, ensure that a read from WD will not block
- indefinitely. */
- while (len <= evbuf_off)
+ if (len <= evbuf_off)
{
- struct timeval delay; /* how long to wait for file changes. */
+ /* Poll for inotify events. When watching a PID, ensure
+ that a read from WD will not block indefinitely.
+ If MONITOR_OUTPUT, also poll for a broken output pipe. */
- if (pid)
+ int file_change;
+ struct pollfd pfd[2];
+ do
{
- if (writer_is_dead)
- exit (EXIT_SUCCESS);
+ /* How many ms to wait for changes. -1 means wait forever. */
+ int delay = -1;
- writer_is_dead = (kill (pid, 0) != 0 && errno != EPERM);
-
- if (writer_is_dead)
- delay.tv_sec = delay.tv_usec = 0;
- else
+ if (pid)
{
- delay.tv_sec = (time_t) sleep_interval;
- delay.tv_usec = 1000000 * (sleep_interval - delay.tv_sec);
+ if (writer_is_dead)
+ exit (EXIT_SUCCESS);
+
+ writer_is_dead = (kill (pid, 0) != 0 && errno != EPERM);
+
+ if (writer_is_dead || sleep_interval <= 0)
+ delay = 0;
+ else if (sleep_interval < INT_MAX / 1000 - 1)
+ {
+ /* delay = ceil (sleep_interval * 1000), sans libm. */
+ double ddelay = sleep_interval * 1000;
+ delay = ddelay;
+ delay += delay < ddelay;
+ }
}
+
+ pfd[0].fd = wd;
+ pfd[0].events = POLLIN;
+ pfd[1].fd = STDOUT_FILENO;
+ pfd[1].events = pfd[1].revents = 0;
+ file_change = poll (pfd, monitor_output + 1, delay);
}
+ while (file_change == 0);
- fd_set rfd;
- FD_ZERO (&rfd);
- FD_SET (wd, &rfd);
- if (monitor_output)
- FD_SET (STDOUT_FILENO, &rfd);
-
- int file_change = select (MAX (wd, STDOUT_FILENO) + 1,
- &rfd, NULL, NULL, pid ? &delay: NULL);
-
- if (file_change == 0)
- continue;
- else if (file_change == -1)
- die (EXIT_FAILURE, errno,
- _("error waiting for inotify and output events"));
- else if (FD_ISSET (STDOUT_FILENO, &rfd))
- {
- /* readable event on STDOUT is equivalent to POLLERR,
- and implies an error on output like broken pipe. */
- die_pipe ();
- }
- else
- break;
- }
+ if (file_change < 0)
+ die (EXIT_FAILURE, errno,
+ _("error waiting for inotify and output events"));
+ if (pfd[1].revents)
+ die_pipe ();
- if (len <= evbuf_off)
- {
len = safe_read (wd, evbuf, evlen);
evbuf_off = 0;
@@ -2437,8 +2416,7 @@ main (int argc, char **argv)
if (forever && ignore_fifo_and_pipe (F, n_files))
{
/* If stdout is a fifo or pipe, then monitor it
- so that we exit if the reader goes away.
- Note select() on a regular file is always readable. */
+ so that we exit if the reader goes away. */
struct stat out_stat;
if (fstat (STDOUT_FILENO, &out_stat) < 0)
die (EXIT_FAILURE, errno, _("standard output"));
--
2.31.1

View File

@ -0,0 +1,99 @@
From fc6318841f008dadc1e7c93e539f10d24aa83e90 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Wed, 21 Apr 2021 00:12:00 +0200
Subject: [PATCH 1/2] tests: fix FP in ls/stat-free-color.sh
On newer systems like Fedora 34 and openSUSE Tumbleweed, ls(1) calls
newfstatat(STDOUT_FILENO, ...), but only when there is something to
output.
* tests/ls/stat-free-color.sh: Add -a option to the reference invocation
of ls, thus enforcing something gets output.
Upstream-commit: b7091093bb6505c33279f9bc940b2e94763a6e5d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
tests/ls/stat-free-color.sh | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tests/ls/stat-free-color.sh b/tests/ls/stat-free-color.sh
index 00942f7..87bed1c 100755
--- a/tests/ls/stat-free-color.sh
+++ b/tests/ls/stat-free-color.sh
@@ -56,12 +56,14 @@ eval $(dircolors -b color-without-stat)
# The system may perform additional stat-like calls before main.
# Furthermore, underlying library functions may also implicitly
# add an extra stat call, e.g. opendir since glibc-2.21-360-g46f894d.
-# To avoid counting those, first get a baseline count for running
-# ls with one empty directory argument. Then, compare that with the
-# invocation under test.
+# Finally, ls(1) makes a stat call for stdout, but only in the case
+# when there is something to output.
+# To get the comparison right, first get a baseline count for running
+# 'ls -a' with one empty directory argument. Then, compare that with
+# the invocation under test.
mkdir d || framework_failure_
-strace -q -o log1 -e $stats ls --color=always d || fail=1
+strace -q -o log1 -e $stats ls -a --color=always d || fail=1
n_stat1=$(grep -vF '+++' log1 | wc -l) || framework_failure_
test $n_stat1 = 0 \
--
2.31.1
From c16ca58f17a088e925c0d1c4015c48332c380a00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Sun, 9 May 2021 23:41:00 +0100
Subject: [PATCH 2/2] tests: fix tests/cp/sparse-2.sh false failure on some
systems
* tests/cp/sparse-2.sh: Double check cp --sparse=always,
with dd conv=sparse, in the case where the former didn't
create a sparse file. Now that this test is being newly run
on macos, we're seeing a failure due to seek() not creating
holes on apfs unless the size is >= 16MiB.
Upstream-commit: 6b499720fecae935dc00e236d6aefe94d9010482
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
tests/cp/fiemap-2.sh | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/tests/cp/fiemap-2.sh b/tests/cp/fiemap-2.sh
index 548a376..e20ce54 100755
--- a/tests/cp/fiemap-2.sh
+++ b/tests/cp/fiemap-2.sh
@@ -17,7 +17,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ cp
+print_ver_ cp stat dd
# Require a fiemap-enabled FS.
touch fiemap_chk # check a file rather than current dir for best coverage
@@ -46,10 +46,17 @@ dd bs=1k seek=1 of=k count=255 < /dev/zero || framework_failure_
# cp should detect the all-zero blocks and convert some of them to holes.
# How many it detects/converts currently depends on io_blksize.
-# Currently, on my F14/ext4 desktop, this K starts off with size 256KiB,
+# Currently, on my F14/ext4 desktop, this K file starts off with size 256KiB,
# (note that the K in the preceding test starts off with size 4KiB).
# cp from coreutils-8.9 with --sparse=always reduces the size to 32KiB.
cp --sparse=always k k2 || fail=1
-test $(stat -c %b k2) -lt $(stat -c %b k) || fail=1
+if test $(stat -c %b k2) -ge $(stat -c %b k); then
+ # If not sparse, then double check by creating with dd
+ # as we're not guaranteed that seek will create a hole.
+ # apfs on darwin 19.2.0 for example was seen to not to create holes < 16MiB.
+ hole_size=$(stat -c %o k2) || framework_failure_
+ dd if=k of=k2.dd bs=$hole_size conv=sparse || framework_failure_
+ test $(stat -c %b k2) -eq $(stat -c %b k2.dd) || fail=1
+fi
Exit $fail
--
2.31.1

View File

@ -23,15 +23,15 @@ diff --git a/src/ls.c b/src/ls.c
index 1047801..fe0e9f8 100644 index 1047801..fe0e9f8 100644
--- a/src/ls.c --- a/src/ls.c
+++ b/src/ls.c +++ b/src/ls.c
@@ -1126,7 +1126,7 @@ do_statx (int fd, const char *name, struct stat *st, int flags, @@ -1175,7 +1175,7 @@ do_statx (int fd, char const *name, struct stat *st, int flags,
unsigned int mask)
{ {
struct statx stx; struct statx stx;
bool want_btime = mask & STATX_BTIME;
- int ret = statx (fd, name, flags, mask, &stx); - int ret = statx (fd, name, flags, mask, &stx);
+ int ret = statx (fd, name, flags | AT_NO_AUTOMOUNT, mask, &stx); + int ret = statx (fd, name, flags | AT_NO_AUTOMOUNT, mask, &stx);
if (ret >= 0) if (ret >= 0)
statx_to_stat (&stx, st); {
return ret; statx_to_stat (&stx, st);
-- --
2.34.1 2.34.1
@ -60,7 +60,7 @@ diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 19b535c..0f5c16a 100644 index 19b535c..0f5c16a 100644
--- a/doc/coreutils.texi --- a/doc/coreutils.texi
+++ b/doc/coreutils.texi +++ b/doc/coreutils.texi
@@ -12204,6 +12204,7 @@ Always read the already cached attributes if available. @@ -12564,6 +12564,7 @@ Always read the already cached attributes if available.
@item never @item never
Always sychronize with the latest file system attributes. Always sychronize with the latest file system attributes.
@ -72,7 +72,7 @@ diff --git a/src/stat.c b/src/stat.c
index 0c34501..803340a 100644 index 0c34501..803340a 100644
--- a/src/stat.c --- a/src/stat.c
+++ b/src/stat.c +++ b/src/stat.c
@@ -1343,6 +1343,9 @@ do_stat (char const *filename, char const *format, char const *format2) @@ -1381,6 +1381,9 @@ do_stat (char const *filename, char const *format, char const *format2)
else if (force_sync) else if (force_sync)
flags |= AT_STATX_FORCE_SYNC; flags |= AT_STATX_FORCE_SYNC;

View File

@ -15,11 +15,6 @@ alias l. 'ls -d .*'
set COLORS=/etc/DIR_COLORS set COLORS=/etc/DIR_COLORS
if ($?TERM) then if ($?TERM) then
if ( -e "/etc/DIR_COLORS.256color" ) then
if ( "`/usr/bin/tput colors`" == "256" ) then
set COLORS=/etc/DIR_COLORS.256color
endif
endif
if ( -e "/etc/DIR_COLORS.$TERM" ) then if ( -e "/etc/DIR_COLORS.$TERM" ) then
set COLORS="/etc/DIR_COLORS.$TERM" set COLORS="/etc/DIR_COLORS.$TERM"
endif endif

View File

@ -22,10 +22,6 @@ if [ -z "$USER_LS_COLORS" ]; then
[ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS.$TERM" ] && \ [ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS.$TERM" ] && \
COLORS="/etc/DIR_COLORS.$TERM" COLORS="/etc/DIR_COLORS.$TERM"
[ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS.256color" ] && \
[ "x`/usr/bin/tty -s && /usr/bin/tput colors 2>/dev/null`" = "x256" ] && \
COLORS="/etc/DIR_COLORS.256color"
[ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS" ] && \ [ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS" ] && \
COLORS="/etc/DIR_COLORS" COLORS="/etc/DIR_COLORS"

View File

@ -23,6 +23,7 @@ Co-authored-by: Pádraig Brady <pbrady@redhat.com>
lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++ lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++
m4/mbfile.m4 | 14 +++ m4/mbfile.m4 | 14 +++
src/expand.c | 43 +++++---- src/expand.c | 43 +++++----
src/local.mk | 4 +-
src/unexpand.c | 54 +++++++---- src/unexpand.c | 54 +++++++----
tests/expand/mb.sh | 98 ++++++++++++++++++++ tests/expand/mb.sh | 98 ++++++++++++++++++++
tests/local.mk | 2 + tests/local.mk | 2 +
@ -458,6 +459,21 @@ index 9fa2e10..380e020 100644
} }
} }
diff --git a/src/local.mk b/src/local.mk
index 72db9c704..ef3bfa469 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -415,8 +415,8 @@ src_basenc_CPPFLAGS = -DBASE_TYPE=42 $(AM_CPPFLAGS)
src_ginstall_CPPFLAGS = -DENABLE_MATCHPATHCON=1 $(AM_CPPFLAGS)
-src_expand_SOURCES = src/expand.c src/expand-common.c
-src_unexpand_SOURCES = src/unexpand.c src/expand-common.c
+src_expand_SOURCES = src/expand.c src/expand-common.c lib/mbfile.c
+src_unexpand_SOURCES = src/unexpand.c src/expand-common.c lib/mbfile.c
# Ensure we don't link against libcoreutils.a as that lib is
# not compiled with -fPIC which causes issues on 64 bit at least
diff --git a/src/unexpand.c b/src/unexpand.c diff --git a/src/unexpand.c b/src/unexpand.c
index 7801274..569a7ee 100644 index 7801274..569a7ee 100644
--- a/src/unexpand.c --- a/src/unexpand.c

View File

@ -6,23 +6,23 @@ Subject: [PATCH] coreutils-i18n.patch
TODO: merge upstream TODO: merge upstream
--- ---
lib/linebuffer.h | 8 + lib/linebuffer.h | 8 +
src/fold.c | 308 ++++++++++++++++-- src/fold.c | 308 +++++++++++++--
src/join.c | 359 ++++++++++++++++++--- src/join.c | 359 ++++++++++++++---
src/pr.c | 443 ++++++++++++++++++++++--- src/pr.c | 443 +++++++++++++++++++--
src/sort.c | 764 +++++++++++++++++++++++++++++++++++++++++--- src/sort.c | 764 ++++++++++++++++++++++++++++++++++--
src/uniq.c | 265 ++++++++++++++- src/uniq.c | 119 +++++-
tests/i18n/sort.sh | 29 ++ tests/i18n/sort.sh | 29 ++
tests/local.mk | 2 + tests/local.mk | 2 +
tests/misc/expand.pl | 42 +++ tests/misc/expand.pl | 42 ++
tests/misc/fold.pl | 50 ++- tests/misc/fold.pl | 50 ++-
tests/misc/join.pl | 50 +++ tests/misc/join.pl | 50 +++
tests/misc/sort-mb-tests.sh | 45 +++ tests/misc/sort-mb-tests.sh | 45 +++
tests/misc/sort-merge.pl | 42 +++ tests/misc/sort-merge.pl | 42 ++
tests/misc/sort.pl | 40 ++- tests/misc/sort.pl | 40 +-
tests/misc/unexpand.pl | 39 +++ tests/misc/unexpand.pl | 39 ++
tests/misc/uniq.pl | 55 ++++ tests/misc/uniq.pl | 55 +++
tests/pr/pr-tests.pl | 49 +++ tests/pr/pr-tests.pl | 49 +++
17 files changed, 2430 insertions(+), 160 deletions(-) 17 files changed, 2290 insertions(+), 154 deletions(-)
create mode 100755 tests/i18n/sort.sh create mode 100755 tests/i18n/sort.sh
create mode 100755 tests/misc/sort-mb-tests.sh create mode 100755 tests/misc/sort-mb-tests.sh
@ -412,7 +412,7 @@ index 8cd0d6b..d23edd5 100644
+ if (istream == NULL) + if (istream == NULL)
+ { + {
+ error (0, errno, "%s", filename); + error (0, errno, "%s", filename);
+ return 1; + return false;
+ } + }
+ +
+ /* Define how ISTREAM is being folded. */ + /* Define how ISTREAM is being folded. */
@ -893,7 +893,7 @@ index 98b461c..9990f38 100644
} }
putchar (eolchar); putchar (eolchar);
} }
@@ -1099,20 +1345,43 @@ main (int argc, char **argv) @@ -1098,20 +1344,43 @@ main (int argc, char **argv)
case 't': case 't':
{ {
@ -975,8 +975,8 @@ index 26f221f..633f50e 100644
#include "system.h" #include "system.h"
#include "die.h" #include "die.h"
#include "error.h" #include "error.h"
@@ -324,6 +342,18 @@ @@ -325,6 +343,18 @@
#include "xstrtol.h" #include "xstrtol-error.h"
#include "xdectoint.h" #include "xdectoint.h"
+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ +/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
@ -994,7 +994,7 @@ index 26f221f..633f50e 100644
/* The official name of this program (e.g., no 'g' prefix). */ /* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "pr" #define PROGRAM_NAME "pr"
@@ -416,7 +446,20 @@ struct COLUMN @@ -417,7 +447,20 @@ struct COLUMN
typedef struct COLUMN COLUMN; typedef struct COLUMN COLUMN;
@ -1016,7 +1016,7 @@ index 26f221f..633f50e 100644
static bool read_line (COLUMN *p); static bool read_line (COLUMN *p);
static bool print_page (void); static bool print_page (void);
static bool print_stored (COLUMN *p); static bool print_stored (COLUMN *p);
@@ -428,6 +471,7 @@ static void add_line_number (COLUMN *p); @@ -429,6 +472,7 @@ static void add_line_number (COLUMN *p);
static void getoptnum (const char *n_str, int min, int *num, static void getoptnum (const char *n_str, int min, int *num,
const char *errfmt); const char *errfmt);
static void getoptarg (char *arg, char switch_char, char *character, static void getoptarg (char *arg, char switch_char, char *character,
@ -1024,7 +1024,7 @@ index 26f221f..633f50e 100644
int *number); int *number);
static void print_files (int number_of_files, char **av); static void print_files (int number_of_files, char **av);
static void init_parameters (int number_of_files); static void init_parameters (int number_of_files);
@@ -441,7 +485,6 @@ static void store_char (char c); @@ -442,7 +486,6 @@ static void store_char (char c);
static void pad_down (unsigned int lines); static void pad_down (unsigned int lines);
static void read_rest_of_line (COLUMN *p); static void read_rest_of_line (COLUMN *p);
static void skip_read (COLUMN *p, int column_number); static void skip_read (COLUMN *p, int column_number);
@ -1032,7 +1032,7 @@ index 26f221f..633f50e 100644
static void cleanup (void); static void cleanup (void);
static void print_sep_string (void); static void print_sep_string (void);
static void separator_string (const char *optarg_S); static void separator_string (const char *optarg_S);
@@ -453,7 +496,7 @@ static COLUMN *column_vector; @@ -454,7 +497,7 @@ static COLUMN *column_vector;
we store the leftmost columns contiguously in buff. we store the leftmost columns contiguously in buff.
To print a line from buff, get the index of the first character To print a line from buff, get the index of the first character
from line_vector[i], and print up to line_vector[i + 1]. */ from line_vector[i], and print up to line_vector[i + 1]. */
@ -1041,7 +1041,7 @@ index 26f221f..633f50e 100644
/* Index of the position in buff where the next character /* Index of the position in buff where the next character
will be stored. */ will be stored. */
@@ -557,7 +600,7 @@ static int chars_per_column; @@ -558,7 +601,7 @@ static int chars_per_column;
static bool untabify_input = false; static bool untabify_input = false;
/* (-e) The input tab character. */ /* (-e) The input tab character. */
@ -1050,7 +1050,7 @@ index 26f221f..633f50e 100644
/* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ... /* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ...
where the leftmost column is 1. */ where the leftmost column is 1. */
@@ -567,7 +610,10 @@ static int chars_per_input_tab = 8; @@ -568,7 +611,10 @@ static int chars_per_input_tab = 8;
static bool tabify_output = false; static bool tabify_output = false;
/* (-i) The output tab character. */ /* (-i) The output tab character. */
@ -1062,7 +1062,7 @@ index 26f221f..633f50e 100644
/* (-i) The width of the output tab. */ /* (-i) The width of the output tab. */
static int chars_per_output_tab = 8; static int chars_per_output_tab = 8;
@@ -637,7 +683,13 @@ static int line_number; @@ -638,7 +684,13 @@ static int line_number;
static bool numbered_lines = false; static bool numbered_lines = false;
/* (-n) Character which follows each line number. */ /* (-n) Character which follows each line number. */
@ -1077,7 +1077,7 @@ index 26f221f..633f50e 100644
/* (-n) line counting starts with 1st line of input file (not with 1st /* (-n) line counting starts with 1st line of input file (not with 1st
line of 1st page printed). */ line of 1st page printed). */
@@ -690,6 +742,7 @@ static bool use_col_separator = false; @@ -691,6 +743,7 @@ static bool use_col_separator = false;
-a|COLUMN|-m is a 'space' and with the -J option a 'tab'. */ -a|COLUMN|-m is a 'space' and with the -J option a 'tab'. */
static char const *col_sep_string = ""; static char const *col_sep_string = "";
static int col_sep_length = 0; static int col_sep_length = 0;
@ -1085,7 +1085,7 @@ index 26f221f..633f50e 100644
static char *column_separator = (char *) " "; static char *column_separator = (char *) " ";
static char *line_separator = (char *) "\t"; static char *line_separator = (char *) "\t";
@@ -851,6 +904,13 @@ separator_string (const char *optarg_S) @@ -852,6 +905,13 @@ separator_string (const char *optarg_S)
integer_overflow (); integer_overflow ();
col_sep_length = len; col_sep_length = len;
col_sep_string = optarg_S; col_sep_string = optarg_S;
@ -1099,7 +1099,7 @@ index 26f221f..633f50e 100644
} }
int int
@@ -875,6 +935,21 @@ main (int argc, char **argv) @@ -876,6 +936,21 @@ main (int argc, char **argv)
atexit (close_stdout); atexit (close_stdout);
@ -1121,7 +1121,7 @@ index 26f221f..633f50e 100644
n_files = 0; n_files = 0;
file_names = (argc > 1 file_names = (argc > 1
? xnmalloc (argc - 1, sizeof (char *)) ? xnmalloc (argc - 1, sizeof (char *))
@@ -951,8 +1026,12 @@ main (int argc, char **argv) @@ -952,8 +1027,12 @@ main (int argc, char **argv)
break; break;
case 'e': case 'e':
if (optarg) if (optarg)
@ -1136,7 +1136,7 @@ index 26f221f..633f50e 100644
/* Could check tab width > 0. */ /* Could check tab width > 0. */
untabify_input = true; untabify_input = true;
break; break;
@@ -965,8 +1044,12 @@ main (int argc, char **argv) @@ -966,8 +1045,12 @@ main (int argc, char **argv)
break; break;
case 'i': case 'i':
if (optarg) if (optarg)
@ -1151,7 +1151,7 @@ index 26f221f..633f50e 100644
/* Could check tab width > 0. */ /* Could check tab width > 0. */
tabify_output = true; tabify_output = true;
break; break;
@@ -984,8 +1067,8 @@ main (int argc, char **argv) @@ -985,8 +1068,8 @@ main (int argc, char **argv)
case 'n': case 'n':
numbered_lines = true; numbered_lines = true;
if (optarg) if (optarg)
@ -1162,7 +1162,7 @@ index 26f221f..633f50e 100644
break; break;
case 'N': case 'N':
skip_count = false; skip_count = false;
@@ -1010,6 +1093,7 @@ main (int argc, char **argv) @@ -1011,6 +1094,7 @@ main (int argc, char **argv)
/* Reset an additional input of -s, -S dominates -s */ /* Reset an additional input of -s, -S dominates -s */
col_sep_string = ""; col_sep_string = "";
col_sep_length = 0; col_sep_length = 0;
@ -1170,7 +1170,7 @@ index 26f221f..633f50e 100644
use_col_separator = true; use_col_separator = true;
if (optarg) if (optarg)
separator_string (optarg); separator_string (optarg);
@@ -1165,10 +1249,45 @@ getoptnum (const char *n_str, int min, int *num, const char *err) @@ -1166,10 +1250,45 @@ getoptnum (const char *n_str, int min, int *num, const char *err)
a number. */ a number. */
static void static void
@ -1218,7 +1218,7 @@ index 26f221f..633f50e 100644
if (*arg) if (*arg)
{ {
long int tmp_long; long int tmp_long;
@@ -1190,6 +1309,11 @@ static void @@ -1191,6 +1310,11 @@ static void
init_parameters (int number_of_files) init_parameters (int number_of_files)
{ {
int chars_used_by_number = 0; int chars_used_by_number = 0;
@ -1230,7 +1230,7 @@ index 26f221f..633f50e 100644
lines_per_body = lines_per_page - lines_per_header - lines_per_footer; lines_per_body = lines_per_page - lines_per_header - lines_per_footer;
if (lines_per_body <= 0) if (lines_per_body <= 0)
@@ -1227,7 +1351,7 @@ init_parameters (int number_of_files) @@ -1228,7 +1352,7 @@ init_parameters (int number_of_files)
else else
col_sep_string = column_separator; col_sep_string = column_separator;
@ -1239,7 +1239,7 @@ index 26f221f..633f50e 100644
use_col_separator = true; use_col_separator = true;
} }
/* It's rather pointless to define a TAB separator with column /* It's rather pointless to define a TAB separator with column
@@ -1257,11 +1381,11 @@ init_parameters (int number_of_files) @@ -1258,11 +1382,11 @@ init_parameters (int number_of_files)
+ TAB_WIDTH (chars_per_input_tab, chars_per_number); */ + TAB_WIDTH (chars_per_input_tab, chars_per_number); */
/* Estimate chars_per_text without any margin and keep it constant. */ /* Estimate chars_per_text without any margin and keep it constant. */
@ -1253,7 +1253,7 @@ index 26f221f..633f50e 100644
/* The number is part of the column width unless we are /* The number is part of the column width unless we are
printing files in parallel. */ printing files in parallel. */
@@ -1270,7 +1394,7 @@ init_parameters (int number_of_files) @@ -1271,7 +1395,7 @@ init_parameters (int number_of_files)
} }
int sep_chars, useful_chars; int sep_chars, useful_chars;
@ -1262,7 +1262,7 @@ index 26f221f..633f50e 100644
sep_chars = INT_MAX; sep_chars = INT_MAX;
if (INT_SUBTRACT_WRAPV (chars_per_line - chars_used_by_number, sep_chars, if (INT_SUBTRACT_WRAPV (chars_per_line - chars_used_by_number, sep_chars,
&useful_chars)) &useful_chars))
@@ -1293,7 +1417,7 @@ init_parameters (int number_of_files) @@ -1294,7 +1418,7 @@ init_parameters (int number_of_files)
We've to use 8 as the lower limit, if we use chars_per_default_tab = 8 We've to use 8 as the lower limit, if we use chars_per_default_tab = 8
to expand a tab which is not an input_tab-char. */ to expand a tab which is not an input_tab-char. */
free (clump_buff); free (clump_buff);
@ -1271,7 +1271,7 @@ index 26f221f..633f50e 100644
} }
/* Open the necessary files, /* Open the necessary files,
@@ -1399,7 +1523,7 @@ init_funcs (void) @@ -1400,7 +1524,7 @@ init_funcs (void)
/* Enlarge p->start_position of first column to use the same form of /* Enlarge p->start_position of first column to use the same form of
padding_not_printed with all columns. */ padding_not_printed with all columns. */
@ -1280,7 +1280,7 @@ index 26f221f..633f50e 100644
/* This loop takes care of all but the rightmost column. */ /* This loop takes care of all but the rightmost column. */
@@ -1433,7 +1557,7 @@ init_funcs (void) @@ -1434,7 +1558,7 @@ init_funcs (void)
} }
else else
{ {
@ -1289,7 +1289,7 @@ index 26f221f..633f50e 100644
h_next = h + chars_per_column; h_next = h + chars_per_column;
} }
} }
@@ -1724,9 +1848,9 @@ static void @@ -1725,9 +1849,9 @@ static void
align_column (COLUMN *p) align_column (COLUMN *p)
{ {
padding_not_printed = p->start_position; padding_not_printed = p->start_position;
@ -1301,7 +1301,7 @@ index 26f221f..633f50e 100644
padding_not_printed = ANYWHERE; padding_not_printed = ANYWHERE;
} }
@@ -2001,13 +2125,13 @@ store_char (char c) @@ -2002,13 +2126,13 @@ store_char (char c)
/* May be too generous. */ /* May be too generous. */
buff = X2REALLOC (buff, &buff_allocated); buff = X2REALLOC (buff, &buff_allocated);
} }
@ -1317,7 +1317,7 @@ index 26f221f..633f50e 100644
char *s; char *s;
int num_width; int num_width;
@@ -2024,22 +2148,24 @@ add_line_number (COLUMN *p) @@ -2025,22 +2149,24 @@ add_line_number (COLUMN *p)
/* Tabification is assumed for multiple columns, also for n-separators, /* Tabification is assumed for multiple columns, also for n-separators,
but 'default n-separator = TAB' hasn't been given priority over but 'default n-separator = TAB' hasn't been given priority over
equal column_width also specified by POSIX. */ equal column_width also specified by POSIX. */
@ -1346,7 +1346,7 @@ index 26f221f..633f50e 100644
output_position = POS_AFTER_TAB (chars_per_output_tab, output_position = POS_AFTER_TAB (chars_per_output_tab,
output_position); output_position);
} }
@@ -2198,7 +2324,7 @@ print_white_space (void) @@ -2199,7 +2325,7 @@ print_white_space (void)
while (goal - h_old > 1 while (goal - h_old > 1
&& (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal) && (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
{ {
@ -1355,7 +1355,7 @@ index 26f221f..633f50e 100644
h_old = h_new; h_old = h_new;
} }
while (++h_old <= goal) while (++h_old <= goal)
@@ -2218,6 +2344,7 @@ print_sep_string (void) @@ -2219,6 +2345,7 @@ print_sep_string (void)
{ {
char const *s = col_sep_string; char const *s = col_sep_string;
int l = col_sep_length; int l = col_sep_length;
@ -1363,7 +1363,7 @@ index 26f221f..633f50e 100644
if (separators_not_printed <= 0) if (separators_not_printed <= 0)
{ {
@@ -2229,6 +2356,7 @@ print_sep_string (void) @@ -2230,6 +2357,7 @@ print_sep_string (void)
{ {
for (; separators_not_printed > 0; --separators_not_printed) for (; separators_not_printed > 0; --separators_not_printed)
{ {
@ -1371,7 +1371,7 @@ index 26f221f..633f50e 100644
while (l-- > 0) while (l-- > 0)
{ {
/* 3 types of sep_strings: spaces only, spaces and chars, /* 3 types of sep_strings: spaces only, spaces and chars,
@@ -2242,12 +2370,15 @@ print_sep_string (void) @@ -2243,12 +2371,15 @@ print_sep_string (void)
} }
else else
{ {
@ -1388,7 +1388,7 @@ index 26f221f..633f50e 100644
/* sep_string ends with some spaces */ /* sep_string ends with some spaces */
if (spaces_not_printed > 0) if (spaces_not_printed > 0)
print_white_space (); print_white_space ();
@@ -2275,7 +2406,7 @@ print_clump (COLUMN *p, int n, char *clump) @@ -2276,7 +2407,7 @@ print_clump (COLUMN *p, int n, char *clump)
required number of tabs and spaces. */ required number of tabs and spaces. */
static void static void
@ -1397,7 +1397,7 @@ index 26f221f..633f50e 100644
{ {
if (tabify_output) if (tabify_output)
{ {
@@ -2299,6 +2430,74 @@ print_char (char c) @@ -2300,6 +2431,74 @@ print_char (char c)
putchar (c); putchar (c);
} }
@ -1472,7 +1472,7 @@ index 26f221f..633f50e 100644
/* Skip to page PAGE before printing. /* Skip to page PAGE before printing.
PAGE may be larger than total number of pages. */ PAGE may be larger than total number of pages. */
@@ -2476,9 +2675,9 @@ read_line (COLUMN *p) @@ -2477,9 +2676,9 @@ read_line (COLUMN *p)
align_empty_cols = false; align_empty_cols = false;
} }
@ -1484,7 +1484,7 @@ index 26f221f..633f50e 100644
padding_not_printed = ANYWHERE; padding_not_printed = ANYWHERE;
} }
@@ -2547,7 +2746,7 @@ print_stored (COLUMN *p) @@ -2548,7 +2747,7 @@ print_stored (COLUMN *p)
COLUMN *q; COLUMN *q;
int line = p->current_line++; int line = p->current_line++;
@ -1493,7 +1493,7 @@ index 26f221f..633f50e 100644
/* FIXME /* FIXME
UMR: Uninitialized memory read: UMR: Uninitialized memory read:
* This is occurring while in: * This is occurring while in:
@@ -2559,7 +2758,7 @@ print_stored (COLUMN *p) @@ -2560,7 +2759,7 @@ print_stored (COLUMN *p)
xmalloc [xmalloc.c:94] xmalloc [xmalloc.c:94]
init_store_cols [pr.c:1648] init_store_cols [pr.c:1648]
*/ */
@ -1502,7 +1502,7 @@ index 26f221f..633f50e 100644
pad_vertically = true; pad_vertically = true;
@@ -2579,9 +2778,9 @@ print_stored (COLUMN *p) @@ -2580,9 +2779,9 @@ print_stored (COLUMN *p)
} }
} }
@ -1514,7 +1514,7 @@ index 26f221f..633f50e 100644
padding_not_printed = ANYWHERE; padding_not_printed = ANYWHERE;
} }
@@ -2594,8 +2793,8 @@ print_stored (COLUMN *p) @@ -2595,8 +2794,8 @@ print_stored (COLUMN *p)
if (spaces_not_printed == 0) if (spaces_not_printed == 0)
{ {
output_position = p->start_position + end_vector[line]; output_position = p->start_position + end_vector[line];
@ -1525,7 +1525,7 @@ index 26f221f..633f50e 100644
} }
return true; return true;
@@ -2614,7 +2813,7 @@ print_stored (COLUMN *p) @@ -2615,7 +2814,7 @@ print_stored (COLUMN *p)
number of characters is 1.) */ number of characters is 1.) */
static int static int
@ -1534,7 +1534,7 @@ index 26f221f..633f50e 100644
{ {
unsigned char uc = c; unsigned char uc = c;
char *s = clump_buff; char *s = clump_buff;
@@ -2624,10 +2823,10 @@ char_to_clump (char c) @@ -2625,10 +2824,10 @@ char_to_clump (char c)
int chars; int chars;
int chars_per_c = 8; int chars_per_c = 8;
@ -1547,7 +1547,7 @@ index 26f221f..633f50e 100644
{ {
width = TAB_WIDTH (chars_per_c, input_position); width = TAB_WIDTH (chars_per_c, input_position);
@@ -2708,6 +2907,164 @@ char_to_clump (char c) @@ -2709,6 +2908,164 @@ char_to_clump (char c)
return chars; return chars;
} }
@ -1731,7 +1731,7 @@ index 6d2eec5..f189a0d 100644
#include "system.h" #include "system.h"
#include "argmatch.h" #include "argmatch.h"
#include "die.h" #include "die.h"
@@ -169,14 +177,39 @@ static int decimal_point; @@ -157,14 +165,39 @@ static int decimal_point;
/* Thousands separator; if -1, then there isn't one. */ /* Thousands separator; if -1, then there isn't one. */
static int thousands_sep; static int thousands_sep;
@ -1772,7 +1772,7 @@ index 6d2eec5..f189a0d 100644
/* The kind of blanks for '-b' to skip in various options. */ /* The kind of blanks for '-b' to skip in various options. */
enum blanktype { bl_start, bl_end, bl_both }; enum blanktype { bl_start, bl_end, bl_both };
@@ -350,13 +383,11 @@ static bool reverse; @@ -338,13 +371,11 @@ static bool reverse;
they were read if all keys compare equal. */ they were read if all keys compare equal. */
static bool stable; static bool stable;
@ -1789,7 +1789,7 @@ index 6d2eec5..f189a0d 100644
/* Flag to remove consecutive duplicate lines from the output. /* Flag to remove consecutive duplicate lines from the output.
Only the last of a sequence of equal lines will be output. */ Only the last of a sequence of equal lines will be output. */
@@ -814,6 +845,46 @@ reap_all (void) @@ -802,6 +833,46 @@ reap_all (void)
reap (-1); reap (-1);
} }
@ -1836,7 +1836,7 @@ index 6d2eec5..f189a0d 100644
/* Clean up any remaining temporary files. */ /* Clean up any remaining temporary files. */
static void static void
@@ -1264,7 +1335,7 @@ zaptemp (char const *name) @@ -1270,7 +1341,7 @@ zaptemp (char const *name)
free (node); free (node);
} }
@ -1845,7 +1845,7 @@ index 6d2eec5..f189a0d 100644
static int static int
struct_month_cmp (void const *m1, void const *m2) struct_month_cmp (void const *m1, void const *m2)
@@ -1279,7 +1350,7 @@ struct_month_cmp (void const *m1, void const *m2) @@ -1285,7 +1356,7 @@ struct_month_cmp (void const *m1, void const *m2)
/* Initialize the character class tables. */ /* Initialize the character class tables. */
static void static void
@ -1854,7 +1854,7 @@ index 6d2eec5..f189a0d 100644
{ {
size_t i; size_t i;
@@ -1291,7 +1362,7 @@ inittables (void) @@ -1297,7 +1368,7 @@ inittables (void)
fold_toupper[i] = toupper (i); fold_toupper[i] = toupper (i);
} }
@ -1863,7 +1863,7 @@ index 6d2eec5..f189a0d 100644
/* If we're not in the "C" locale, read different names for months. */ /* If we're not in the "C" locale, read different names for months. */
if (hard_LC_TIME) if (hard_LC_TIME)
{ {
@@ -1373,6 +1444,84 @@ specify_nmerge (int oi, char c, char const *s) @@ -1379,6 +1450,84 @@ specify_nmerge (int oi, char c, char const *s)
xstrtol_fatal (e, oi, c, long_options, s); xstrtol_fatal (e, oi, c, long_options, s);
} }
@ -1948,7 +1948,7 @@ index 6d2eec5..f189a0d 100644
/* Specify the amount of main memory to use when sorting. */ /* Specify the amount of main memory to use when sorting. */
static void static void
specify_sort_size (int oi, char c, char const *s) specify_sort_size (int oi, char c, char const *s)
@@ -1604,7 +1753,7 @@ buffer_linelim (struct buffer const *buf) @@ -1610,7 +1759,7 @@ buffer_linelim (struct buffer const *buf)
by KEY in LINE. */ by KEY in LINE. */
static char * static char *
@ -1957,7 +1957,7 @@ index 6d2eec5..f189a0d 100644
{ {
char *ptr = line->text, *lim = ptr + line->length - 1; char *ptr = line->text, *lim = ptr + line->length - 1;
size_t sword = key->sword; size_t sword = key->sword;
@@ -1613,10 +1762,10 @@ begfield (struct line const *line, struct keyfield const *key) @@ -1619,10 +1768,10 @@ begfield (struct line const *line, struct keyfield const *key)
/* The leading field separator itself is included in a field when -t /* The leading field separator itself is included in a field when -t
is absent. */ is absent. */
@ -1970,7 +1970,7 @@ index 6d2eec5..f189a0d 100644
++ptr; ++ptr;
if (ptr < lim) if (ptr < lim)
++ptr; ++ptr;
@@ -1642,11 +1791,70 @@ begfield (struct line const *line, struct keyfield const *key) @@ -1648,11 +1797,70 @@ begfield (struct line const *line, struct keyfield const *key)
return ptr; return ptr;
} }
@ -2042,7 +2042,7 @@ index 6d2eec5..f189a0d 100644
{ {
char *ptr = line->text, *lim = ptr + line->length - 1; char *ptr = line->text, *lim = ptr + line->length - 1;
size_t eword = key->eword, echar = key->echar; size_t eword = key->eword, echar = key->echar;
@@ -1661,10 +1869,10 @@ limfield (struct line const *line, struct keyfield const *key) @@ -1667,10 +1875,10 @@ limfield (struct line const *line, struct keyfield const *key)
'beginning' is the first character following the delimiting TAB. 'beginning' is the first character following the delimiting TAB.
Otherwise, leave PTR pointing at the first 'blank' character after Otherwise, leave PTR pointing at the first 'blank' character after
the preceding field. */ the preceding field. */
@ -2055,7 +2055,7 @@ index 6d2eec5..f189a0d 100644
++ptr; ++ptr;
if (ptr < lim && (eword || echar)) if (ptr < lim && (eword || echar))
++ptr; ++ptr;
@@ -1710,10 +1918,10 @@ limfield (struct line const *line, struct keyfield const *key) @@ -1716,10 +1924,10 @@ limfield (struct line const *line, struct keyfield const *key)
*/ */
/* Make LIM point to the end of (one byte past) the current field. */ /* Make LIM point to the end of (one byte past) the current field. */
@ -2068,7 +2068,7 @@ index 6d2eec5..f189a0d 100644
if (newlim) if (newlim)
lim = newlim; lim = newlim;
} }
@@ -1744,6 +1952,130 @@ limfield (struct line const *line, struct keyfield const *key) @@ -1750,6 +1958,130 @@ limfield (struct line const *line, struct keyfield const *key)
return ptr; return ptr;
} }
@ -2199,7 +2199,7 @@ index 6d2eec5..f189a0d 100644
/* Fill BUF reading from FP, moving buf->left bytes from the end /* Fill BUF reading from FP, moving buf->left bytes from the end
of buf->buf to the beginning first. If EOF is reached and the of buf->buf to the beginning first. If EOF is reached and the
file wasn't terminated by a newline, supply one. Set up BUF's line file wasn't terminated by a newline, supply one. Set up BUF's line
@@ -1830,8 +2162,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file) @@ -1836,8 +2168,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
else else
{ {
if (key->skipsblanks) if (key->skipsblanks)
@ -2224,7 +2224,7 @@ index 6d2eec5..f189a0d 100644
line->keybeg = line_start; line->keybeg = line_start;
} }
} }
@@ -1981,7 +2327,7 @@ human_numcompare (char const *a, char const *b) @@ -1987,7 +2333,7 @@ human_numcompare (char const *a, char const *b)
hideously fast. */ hideously fast. */
static int static int
@ -2233,7 +2233,7 @@ index 6d2eec5..f189a0d 100644
{ {
while (blanks[to_uchar (*a)]) while (blanks[to_uchar (*a)])
a++; a++;
@@ -1991,6 +2337,25 @@ numcompare (char const *a, char const *b) @@ -1997,6 +2343,25 @@ numcompare (char const *a, char const *b)
return strnumcmp (a, b, decimal_point, thousands_sep); return strnumcmp (a, b, decimal_point, thousands_sep);
} }
@ -2258,8 +2258,8 @@ index 6d2eec5..f189a0d 100644
+ +
/* Work around a problem whereby the long double value returned by glibc's /* Work around a problem whereby the long double value returned by glibc's
strtold ("NaN", ...) contains uninitialized bits: clear all bytes of strtold ("NaN", ...) contains uninitialized bits: clear all bytes of
A and B before calling strtold. FIXME: remove this function once A and B before calling strtold. FIXME: remove this function if
@@ -2041,7 +2406,7 @@ general_numcompare (char const *sa, char const *sb) @@ -2047,7 +2412,7 @@ general_numcompare (char const *sa, char const *sb)
Return 0 if the name in S is not recognized. */ Return 0 if the name in S is not recognized. */
static int static int
@ -2268,7 +2268,7 @@ index 6d2eec5..f189a0d 100644
{ {
size_t lo = 0; size_t lo = 0;
size_t hi = MONTHS_PER_YEAR; size_t hi = MONTHS_PER_YEAR;
@@ -2317,15 +2682,14 @@ debug_key (struct line const *line, struct keyfield const *key) @@ -2323,15 +2688,14 @@ debug_key (struct line const *line, struct keyfield const *key)
char saved = *lim; char saved = *lim;
*lim = '\0'; *lim = '\0';
@ -2286,7 +2286,7 @@ index 6d2eec5..f189a0d 100644
else if (key->general_numeric) else if (key->general_numeric)
ignore_value (strtold (beg, &tighter_lim)); ignore_value (strtold (beg, &tighter_lim));
else if (key->numeric || key->human_numeric) else if (key->numeric || key->human_numeric)
@@ -2459,7 +2823,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) @@ -2465,7 +2829,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
/* Warn about significant leading blanks. */ /* Warn about significant leading blanks. */
bool implicit_skip = key_numeric (key) || key->month; bool implicit_skip = key_numeric (key) || key->month;
bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */
@ -2295,7 +2295,7 @@ index 6d2eec5..f189a0d 100644
&& ((!key->skipsblanks && !implicit_skip) && ((!key->skipsblanks && !implicit_skip)
|| (!key->skipsblanks && key->schar) || (!key->skipsblanks && key->schar)
|| (!key->skipeblanks && key->echar))) || (!key->skipeblanks && key->echar)))
@@ -2517,11 +2881,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) @@ -2523,11 +2887,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
error (0, 0, _("option '-r' only applies to last-resort comparison")); error (0, 0, _("option '-r' only applies to last-resort comparison"));
} }
@ -2384,7 +2384,7 @@ index 6d2eec5..f189a0d 100644
{ {
struct keyfield *key = keylist; struct keyfield *key = keylist;
@@ -2606,7 +3046,7 @@ keycompare (struct line const *a, struct line const *b) @@ -2612,7 +3052,7 @@ keycompare (struct line const *a, struct line const *b)
else if (key->human_numeric) else if (key->human_numeric)
diff = human_numcompare (ta, tb); diff = human_numcompare (ta, tb);
else if (key->month) else if (key->month)
@ -2393,7 +2393,7 @@ index 6d2eec5..f189a0d 100644
else if (key->random) else if (key->random)
diff = compare_random (ta, tlena, tb, tlenb); diff = compare_random (ta, tlena, tb, tlenb);
else if (key->version) else if (key->version)
@@ -2722,6 +3162,211 @@ keycompare (struct line const *a, struct line const *b) @@ -2728,6 +3168,211 @@ keycompare (struct line const *a, struct line const *b)
return key->reverse ? -diff : diff; return key->reverse ? -diff : diff;
} }
@ -2605,7 +2605,7 @@ index 6d2eec5..f189a0d 100644
/* Compare two lines A and B, returning negative, zero, or positive /* Compare two lines A and B, returning negative, zero, or positive
depending on whether A compares less than, equal to, or greater than B. */ depending on whether A compares less than, equal to, or greater than B. */
@@ -2749,7 +3394,7 @@ compare (struct line const *a, struct line const *b) @@ -2755,7 +3400,7 @@ compare (struct line const *a, struct line const *b)
diff = - NONZERO (blen); diff = - NONZERO (blen);
else if (blen == 0) else if (blen == 0)
diff = 1; diff = 1;
@ -2614,7 +2614,7 @@ index 6d2eec5..f189a0d 100644
{ {
/* xmemcoll0 is a performance enhancement as /* xmemcoll0 is a performance enhancement as
it will not unconditionally write '\0' after the it will not unconditionally write '\0' after the
@@ -4144,6 +4789,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype) @@ -4145,6 +4790,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
break; break;
case 'f': case 'f':
key->translate = fold_toupper; key->translate = fold_toupper;
@ -2622,7 +2622,7 @@ index 6d2eec5..f189a0d 100644
break; break;
case 'g': case 'g':
key->general_numeric = true; key->general_numeric = true;
@@ -4223,7 +4869,7 @@ main (int argc, char **argv) @@ -4224,7 +4870,7 @@ main (int argc, char **argv)
initialize_exit_failure (SORT_FAILURE); initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE); hard_LC_COLLATE = hard_locale (LC_COLLATE);
@ -2631,7 +2631,7 @@ index 6d2eec5..f189a0d 100644
hard_LC_TIME = hard_locale (LC_TIME); hard_LC_TIME = hard_locale (LC_TIME);
#endif #endif
@@ -4244,6 +4890,29 @@ main (int argc, char **argv) @@ -4245,6 +4891,29 @@ main (int argc, char **argv)
thousands_sep = -1; thousands_sep = -1;
} }
@ -2661,7 +2661,7 @@ index 6d2eec5..f189a0d 100644
have_read_stdin = false; have_read_stdin = false;
inittables (); inittables ();
@@ -4518,13 +5187,34 @@ main (int argc, char **argv) @@ -4519,13 +5188,34 @@ main (int argc, char **argv)
case 't': case 't':
{ {
@ -2700,7 +2700,7 @@ index 6d2eec5..f189a0d 100644
else else
{ {
/* Provoke with 'sort -txx'. Complain about /* Provoke with 'sort -txx'. Complain about
@@ -4535,9 +5225,11 @@ main (int argc, char **argv) @@ -4536,9 +5226,11 @@ main (int argc, char **argv)
quote (optarg)); quote (optarg));
} }
} }
@ -2714,7 +2714,7 @@ index 6d2eec5..f189a0d 100644
} }
break; break;
@@ -4765,12 +5457,10 @@ main (int argc, char **argv) @@ -4767,12 +5459,10 @@ main (int argc, char **argv)
sort (files, nfiles, outfile, nthreads); sort (files, nfiles, outfile, nthreads);
} }
@ -2749,12 +2749,8 @@ index 87a0c93..9f755d9 100644
#include "system.h" #include "system.h"
#include "argmatch.h" #include "argmatch.h"
#include "linebuffer.h" #include "linebuffer.h"
@@ -32,9 +43,21 @@ @@ -33,6 +44,18 @@
#include "stdio--.h" #include "memcasecmp.h"
#include "xmemcoll.h"
#include "xstrtol.h"
-#include "memcasecmp.h"
+#include "xmemcoll.h"
#include "quote.h" #include "quote.h"
+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC +/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
@ -2772,7 +2768,7 @@ index 87a0c93..9f755d9 100644
/* The official name of this program (e.g., no 'g' prefix). */ /* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "uniq" #define PROGRAM_NAME "uniq"
@@ -144,6 +167,10 @@ enum @@ -139,6 +162,10 @@ enum
GROUP_OPTION = CHAR_MAX + 1 GROUP_OPTION = CHAR_MAX + 1
}; };
@ -2783,7 +2779,7 @@ index 87a0c93..9f755d9 100644
static struct option const longopts[] = static struct option const longopts[] =
{ {
{"count", no_argument, NULL, 'c'}, {"count", no_argument, NULL, 'c'},
@@ -260,7 +287,7 @@ size_opt (char const *opt, char const *msgid) @@ -253,7 +280,7 @@ size_opt (char const *opt, char const *msgid)
return a pointer to the beginning of the line's field to be compared. */ return a pointer to the beginning of the line's field to be compared. */
static char * _GL_ATTRIBUTE_PURE static char * _GL_ATTRIBUTE_PURE
@ -2792,7 +2788,7 @@ index 87a0c93..9f755d9 100644
{ {
size_t count; size_t count;
char const *lp = line->buffer; char const *lp = line->buffer;
@@ -280,6 +307,83 @@ find_field (struct linebuffer const *line) @@ -273,6 +300,83 @@ find_field (struct linebuffer const *line)
return line->buffer + i; return line->buffer + i;
} }
@ -2876,228 +2872,7 @@ index 87a0c93..9f755d9 100644
/* Return false if two strings OLD and NEW match, true if not. /* Return false if two strings OLD and NEW match, true if not.
OLD and NEW point not to the beginnings of the lines OLD and NEW point not to the beginnings of the lines
but rather to the beginnings of the fields to compare. but rather to the beginnings of the fields to compare.
@@ -288,6 +392,8 @@ find_field (struct linebuffer const *line) @@ -493,6 +597,19 @@ main (int argc, char **argv)
static bool
different (char *old, char *new, size_t oldlen, size_t newlen)
{
+ char *copy_old, *copy_new;
+
if (check_chars < oldlen)
oldlen = check_chars;
if (check_chars < newlen)
@@ -295,15 +401,104 @@ different (char *old, char *new, size_t oldlen, size_t newlen)
if (ignore_case)
{
- /* FIXME: This should invoke strcoll somehow. */
- return oldlen != newlen || memcasecmp (old, new, oldlen);
+ size_t i;
+
+ copy_old = xmalloc (oldlen + 1);
+ copy_new = xmalloc (oldlen + 1);
+
+ for (i = 0; i < oldlen; i++)
+ {
+ copy_old[i] = toupper (old[i]);
+ copy_new[i] = toupper (new[i]);
+ }
+ bool rc = xmemcoll (copy_old, oldlen, copy_new, newlen);
+ free (copy_old);
+ free (copy_new);
+ return rc;
}
- else if (hard_LC_COLLATE)
- return xmemcoll (old, oldlen, new, newlen) != 0;
else
- return oldlen != newlen || memcmp (old, new, oldlen);
+ {
+ copy_old = (char *)old;
+ copy_new = (char *)new;
+ }
+
+ return xmemcoll (copy_old, oldlen, copy_new, newlen);
+
}
+#if HAVE_MBRTOWC
+static int
+different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate)
+{
+ size_t i, j, chars;
+ const char *str[2];
+ char *copy[2];
+ size_t len[2];
+ mbstate_t state[2];
+ size_t mblength;
+ wchar_t wc, uwc;
+ mbstate_t state_bak;
+
+ str[0] = old;
+ str[1] = new;
+ len[0] = oldlen;
+ len[1] = newlen;
+ state[0] = oldstate;
+ state[1] = newstate;
+
+ for (i = 0; i < 2; i++)
+ {
+ copy[i] = xmalloc (len[i] + 1);
+ memset (copy[i], '\0', len[i] + 1);
+
+ for (j = 0, chars = 0; j < len[i] && chars < check_chars; chars++)
+ {
+ state_bak = state[i];
+ mblength = mbrtowc (&wc, str[i] + j, len[i] - j, &(state[i]));
+
+ switch (mblength)
+ {
+ case (size_t)-1:
+ case (size_t)-2:
+ state[i] = state_bak;
+ /* Fall through */
+ case 0:
+ mblength = 1;
+ break;
+
+ default:
+ if (ignore_case)
+ {
+ uwc = towupper (wc);
+
+ if (uwc != wc)
+ {
+ mbstate_t state_wc;
+ size_t mblen;
+
+ memset (&state_wc, '\0', sizeof(mbstate_t));
+ mblen = wcrtomb (copy[i] + j, uwc, &state_wc);
+ assert (mblen != (size_t)-1);
+ }
+ else
+ memcpy (copy[i] + j, str[i] + j, mblength);
+ }
+ else
+ memcpy (copy[i] + j, str[i] + j, mblength);
+ }
+ j += mblength;
+ }
+ copy[i][j] = '\0';
+ len[i] = j;
+ }
+ int rc = xmemcoll (copy[0], len[0], copy[1], len[1]);
+ free (copy[0]);
+ free (copy[1]);
+ return rc;
+
+}
+#endif
+
/* Output the line in linebuffer LINE to standard output
provided that the switches say it should be output.
MATCH is true if the line matches the previous line.
@@ -367,19 +562,38 @@ check_file (const char *infile, const char *outfile, char delimiter)
char *prevfield IF_LINT ( = NULL);
size_t prevlen IF_LINT ( = 0);
bool first_group_printed = false;
+#if HAVE_MBRTOWC
+ mbstate_t prevstate;
+
+ memset (&prevstate, '\0', sizeof (mbstate_t));
+#endif
while (!feof (stdin))
{
char *thisfield;
size_t thislen;
bool new_group;
+#if HAVE_MBRTOWC
+ mbstate_t thisstate;
+#endif
if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
break;
thisfield = find_field (thisline);
thislen = thisline->length - 1 - (thisfield - thisline->buffer);
+#if HAVE_MBRTOWC
+ if (MB_CUR_MAX > 1)
+ {
+ thisstate = thisline->state;
+ new_group = (prevline->length == 0
+ || different_multi (thisfield, prevfield,
+ thislen, prevlen,
+ thisstate, prevstate));
+ }
+ else
+#endif
new_group = (prevline->length == 0
|| different (thisfield, prevfield, thislen, prevlen));
@@ -397,6 +611,10 @@ check_file (const char *infile, const char *outfile, char delimiter)
SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
+#if HAVE_MBRTOWC
+ if (MB_CUR_MAX > 1)
+ prevstate = thisstate;
+#endif
first_group_printed = true;
}
}
@@ -409,17 +627,26 @@ check_file (const char *infile, const char *outfile, char delimiter)
size_t prevlen;
uintmax_t match_count = 0;
bool first_delimiter = true;
+#if HAVE_MBRTOWC
+ mbstate_t prevstate;
+#endif
if (readlinebuffer_delim (prevline, stdin, delimiter) == 0)
goto closefiles;
prevfield = find_field (prevline);
prevlen = prevline->length - 1 - (prevfield - prevline->buffer);
+#if HAVE_MBRTOWC
+ prevstate = prevline->state;
+#endif
while (!feof (stdin))
{
bool match;
char *thisfield;
size_t thislen;
+#if HAVE_MBRTOWC
+ mbstate_t thisstate = thisline->state;
+#endif
if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
{
if (ferror (stdin))
@@ -428,6 +655,14 @@ check_file (const char *infile, const char *outfile, char delimiter)
}
thisfield = find_field (thisline);
thislen = thisline->length - 1 - (thisfield - thisline->buffer);
+#if HAVE_MBRTOWC
+ if (MB_CUR_MAX > 1)
+ {
+ match = !different_multi (thisfield, prevfield,
+ thislen, prevlen, thisstate, prevstate);
+ }
+ else
+#endif
match = !different (thisfield, prevfield, thislen, prevlen);
match_count += match;
@@ -460,6 +695,9 @@ check_file (const char *infile, const char *outfile, char delimiter)
SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
+#if HAVE_MBRTOWC
+ prevstate = thisstate;
+#endif
if (!match)
match_count = 0;
}
@@ -506,6 +744,19 @@ main (int argc, char **argv)
atexit (close_stdout); atexit (close_stdout);
@ -3156,7 +2931,7 @@ diff --git a/tests/local.mk b/tests/local.mk
index 568944e..192f776 100644 index 568944e..192f776 100644
--- a/tests/local.mk --- a/tests/local.mk
+++ b/tests/local.mk +++ b/tests/local.mk
@@ -362,6 +362,8 @@ all_tests = \ @@ -369,6 +369,8 @@ all_tests = \
tests/misc/sort-discrim.sh \ tests/misc/sort-discrim.sh \
tests/misc/sort-files0-from.pl \ tests/misc/sort-files0-from.pl \
tests/misc/sort-float.sh \ tests/misc/sort-float.sh \
@ -3325,7 +3100,7 @@ index 4d399d8..07f2823 100755
my $delim = chr 0247; my $delim = chr 0247;
sub t_subst ($) sub t_subst ($)
{ {
@@ -329,8 +338,49 @@ foreach my $t (@tv) @@ -333,8 +342,49 @@ foreach my $t (@tv)
push @Tests, $new_ent; push @Tests, $new_ent;
} }

View File

@ -50,7 +50,7 @@ index be244c6..4c65dff 100644
+++ b/lib/acl-internal.c +++ b/lib/acl-internal.c
@@ -25,6 +25,9 @@ @@ -25,6 +25,9 @@
#if USE_ACL && HAVE_ACL_GET_FILE #if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
+# include <string.h> +# include <string.h>
+# include <arpa/inet.h> +# include <arpa/inet.h>
@ -161,12 +161,12 @@ index be244c6..4c65dff 100644
+ +
# endif # endif
#elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */ #elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin < 2.5, not HP-UX */
diff --git a/lib/acl-internal.h b/lib/acl-internal.h diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index 9353376..2a249ff 100644 index 9353376..2a249ff 100644
--- a/lib/acl-internal.h --- a/lib/acl-internal.h
+++ b/lib/acl-internal.h +++ b/lib/acl-internal.h
@@ -143,6 +143,9 @@ rpl_acl_set_fd (int fd, acl_t acl) @@ -147,6 +147,9 @@ rpl_acl_set_fd (int fd, acl_t acl)
# define acl_entries rpl_acl_entries # define acl_entries rpl_acl_entries
extern int acl_entries (acl_t); extern int acl_entries (acl_t);
# endif # endif
@ -288,7 +288,7 @@ index 4c65dff..be244c6 100644
+++ b/lib/acl-internal.c +++ b/lib/acl-internal.c
@@ -25,9 +25,6 @@ @@ -25,9 +25,6 @@
#if USE_ACL && HAVE_ACL_GET_FILE #if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
-# include <string.h> -# include <string.h>
-# include <arpa/inet.h> -# include <arpa/inet.h>
@ -399,12 +399,12 @@ index 4c65dff..be244c6 100644
- -
# endif # endif
#elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */ #elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin < 2.5, not HP-UX */
diff --git a/lib/acl-internal.h b/lib/acl-internal.h diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index 2a249ff..9353376 100644 index 2a249ff..9353376 100644
--- a/lib/acl-internal.h --- a/lib/acl-internal.h
+++ b/lib/acl-internal.h +++ b/lib/acl-internal.h
@@ -143,9 +143,6 @@ rpl_acl_set_fd (int fd, acl_t acl) @@ -147,9 +147,6 @@ rpl_acl_set_fd (int fd, acl_t acl)
# define acl_entries rpl_acl_entries # define acl_entries rpl_acl_entries
extern int acl_entries (acl_t); extern int acl_entries (acl_t);
# endif # endif

View File

@ -1,37 +1,9 @@
Provides: /bin/basename
Provides: /bin/cat
Provides: /bin/chgrp
Provides: /bin/chmod
Provides: /bin/chown
Provides: /bin/cp
Provides: /bin/cut
Provides: /bin/date
Provides: /bin/dd
Provides: /bin/df
Provides: /bin/echo
Provides: /bin/env
Provides: /bin/false
Provides: /bin/ln
Provides: /bin/ls
Provides: /bin/mkdir
Provides: /bin/mknod
Provides: /bin/mktemp
Provides: /bin/mv
Provides: /bin/nice
Provides: /bin/pwd
Provides: /bin/readlink
Provides: /bin/rm
Provides: /bin/rmdir
Provides: /bin/sleep
Provides: /bin/sort
Provides: /bin/stty
Provides: /bin/sync
Provides: /bin/touch
Provides: /bin/true
Provides: /bin/uname
Provides: bundled(gnulib) Provides: bundled(gnulib)
Provides: fileutils = %{version}-%{release}
Provides: mktemp = 4:%{version}-%{release} # make it possible to install the latest available Adobe Reader RPM for Linux
Provides: sh-utils = %{version}-%{release} Provides: /bin/cat
Provides: stat = %{version}-%{release} Provides: /bin/chmod
Provides: textutils = %{version}-%{release} Provides: /bin/echo
Provides: /bin/ln
Provides: /bin/rm
Provides: /bin/touch

View File

@ -1,6 +1,7 @@
%{_bindir}/arch %{_bindir}/arch
%{_bindir}/b2sum %{_bindir}/b2sum
%{_bindir}/basename %{_bindir}/basename
%{_bindir}/basenc
%{_bindir}/cat %{_bindir}/cat
%{_bindir}/chgrp %{_bindir}/chgrp
%{_bindir}/chmod %{_bindir}/chmod

View File

@ -1,9 +1,8 @@
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.30 Version: 8.32
Release: 15%{?dist} Release: 36%{?dist}
License: GPLv3+ License: GPLv3+
Group: System Environment/Base
Url: https://www.gnu.org/software/coreutils/ Url: https://www.gnu.org/software/coreutils/
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
Source50: supported_utils Source50: supported_utils
@ -14,54 +13,66 @@ Source106: coreutils-colorls.csh
# do not make coreutils-single depend on /usr/bin/coreutils # do not make coreutils-single depend on /usr/bin/coreutils
%global __requires_exclude ^%{_bindir}/coreutils$ %global __requires_exclude ^%{_bindir}/coreutils$
# rename gnulib's renameat2 to renameatu to avoid clash with glibc (#1598518) # ls: restore 8.31 behavior on removed directories
Patch1: coreutils-8.30-renameatu.patch Patch1: coreutils-8.32-ls-removed-dir.patch
# fix heap-based buffer overflow in vasnprintf() (CVE-2018-17942) # du: simplify leaf optimization for XFS (#1823247)
Patch2: coreutils-8.30-CVE-2018-17942.patch Patch2: coreutils-8.32-leaf-opt-xfs.patch
# sync: fix open() fallback bug (#1602463) # cp: default to --reflink=auto (#1861108)
Patch3: coreutils-8.30-fsync-fallback.patch Patch3: coreutils-8.32-cp-reflink-auto.patch
# cp --preserve=xattr: preserve NFSv4 ACL extended attributes (#1646985) # eliminate unportable gnulib tests
Patch4: coreutils-8.30-cp-preserve-xattr-NFSv4-ACL.patch Patch4: coreutils-8.32-gnulib-perror-test.patch
# chcon: do not validate security context if SELinux is disabled (#1777831) # df,stat,tail: recognize more file system types
Patch5: coreutils-8.30-chcon-invalid-context.patch Patch5: coreutils-8.32-new-fs-types.patch
# md5sum,b2sum,sha*sum: --help: add note about binary/text mode
Patch6: coreutils-8.31-sums-man-pages.patch
# df --local: recognize afs, auristorfs, and smb3 as remote fs (#1798030)
Patch7: coreutils-8.30-df-local-fs.patch
# use statx instead of stat when available (#1760300)
Patch8: coreutils-8.30-statx.patch
# rm: do not skip files upon failure to remove an empty dir (#1905481) # rm: do not skip files upon failure to remove an empty dir (#1905481)
Patch9: coreutils-8.32-rm-stray-skip.patch Patch6: coreutils-8.32-rm-stray-skip.patch
# expr: fix invalid read with unmatched \(...\) (#1919775)
Patch7: coreutils-8.32-expr-unmatched-par.patch
# split: fix --number=K/N to output correct part of file (#1921246) # split: fix --number=K/N to output correct part of file (#1921246)
Patch10: coreutils-8.32-split-number.patch Patch8: coreutils-8.32-split-number.patch
# mountlist: recognize fuse.portal as dummy file system (#1952714) # ls: fix crash printing SELinux context for unstatable files (#1921249)
Patch11: coreutils-8.32-fuse-portal.patch Patch9: coreutils-8.32-ls-scontext-crash.patch
# tail: fix stack out-of-bounds write with --follow (#1974784) # stat: add support for the exfat file system (#1921427)
Patch12: coreutils-8.30-tail-use-poll.patch Patch10: coreutils-8.32-stat-exfat.patch
# doc: improve description of the --kibibytes option of ls (#1527391) # cp: use copy_file_range if available
Patch13: coreutils-8.22-doc-ls-kibibytes.patch Patch11: coreutils-8.32-cp-file-range.patch
# df: fix duplicated remote entries due to bind mounts (#1962515) # hostname,ln: fix memory leaks detected by Coverity
Patch12: coreutils-8.32-mem-leaks.patch
# utimens: fix confusing arg type in internal func
Patch13: coreutils-8.32-coverity-utimens.patch
# fix false positives in the upstrem test-suite (#1960792)
Patch14: coreutils-8.32-tests-false-positives.patch
# mountlist: recognize fuse.portal as dummy file system (#1913358)
Patch15: coreutils-8.32-fuse-portal.patch
# tail: fix stack out-of-bounds write with --follow
Patch16: coreutils-8.32-tail-use-poll.patch
# df: fix duplicated remote entries due to bind mounts (#1979814)
Patch17: coreutils-8.32-df-duplicated-entries.patch Patch17: coreutils-8.32-df-duplicated-entries.patch
# ls, stat: avoid triggering automounts (#2044981) # ls, stat: avoid triggering automounts (#2044981)
Patch18: coreutils-9.0-autofs-no-mount.patch Patch18: coreutils-9.0-autofs-no-mount.patch
# basic support for checking NFSv4 ACLs (#2158747) # basic support for checking NFSv4 ACLs (#2137866)
Patch19: coreutils-nfsv4-acls.patch Patch19: coreutils-nfsv4-acls.patch
# fix tail on kernels with 64k pagesize
Patch20: coreutils-8.32-tail-64kpages.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
@ -69,7 +80,7 @@ Patch100: coreutils-8.26-test-lock.patch
Patch101: coreutils-8.26-selinuxenable.patch Patch101: coreutils-8.26-selinuxenable.patch
# downstream changes to default DIR_COLORS # downstream changes to default DIR_COLORS
Patch102: coreutils-8.25-DIR_COLORS.patch Patch102: coreutils-8.32-DIR_COLORS.patch
#do display processor type for uname -p/-i based on uname(2) syscall #do display processor type for uname -p/-i based on uname(2) syscall
Patch103: coreutils-8.2-uname-processortype.patch Patch103: coreutils-8.2-uname-processortype.patch
#df --direct #df --direct
@ -120,17 +131,22 @@ BuildRequires: libattr-devel
BuildRequires: libcap-devel BuildRequires: libcap-devel
BuildRequires: libselinux-devel BuildRequires: libselinux-devel
BuildRequires: libselinux-utils BuildRequires: libselinux-utils
BuildRequires: make
BuildRequires: openssl-devel BuildRequires: openssl-devel
BuildRequires: strace BuildRequires: strace
BuildRequires: texinfo BuildRequires: texinfo
# test-only dependencies
BuildRequires: perl-interpreter
BuildRequires: perl(FileHandle)
%if 23 < 0%{?fedora} || 7 < 0%{?rhel} %if 23 < 0%{?fedora} || 7 < 0%{?rhel}
# needed by i18n test-cases # needed by i18n test-cases
BuildRequires: glibc-langpack-en BuildRequires: glibc-langpack-en
BuildRequires: glibc-langpack-fr
BuildRequires: glibc-langpack-ko
%endif %endif
Requires: %{name}-common = %{version}-%{release} Requires: %{name}-common = %{version}-%{release}
Requires: ncurses
Provides: coreutils-full = %{version}-%{release} Provides: coreutils-full = %{version}-%{release}
%include %{SOURCE51} %include %{SOURCE51}
@ -161,8 +177,10 @@ packaged as a single multicall binary.
# yum obsoleting rules explained at: # yum obsoleting rules explained at:
# https://bugzilla.redhat.com/show_bug.cgi?id=1107973#c7 # https://bugzilla.redhat.com/show_bug.cgi?id=1107973#c7
Obsoletes: %{name} < 8.24-100 Obsoletes: %{name} < 8.24-100
Requires(preun): /sbin/install-info
Requires(post): /sbin/install-info # info doc refers to "Specifying the Time Zone" from glibc-doc (#959597)
Suggests: glibc-doc
Summary: coreutils common optional components Summary: coreutils common optional components
%description common %description common
Optional though recommended components, Optional though recommended components,
@ -171,9 +189,19 @@ including documentation and translations.
%prep %prep
%autosetup -N %autosetup -N
# will be modified by coreutils-8.25-DIR_COLORS.patch # will be regenerated in the build directories
tee DIR_COLORS{,.256color,.lightbgcolor} <src/dircolors.hin >/dev/null rm -f src/fs.h
# git add DIR_COLORS{,.256color,.lightbgcolor}
# will be further modified by coreutils-8.32-DIR_COLORS.patch
sed src/dircolors.hin \
-e 's| 00;36$| 01;36|' \
> DIR_COLORS
sed src/dircolors.hin \
-e 's| 01;31$| 00;31|' \
-e 's| 01;35$| 00;35|' \
> DIR_COLORS.lightbgcolor
# git add DIR_COLORS{,.lightbgcolor}
# git commit -m "clone DIR_COLORS before patching" # git commit -m "clone DIR_COLORS before patching"
# apply all patches # apply all patches
@ -187,10 +215,24 @@ autoreconf -fiv
%build %build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fpic" export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fpic"
# 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:
# https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00130.html
# There is currently no measurable performance drop or other known downside.
CFLAGS="$CFLAGS -Dlint"
# make mknod work again in chroot without /proc being mounted (#1811038)
export ac_cv_func_lchmod="no"
# needed for out-of-tree build
%global _configure ../configure
%{expand:%%global optflags %{optflags} -D_GNU_SOURCE=1} %{expand:%%global optflags %{optflags} -D_GNU_SOURCE=1}
for type in separate single; do for type in separate single; do
mkdir $type && \ mkdir -p $type && \
(cd $type && ln -s ../configure || exit 1 (cd $type || exit $?
if test $type = 'single'; then if test $type = 'single'; then
config_single='--enable-single-binary' config_single='--enable-single-binary'
config_single="$config_single --without-openssl" # smaller/slower sha*sum config_single="$config_single --without-openssl" # smaller/slower sha*sum
@ -204,10 +246,10 @@ 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_build all V=1
# make sure that parse-datetime.{c,y} ends up in debuginfo (#1555079) # make sure that parse-datetime.{c,y} ends up in debuginfo (#1555079)
ln -v ../lib/parse-datetime.{c,y} . ln -fv ../lib/parse-datetime.{c,y} .
) )
done done
@ -245,8 +287,7 @@ for type in separate single; do
done done
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
install -p -c -m644 DIR_COLORS{,.256color,.lightbgcolor} \ install -p -c -m644 DIR_COLORS{,.lightbgcolor} $RPM_BUILD_ROOT%{_sysconfdir}
$RPM_BUILD_ROOT%{_sysconfdir}
install -p -c -m644 %SOURCE105 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.sh install -p -c -m644 %SOURCE105 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.sh
install -p -c -m644 %SOURCE106 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.csh install -p -c -m644 %SOURCE106 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.csh
@ -257,18 +298,6 @@ grep LC_TIME %name.lang | cut -d'/' -f1-6 | sed -e 's/) /) %%dir /g' >>%name.lan
# (sb) Deal with Installed (but unpackaged) file(s) found # (sb) Deal with Installed (but unpackaged) file(s) found
rm -f $RPM_BUILD_ROOT%{_infodir}/dir rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%preun common
if [ $1 = 0 ]; then
if [ -f %{_infodir}/%{name}.info.gz ]; then
/sbin/install-info --delete %{_infodir}/%{name}.info.gz %{_infodir}/dir || :
fi
fi
%post common
if [ -f %{_infodir}/%{name}.info.gz ]; then
/sbin/install-info %{_infodir}/%{name}.info.gz %{_infodir}/dir || :
fi
%files -f supported_utils %files -f supported_utils
%exclude %{_bindir}/*.single %exclude %{_bindir}/*.single
%dir %{_libexecdir}/coreutils %dir %{_libexecdir}/coreutils
@ -293,48 +322,173 @@ fi
%license COPYING %license COPYING
%changelog %changelog
* Mon Jan 02 2023 Kamil Dudka <kdudka@redhat.com> - 8.30-15 * Fri Aug 16 2024 Lukáš Zaoral <lzaoral@redhat.com> - 8.32-36
- basic support for checking NFSv4 ACLs (#2158747) - fix fold exit code for non-existent files (RHEL-54568)
- enable LTO on ppc64le
* Mon Aug 01 2022 Kamil Dudka <kdudka@redhat.com> - 8.30-14 * Mon Jan 29 2024 Lukáš Zaoral <lzaoral@redhat.com> - 8.32-35
- fix tail on kernels with 64k page sizes (RHEL-22866)
* Mon Jan 02 2023 Kamil Dudka <kdudka@redhat.com> - 8.32-34
- basic support for checking NFSv4 ACLs (#2137866)
* Mon Aug 01 2022 Kamil Dudka <kdudka@redhat.com> - 8.32-33
- prevent unexpand from failing on control characters (#2112870) - prevent unexpand from failing on control characters (#2112870)
* Tue Mar 01 2022 Kamil Dudka <kdudka@redhat.com> - 8.30-13 * Tue Mar 01 2022 Kamil Dudka <kdudka@redhat.com> - 8.32-32
- ls, stat: avoid triggering automounts (#2044981) - ls, stat: avoid triggering automounts (#2044981)
- make `df --direct` work again (#2058686) - make `df --direct` work again (#2058686)
- doc: improve description of the --kibibytes option of ls (#1527391)
* Wed Jul 07 2021 Kamil Dudka <kdudka@redhat.com> - 8.30-12 * Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com>
- df: fix duplicated remote entries due to bind mounts (#1962515) - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu Jul 01 2021 Kamil Dudka <kdudka@redhat.com> - 8.30-11 * Wed Jul 07 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-30
- tail: fix stack out-of-bounds write with --follow (#1974784) - df: fix duplicated remote entries due to bind mounts (#1979814)
* Tue Jun 08 2021 Kamil Dudka <kdudka@redhat.com> - 8.30-10 * Thu Jul 01 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-29
- mountlist: recognize fuse.portal as dummy file system (#1952714) - tail: fix stack out-of-bounds write with --follow (#1976935)
* Fri Mar 26 2021 Kamil Dudka <kdudka@redhat.com> - 8.30-9 * Tue Jun 15 2021 Mohan Boddu <mboddu@redhat.com> - 8.32-28
- Rebuilt for RHEL 9 BETA for openssl 3.0 (#1971065)
* Tue Jun 08 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-27
- mountlist: recognize fuse.portal as dummy file system (#1913358)
* Mon May 17 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-26
- cp: pick additional copy_file_range()-related fixes from upstream
* Mon May 03 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-25
- copy: ensure we enforce --reflink=never
* Tue Apr 27 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-24
- copy: do not refuse to copy a swap file (#1953669)
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com>
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Fri Apr 09 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-22
- weaken the dependency on glibc-doc to reduce minimal installations
- drop the last use of ncurses no longer needed (#1830318)
- utimens: fix confusing arg type in internal func
* Fri Mar 26 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-21
- hostname,ln: fix memory leaks detected by Coverity
* Wed Mar 24 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-20
- cp: use copy_file_range if available
* Thu Feb 18 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-19
- stat: add support for the exfat file system (#1921427)
* Wed Feb 03 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-18
- make coreutils-common recommend glibc-doc for info doc refs (#959597)
* Tue Feb 02 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-17
- ls: fix crash printing SELinux context for unstatable files (#1921249)
- split: fix --number=K/N to output correct part of file (#1921246) - split: fix --number=K/N to output correct part of file (#1921246)
- expr: fix invalid read with unmatched \(...\) (#1919775)
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Dec 08 2020 Kamil Dudka <kdudka@redhat.com> - 8.32-15
- rm: do not skip files upon failure to remove an empty dir (#1905481) - rm: do not skip files upon failure to remove an empty dir (#1905481)
* Tue Nov 03 2020 Kamil Dudka <kdudka@redhat.com> - 8.32-14
- df,stat,tail: recognize more file system types
* Wed Oct 14 2020 Kamil Dudka <kdudka@redhat.com> - 8.32-13
- make the %%build section idempotent
* Mon Aug 17 2020 Kamil Dudka <kdudka@redhat.com> - 8.32-12
- do not install /etc/DIR_COLORS.256color (#1830318)
* Thu Jul 30 2020 Kamil Dudka <kdudka@redhat.com> - 8.32-11
- cp: default to --reflink=auto (#1861108)
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jul 24 2020 Kamil Dudka <kdudka@redhat.com> - 8.32-9
- disable -flto on ppc64le to make test-float pass (#1789115)
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 8.32-8
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Fri Jun 26 2020 James Cassell <cyberpear@fedoraproject.org> - 8.32-7
- move ncurses to -common package since it's needed for colorls.sh
- make ncurses optional
* Fri May 15 2020 Kamil Dudka <kdudka@redhat.com> - 8.32-6
- compile with -Dlint to enable optional initialization and cleanup code
* Thu Apr 23 2020 Kamil Dudka <kdudka@redhat.com> - 8.32-5
- du: simplify leaf optimization for XFS (#1823247)
* Fri Apr 17 2020 Tom Stellard <tstellar@redhat.com> - 8.32-4
- Fix missing inline function definition
* Wed Mar 11 2020 Kamil Dudka <kdudka@redhat.com> - 8.32-3
- uniq: remove collation handling as required by newer POSIX
* Mon Mar 09 2020 Kamil Dudka <kdudka@redhat.com> - 8.32-2
- make mknod work again in chroot without /proc being mounted (#1811038)
- ls: restore 8.31 behavior on removed directories
* Thu Mar 05 2020 Kamil Dudka <kdudka@redhat.com> - 8.32-1
- new upstream release 8.32
* Tue Feb 11 2020 Kamil Dudka <kdudka@redhat.com> - 8.31-10
- make upstream test-suite work with root privileges (#1800597)
* Wed Feb 05 2020 Kamil Dudka <kdudka@redhat.com> - 8.31-9
- use upstream fix the cp/proc-short-read test
* Thu Jan 30 2020 Kamil Dudka <kdudka@redhat.com> - 8.31-8
- skip a test that relies on /proc/kallsyms having immutable content
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Oct 17 2019 Kamil Dudka <kdudka@redhat.com> - 8.31-6
- temporarily disable the use of statx (#1760300)
* Fri Oct 11 2019 Kamil Dudka <kdudka@redhat.com> - 8.31-5
- use statx instead of stat when available (#1760300) - use statx instead of stat when available (#1760300)
* Tue Apr 14 2020 Kamil Dudka <kdudka@redhat.com> - 8.30-8 * Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org>
- df --local: recognize afs, auristorfs, and smb3 as remote fs (#1798030) - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
- fix formatting of sha512sum(1) man page (#1688744)
* Wed Jan 29 2020 Kamil Dudka <kdudka@redhat.com> - 8.30-7 * Tue Jul 16 2019 Kamil Dudka <kdudka@redhat.com> - 8.31-3
- chcon: do not validate security context if SELinux is disabled (#1777831) - disable flashing in ls colors for broken symbolic links (#1728986)
* Fri Jan 11 2019 Kamil Dudka <kdudka@redhat.com> - 8.30-6 * Mon Mar 18 2019 Kamil Dudka <kdudka@redhat.com> - 8.31-2
- cp --preserve=xattr: preserve NFSv4 ACL extended attributes (#1646985) - fix formatting of sha512sum(1) man page (#1688740)
* Wed Nov 07 2018 Kamil Dudka <kdudka@redhat.com> - 8.30-5 * Mon Mar 11 2019 Kamil Dudka <kdudka@redhat.com> - 8.31-1
- sync: fix open() fallback bug (#1602463) - new upstream release 8.31
- fix implicit declaration warning in coreutils-getgrouplist.patch (#1602463)
* Thu Oct 11 2018 Kamil Dudka <kdudka@redhat.com> - 8.30-4 * Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Nov 07 2018 Kamil Dudka <kdudka@redhat.com> - 8.30-8
- sync: fix open() fallback bug
- fix implicit declaration warning in coreutils-getgrouplist.patch
* Sat Nov 03 2018 Kevin Fenzi <kevin@scrye.com> - 8.30-7
- Also remove Requires pre/post used by info scriptlets.
* Sat Nov 03 2018 Kevin Fenzi <kevin@scrye.com> - 8.30-6
- Remove no longer needed info scriptlets
* Thu Oct 11 2018 Kamil Dudka <kdudka@redhat.com> - 8.30-5
- fix heap-based buffer overflow in vasnprintf() (CVE-2018-17942) - fix heap-based buffer overflow in vasnprintf() (CVE-2018-17942)
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 8.30-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jul 10 2018 Kamil Dudka <kdudka@redhat.com> - 8.30-3 * Tue Jul 10 2018 Kamil Dudka <kdudka@redhat.com> - 8.30-3
- rename gnulib's renameat2 to renameatu to avoid clash with glibc (#1598518) - rename gnulib's renameat2 to renameatu to avoid clash with glibc (#1598518)
@ -344,22 +498,31 @@ fi
* Mon Jul 02 2018 Kamil Dudka <kdudka@redhat.com> - 8.30-1 * Mon Jul 02 2018 Kamil Dudka <kdudka@redhat.com> - 8.30-1
- new upstream release 8.30 - new upstream release 8.30
* Mon May 28 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-8 * Wed May 30 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-12
- add provides to coreutils-single to make it a drop-in replacement
* Mon May 28 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-11
- ls: increase the allowed abmon width from 5 to 12 (#1577872) - ls: increase the allowed abmon width from 5 to 12 (#1577872)
- date, ls: pick strftime fixes from glibc to improve locale support (#1577872) - date, ls: pick strftime fixes from glibc to improve locale support (#1577872)
* Fri May 04 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-7 * Fri Apr 20 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-10
- add provides to coreutils-single to make it a drop-in replacement (#1572693)
- reintroduce very old Provides (mktemp, sh-utils, textwrap, fileutils, stat)
* Fri Apr 20 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-6
- fix crash caused by mistakenly enabled leaf optimization (#1558249) - fix crash caused by mistakenly enabled leaf optimization (#1558249)
* Wed Mar 21 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-5 * Fri Mar 23 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-9
- make it possible to install the latest available Adobe Reader RPM for Linux
* Mon Mar 19 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-8
- drop BR for bison, which is not used during the build - drop BR for bison, which is not used during the build
* Fri Mar 16 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-7
- make sure that parse-datetime.{c,y} ends up in debuginfo (#1555079) - make sure that parse-datetime.{c,y} ends up in debuginfo (#1555079)
* Tue Mar 06 2018 Kamil Dudka <kdudka@redhat.com> - 8.29-6
- fix build failure with glibc-2.28 - fix build failure with glibc-2.28
* Mon Feb 26 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 8.29-5
- Remove /bin/* Provides
* 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