import coreutils-8.30-6.el8
This commit is contained in:
commit
65b8ce6c2d
1
.coreutils.metadata
Normal file
1
.coreutils.metadata
Normal file
@ -0,0 +1 @@
|
||||
bd5d495c162730873a2774acd1c5091fbf0c55a4 SOURCES/coreutils-8.30.tar.xz
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
SOURCES/coreutils-8.30.tar.xz
|
20
SOURCES/coreutils-4.5.3-langinfo.patch
Normal file
20
SOURCES/coreutils-4.5.3-langinfo.patch
Normal file
@ -0,0 +1,20 @@
|
||||
diff --git a/src/date.c b/src/date.c
|
||||
index ddb011e..619a72b 100644
|
||||
--- a/src/date.c
|
||||
+++ b/src/date.c
|
||||
@@ -490,14 +490,7 @@ main (int argc, char **argv)
|
||||
format = DATE_FMT_LANGINFO ();
|
||||
if (! *format)
|
||||
{
|
||||
- /* Do not wrap the following literal format string with _(...).
|
||||
- For example, suppose LC_ALL is unset, LC_TIME=POSIX,
|
||||
- and LANG="ko_KR". In that case, POSIX says that LC_TIME
|
||||
- determines the format and contents of date and time strings
|
||||
- written by date, which means "date" must generate output
|
||||
- using the POSIX locale; but adding _() would cause "date"
|
||||
- to use a Korean translation of the format. */
|
||||
- format = "%a %b %e %H:%M:%S %Z %Y";
|
||||
+ format = dcgettext(NULL, N_("%a %b %e %H:%M:%S %Z %Y"), LC_TIME);
|
||||
}
|
||||
}
|
||||
|
14
SOURCES/coreutils-6.10-manpages.patch
Normal file
14
SOURCES/coreutils-6.10-manpages.patch
Normal file
@ -0,0 +1,14 @@
|
||||
diff --git a/src/md5sum.c b/src/md5sum.c
|
||||
index 8e21609..a857d62 100644
|
||||
--- a/src/md5sum.c
|
||||
+++ b/src/md5sum.c
|
||||
@@ -265,6 +265,9 @@ Print or check %s (%d-bit) checksums.\n\
|
||||
else
|
||||
fputs (_("\
|
||||
-t, --text read in text mode (default)\n\
|
||||
+"), stdout);
|
||||
+ fputs (_("\
|
||||
+ Note: There is no difference between binary and text mode option on GNU system.\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
-z, --zero end each output line with NUL, not newline,\n\
|
49
SOURCES/coreutils-8.2-uname-processortype.patch
Normal file
49
SOURCES/coreutils-8.2-uname-processortype.patch
Normal file
@ -0,0 +1,49 @@
|
||||
diff --git a/src/uname.c b/src/uname.c
|
||||
index 6371ca2..1ad8fd7 100644
|
||||
--- a/src/uname.c
|
||||
+++ b/src/uname.c
|
||||
@@ -300,13 +300,19 @@ main (int argc, char **argv)
|
||||
|
||||
if (toprint & PRINT_PROCESSOR)
|
||||
{
|
||||
- char const *element = unknown;
|
||||
+ char *element = unknown;
|
||||
#if HAVE_SYSINFO && defined SI_ARCHITECTURE
|
||||
{
|
||||
static char processor[257];
|
||||
if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
|
||||
element = processor;
|
||||
}
|
||||
+#else
|
||||
+ {
|
||||
+ static struct utsname u;
|
||||
+ uname(&u);
|
||||
+ element = u.machine;
|
||||
+ }
|
||||
#endif
|
||||
#ifdef UNAME_PROCESSOR
|
||||
if (element == unknown)
|
||||
@@ -344,7 +350,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (toprint & PRINT_HARDWARE_PLATFORM)
|
||||
{
|
||||
- char const *element = unknown;
|
||||
+ char *element = unknown;
|
||||
#if HAVE_SYSINFO && defined SI_PLATFORM
|
||||
{
|
||||
static char hardware_platform[257];
|
||||
@@ -352,6 +358,14 @@ main (int argc, char **argv)
|
||||
hardware_platform, sizeof hardware_platform))
|
||||
element = hardware_platform;
|
||||
}
|
||||
+#else
|
||||
+ {
|
||||
+ static struct utsname u;
|
||||
+ uname(&u);
|
||||
+ element = u.machine;
|
||||
+ if(strlen(element)==4 && element[0]=='i' && element[2]=='8' && element[3]=='6')
|
||||
+ element[1]='3';
|
||||
+ }
|
||||
#endif
|
||||
#ifdef UNAME_HARDWARE_PLATFORM
|
||||
if (element == unknown)
|
686
SOURCES/coreutils-8.25-DIR_COLORS.patch
Normal file
686
SOURCES/coreutils-8.25-DIR_COLORS.patch
Normal file
@ -0,0 +1,686 @@
|
||||
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
|
||||
|
26
SOURCES/coreutils-8.26-selinuxenable.patch
Normal file
26
SOURCES/coreutils-8.26-selinuxenable.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 6880c3dc9098b3337612850d1500b474aeb944ca Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Tue, 29 Aug 2017 17:33:51 +0200
|
||||
Subject: [PATCH] require_selinux_(): use selinuxenabled(8) if available
|
||||
|
||||
---
|
||||
init.cfg | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/init.cfg b/init.cfg
|
||||
index af6b581..f887b3a 100644
|
||||
--- a/init.cfg
|
||||
+++ b/init.cfg
|
||||
@@ -114,6 +114,9 @@ require_selinux_()
|
||||
grep 'selinuxfs$' /proc/filesystems > /dev/null \
|
||||
|| skip_ "this system lacks SELinux support"
|
||||
|
||||
+ # use the 'selinuxenabled' utility if available
|
||||
+ selinuxenabled; [ $? = 1 ] && skip_ "SELinux is disabled"
|
||||
+
|
||||
# Independent of whether SELinux is enabled system-wide,
|
||||
# the current file system may lack SELinux support.
|
||||
# Also the current build may have SELinux support disabled.
|
||||
--
|
||||
2.9.5
|
||||
|
29
SOURCES/coreutils-8.26-test-lock.patch
Normal file
29
SOURCES/coreutils-8.26-test-lock.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From 0d04ee8ddedb2bf33d64f148f246a3b7ec4fef21 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Mon, 23 Jan 2017 12:35:41 +0100
|
||||
Subject: [PATCH] test-lock: disable the rwlock test
|
||||
|
||||
It hangs indefinitely if the system rwlock implementation does not
|
||||
prevent writer starvation (and glibc does not implement it).
|
||||
|
||||
Bug: http://www.mail-archive.com/bug-gnulib@gnu.org/msg33017.html
|
||||
---
|
||||
gnulib-tests/test-lock.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gnulib-tests/test-lock.c b/gnulib-tests/test-lock.c
|
||||
index aa6de27..5af0a6c 100644
|
||||
--- a/gnulib-tests/test-lock.c
|
||||
+++ b/gnulib-tests/test-lock.c
|
||||
@@ -42,7 +42,7 @@
|
||||
Uncomment some of these, to verify that all tests crash if no locking
|
||||
is enabled. */
|
||||
#define DO_TEST_LOCK 1
|
||||
-#define DO_TEST_RWLOCK 1
|
||||
+#define DO_TEST_RWLOCK 0
|
||||
#define DO_TEST_RECURSIVE_LOCK 1
|
||||
#define DO_TEST_ONCE 1
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
69
SOURCES/coreutils-8.30-CVE-2018-17942.patch
Normal file
69
SOURCES/coreutils-8.30-CVE-2018-17942.patch
Normal file
@ -0,0 +1,69 @@
|
||||
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
|
||||
|
69
SOURCES/coreutils-8.30-cp-preserve-xattr-NFSv4-ACL.patch
Normal file
69
SOURCES/coreutils-8.30-cp-preserve-xattr-NFSv4-ACL.patch
Normal file
@ -0,0 +1,69 @@
|
||||
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
|
||||
|
77
SOURCES/coreutils-8.30-fsync-fallback.patch
Normal file
77
SOURCES/coreutils-8.30-fsync-fallback.patch
Normal file
@ -0,0 +1,77 @@
|
||||
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
|
||||
|
451
SOURCES/coreutils-8.30-renameatu.patch
Normal file
451
SOURCES/coreutils-8.30-renameatu.patch
Normal file
@ -0,0 +1,451 @@
|
||||
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
|
||||
|
13
SOURCES/coreutils-8.4-mkdir-modenote.patch
Normal file
13
SOURCES/coreutils-8.4-mkdir-modenote.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
|
||||
index 400e135..47e4480 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -10074,6 +10074,8 @@ incorrect. @xref{Directory Setuid and Setgid}, for how the
|
||||
set-user-ID and set-group-ID bits of directories are inherited unless
|
||||
overridden in this way.
|
||||
|
||||
+Note: The @option{--mode},@option{-m} option only applies to the right-most directories listed on the command line. When combined with @option{--parents}, @option{-p} option, any parent directories are created with @samp{u+wx} modified by umask.
|
||||
+
|
||||
@item -p
|
||||
@itemx --parents
|
||||
@opindex -p
|
68
SOURCES/coreutils-colorls.csh
Executable file
68
SOURCES/coreutils-colorls.csh
Executable file
@ -0,0 +1,68 @@
|
||||
# skip everything for non-interactive shells
|
||||
if (! $?prompt) exit
|
||||
|
||||
# color-ls initialization
|
||||
if ( $?USER_LS_COLORS ) then
|
||||
if ( "$USER_LS_COLORS" != "" ) then
|
||||
#when USER_LS_COLORS defined do not override user
|
||||
#specified LS_COLORS and use them
|
||||
goto finish
|
||||
endif
|
||||
endif
|
||||
|
||||
alias ll 'ls -l'
|
||||
alias l. 'ls -d .*'
|
||||
set COLORS=/etc/DIR_COLORS
|
||||
|
||||
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
|
||||
set COLORS="/etc/DIR_COLORS.$TERM"
|
||||
endif
|
||||
endif
|
||||
if ( -f ~/.dircolors ) set COLORS=~/.dircolors
|
||||
if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors
|
||||
if ($?TERM) then
|
||||
if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM"
|
||||
if ( -f ~/.dir_colors."$TERM" ) set COLORS=~/.dir_colors."$TERM"
|
||||
endif
|
||||
set INCLUDE="`/usr/bin/cat "$COLORS" | /usr/bin/grep '^INCLUDE' | /usr/bin/cut -d ' ' -f2-`"
|
||||
|
||||
if ( ! -e "$COLORS" ) exit
|
||||
|
||||
set _tmp="`/usr/bin/mktemp .colorlsXXX -q --tmpdir=/tmp`"
|
||||
#if mktemp fails, exit when include was active, otherwise use $COLORS file
|
||||
if ( "$_tmp" == '' ) then
|
||||
if ( "$INCLUDE" == '' ) then
|
||||
eval "`/usr/bin/dircolors -c $COLORS`"
|
||||
endif
|
||||
goto cleanup
|
||||
endif
|
||||
|
||||
if ( "$INCLUDE" != '' ) /usr/bin/cat "$INCLUDE" >> $_tmp
|
||||
/usr/bin/grep -v '^INCLUDE' "$COLORS" >> $_tmp
|
||||
|
||||
eval "`/usr/bin/dircolors -c $_tmp`"
|
||||
|
||||
/usr/bin/rm -f $_tmp
|
||||
|
||||
if ( "$LS_COLORS" == '' ) exit
|
||||
cleanup:
|
||||
set color_none=`/usr/bin/sed -n '/^COLOR.*none/Ip' < $COLORS`
|
||||
if ( "$color_none" != '' ) then
|
||||
unset color_none
|
||||
exit
|
||||
endif
|
||||
unset color_none
|
||||
unset _tmp
|
||||
unset INCLUDE
|
||||
unset COLORS
|
||||
|
||||
finish:
|
||||
alias ll 'ls -l --color=auto'
|
||||
alias l. 'ls -d .* --color=auto'
|
||||
alias ls 'ls --color=auto'
|
57
SOURCES/coreutils-colorls.sh
Executable file
57
SOURCES/coreutils-colorls.sh
Executable file
@ -0,0 +1,57 @@
|
||||
# color-ls initialization
|
||||
|
||||
# Skip all for noninteractive shells.
|
||||
[ ! -t 0 ] && return
|
||||
|
||||
#when USER_LS_COLORS defined do not override user LS_COLORS, but use them.
|
||||
if [ -z "$USER_LS_COLORS" ]; then
|
||||
|
||||
alias ll='ls -l' 2>/dev/null
|
||||
alias l.='ls -d .*' 2>/dev/null
|
||||
|
||||
INCLUDE=
|
||||
COLORS=
|
||||
|
||||
for colors in "$HOME/.dir_colors.$TERM" "$HOME/.dircolors.$TERM" \
|
||||
"$HOME/.dir_colors" "$HOME/.dircolors"; do
|
||||
[ -e "$colors" ] && COLORS="$colors" && \
|
||||
INCLUDE="`/usr/bin/cat "$COLORS" | /usr/bin/grep '^INCLUDE' | /usr/bin/cut -d ' ' -f2-`" && \
|
||||
break
|
||||
done
|
||||
|
||||
[ -z "$COLORS" ] && [ -e "/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" ] && \
|
||||
COLORS="/etc/DIR_COLORS"
|
||||
|
||||
# Existence of $COLORS already checked above.
|
||||
[ -n "$COLORS" ] || return
|
||||
|
||||
if [ -e "$INCLUDE" ];
|
||||
then
|
||||
TMP="`/usr/bin/mktemp .colorlsXXX -q --tmpdir=/tmp`"
|
||||
[ -z "$TMP" ] && return
|
||||
|
||||
/usr/bin/cat "$INCLUDE" >> $TMP
|
||||
/usr/bin/grep -v '^INCLUDE' "$COLORS" >> $TMP
|
||||
|
||||
eval "`/usr/bin/dircolors --sh $TMP 2>/dev/null`"
|
||||
/usr/bin/rm -f $TMP
|
||||
else
|
||||
eval "`/usr/bin/dircolors --sh $COLORS 2>/dev/null`"
|
||||
fi
|
||||
|
||||
[ -z "$LS_COLORS" ] && return
|
||||
/usr/bin/grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return
|
||||
fi
|
||||
|
||||
unset TMP COLORS INCLUDE
|
||||
|
||||
alias ll='ls -l --color=auto' 2>/dev/null
|
||||
alias l.='ls -d .* --color=auto' 2>/dev/null
|
||||
alias ls='ls --color=auto' 2>/dev/null
|
174
SOURCES/coreutils-df-direct.patch
Normal file
174
SOURCES/coreutils-df-direct.patch
Normal file
@ -0,0 +1,174 @@
|
||||
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
|
||||
index a507280..400e135 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -11303,6 +11303,13 @@ some systems (notably SunOS), doing this yields more up to date results,
|
||||
but in general this option makes @command{df} much slower, especially when
|
||||
there are many or very busy file systems.
|
||||
|
||||
+@item --direct
|
||||
+@opindex --direct
|
||||
+@cindex direct statfs for a file
|
||||
+Do not resolve mount point and show statistics directly for a file. It can be
|
||||
+especially useful for NFS mount points if there is a boundary between two
|
||||
+storage policies behind the mount point.
|
||||
+
|
||||
@item --total
|
||||
@opindex --total
|
||||
@cindex grand total of disk size, usage and available space
|
||||
diff --git a/src/df.c b/src/df.c
|
||||
index 8f760db..a7385fd 100644
|
||||
--- a/src/df.c
|
||||
+++ b/src/df.c
|
||||
@@ -120,6 +120,9 @@ static bool print_type;
|
||||
/* If true, print a grand total at the end. */
|
||||
static bool print_grand_total;
|
||||
|
||||
+/* If true, show statistics for a file instead of mount point. */
|
||||
+static bool direct_statfs;
|
||||
+
|
||||
/* Grand total data. */
|
||||
static struct fs_usage grand_fsu;
|
||||
|
||||
@@ -247,13 +250,15 @@ enum
|
||||
NO_SYNC_OPTION = CHAR_MAX + 1,
|
||||
SYNC_OPTION,
|
||||
TOTAL_OPTION,
|
||||
- OUTPUT_OPTION
|
||||
+ OUTPUT_OPTION,
|
||||
+ DIRECT_OPTION
|
||||
};
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"all", no_argument, NULL, 'a'},
|
||||
{"block-size", required_argument, NULL, 'B'},
|
||||
+ {"direct", no_argument, NULL, DIRECT_OPTION},
|
||||
{"inodes", no_argument, NULL, 'i'},
|
||||
{"human-readable", no_argument, NULL, 'h'},
|
||||
{"si", no_argument, NULL, 'H'},
|
||||
@@ -509,7 +514,10 @@ get_header (void)
|
||||
for (col = 0; col < ncolumns; col++)
|
||||
{
|
||||
char *cell = NULL;
|
||||
- char const *header = _(columns[col]->caption);
|
||||
+ char const *header = (columns[col]->field == TARGET_FIELD
|
||||
+ && direct_statfs)?
|
||||
+ _("File") :
|
||||
+ _(columns[col]->caption);
|
||||
|
||||
if (columns[col]->field == SIZE_FIELD
|
||||
&& (header_mode == DEFAULT_MODE
|
||||
@@ -1397,6 +1405,19 @@ get_point (const char *point, const struct stat *statp)
|
||||
static void
|
||||
get_entry (char const *name, struct stat const *statp)
|
||||
{
|
||||
+ if (direct_statfs)
|
||||
+ {
|
||||
+ char *resolved = canonicalize_file_name (name);
|
||||
+ if (resolved)
|
||||
+ {
|
||||
+ char *mp = find_mount_point (name, statp);
|
||||
+ get_dev (NULL, mp, resolved, NULL, NULL, false, false, NULL, false);
|
||||
+ free(mp);
|
||||
+ free (resolved);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
|
||||
&& get_disk (name))
|
||||
return;
|
||||
@@ -1467,6 +1488,7 @@ or all file systems by default.\n\
|
||||
-B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\
|
||||
'-BM' prints sizes in units of 1,048,576 bytes;\n\
|
||||
see SIZE format below\n\
|
||||
+ --direct show statistics for a file instead of mount point\n\
|
||||
-h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\
|
||||
-H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\
|
||||
"), stdout);
|
||||
@@ -1557,6 +1579,9 @@ main (int argc, char **argv)
|
||||
xstrtol_fatal (e, oi, c, long_options, optarg);
|
||||
}
|
||||
break;
|
||||
+ case DIRECT_OPTION:
|
||||
+ direct_statfs = true;
|
||||
+ break;
|
||||
case 'i':
|
||||
if (header_mode == OUTPUT_MODE)
|
||||
{
|
||||
@@ -1653,6 +1678,13 @@ main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
+ if (direct_statfs && show_local_fs)
|
||||
+ {
|
||||
+ error (0, 0, _("options --direct and --local (-l) are mutually "
|
||||
+ "exclusive"));
|
||||
+ usage (EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
if (human_output_opts == -1)
|
||||
{
|
||||
if (posix_format)
|
||||
diff --git a/tests/df/direct.sh b/tests/df/direct.sh
|
||||
new file mode 100755
|
||||
index 0000000..8e4cfb8
|
||||
--- /dev/null
|
||||
+++ b/tests/df/direct.sh
|
||||
@@ -0,0 +1,55 @@
|
||||
+#!/bin/sh
|
||||
+# Ensure "df --direct" works as documented
|
||||
+
|
||||
+# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
+print_ver_ df
|
||||
+
|
||||
+df || skip_ "df fails"
|
||||
+
|
||||
+DIR=`pwd` || framework_failure
|
||||
+FILE="$DIR/file"
|
||||
+touch "$FILE" || framework_failure
|
||||
+echo "$FILE" > file_exp || framework_failure
|
||||
+echo "Mounted on" > header_mounted_exp || framework_failure
|
||||
+echo "File" > header_file_exp || framework_failure
|
||||
+
|
||||
+fail=0
|
||||
+
|
||||
+df --portability "$FILE" > df_out || fail=1
|
||||
+df --portability --direct "$FILE" > df_direct_out || fail=1
|
||||
+df --portability --direct --local "$FILE" > /dev/null 2>&1 && fail=1
|
||||
+
|
||||
+# check df header
|
||||
+$AWK '{ if (NR==1) print $6 " " $7; }' df_out > header_mounted_out \
|
||||
+ || framework_failure
|
||||
+$AWK '{ if (NR==1) print $6; }' df_direct_out > header_file_out \
|
||||
+ || framework_failure
|
||||
+compare header_mounted_out header_mounted_exp || fail=1
|
||||
+compare header_file_out header_file_exp || fail=1
|
||||
+
|
||||
+# check df output (without --direct)
|
||||
+$AWK '{ if (NR==2) print $6; }' df_out > file_out \
|
||||
+ || framework_failure
|
||||
+compare file_out file_exp && fail=1
|
||||
+
|
||||
+# check df output (with --direct)
|
||||
+$AWK '{ if (NR==2) print $6; }' df_direct_out > file_out \
|
||||
+ || framework_failure
|
||||
+compare file_out file_exp || fail=1
|
||||
+
|
||||
+Exit $fail
|
94
SOURCES/coreutils-getgrouplist.patch
Normal file
94
SOURCES/coreutils-getgrouplist.patch
Normal file
@ -0,0 +1,94 @@
|
||||
diff --git a/lib/getugroups.c b/lib/getugroups.c
|
||||
index 299bae6..8ece29b 100644
|
||||
--- a/lib/getugroups.c
|
||||
+++ b/lib/getugroups.c
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
+/* We do not need this code if getgrouplist(3) is available. */
|
||||
+#ifndef HAVE_GETGROUPLIST
|
||||
+
|
||||
#include "getugroups.h"
|
||||
|
||||
#include <errno.h>
|
||||
@@ -126,3 +129,4 @@ getugroups (int maxcount, gid_t *grouplist, char const *username,
|
||||
}
|
||||
|
||||
#endif /* HAVE_GRP_H */
|
||||
+#endif /* have getgrouplist */
|
||||
diff --git a/lib/mgetgroups.c b/lib/mgetgroups.c
|
||||
index 76474c2..0a9d221 100644
|
||||
--- a/lib/mgetgroups.c
|
||||
+++ b/lib/mgetgroups.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#endif
|
||||
|
||||
#include "getugroups.h"
|
||||
+#include "xalloc.h"
|
||||
#include "xalloc-oversized.h"
|
||||
|
||||
/* Work around an incompatibility of OS X 10.11: getgrouplist
|
||||
@@ -121,9 +122,17 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
|
||||
/* else no username, so fall through and use getgroups. */
|
||||
#endif
|
||||
|
||||
- max_n_groups = (username
|
||||
- ? getugroups (0, NULL, username, gid)
|
||||
- : getgroups (0, NULL));
|
||||
+ if (!username)
|
||||
+ max_n_groups = getgroups(0, NULL);
|
||||
+ else
|
||||
+ {
|
||||
+#ifdef HAVE_GETGROUPLIST
|
||||
+ max_n_groups = 0;
|
||||
+ getgrouplist (username, gid, NULL, &max_n_groups);
|
||||
+#else
|
||||
+ max_n_groups = getugroups (0, NULL, username, gid);
|
||||
+#endif
|
||||
+ }
|
||||
|
||||
/* If we failed to count groups because there is no supplemental
|
||||
group support, then return an array containing just GID.
|
||||
@@ -145,10 +154,25 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
|
||||
if (g == NULL)
|
||||
return -1;
|
||||
|
||||
- ng = (username
|
||||
- ? getugroups (max_n_groups, g, username, gid)
|
||||
- : getgroups (max_n_groups - (gid != (gid_t) -1),
|
||||
- g + (gid != (gid_t) -1)));
|
||||
+ if (!username)
|
||||
+ ng = getgroups (max_n_groups - (gid != (gid_t)-1), g + (gid != (gid_t)-1));
|
||||
+ else
|
||||
+ {
|
||||
+#ifdef HAVE_GETGROUPLIST
|
||||
+ int e;
|
||||
+ ng = max_n_groups;
|
||||
+ while ((e = getgrouplist (username, gid, g, &ng)) == -1
|
||||
+ && ng > max_n_groups)
|
||||
+ {
|
||||
+ max_n_groups = ng;
|
||||
+ g = xrealloc (g, max_n_groups * sizeof (GETGROUPS_T));
|
||||
+ }
|
||||
+ if (e == -1)
|
||||
+ ng = -1;
|
||||
+#else
|
||||
+ ng = getugroups (max_n_groups, g, username, gid);
|
||||
+#endif
|
||||
+ }
|
||||
|
||||
if (ng < 0)
|
||||
{
|
||||
diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4
|
||||
index 62777c7..5180243 100644
|
||||
--- a/m4/jm-macros.m4
|
||||
+++ b/m4/jm-macros.m4
|
||||
@@ -82,6 +82,7 @@ AC_DEFUN([coreutils_MACROS],
|
||||
fchown
|
||||
fchmod
|
||||
ftruncate
|
||||
+ getgrouplist
|
||||
iswspace
|
||||
mkfifo
|
||||
mbrlen
|
565
SOURCES/coreutils-i18n-cut-old.patch
Normal file
565
SOURCES/coreutils-i18n-cut-old.patch
Normal file
@ -0,0 +1,565 @@
|
||||
diff --git a/src/cut.c b/src/cut.c
|
||||
index 7ab6be4..022d0ad 100644
|
||||
--- a/src/cut.c
|
||||
+++ b/src/cut.c
|
||||
@@ -28,6 +28,11 @@
|
||||
#include <assert.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
+
|
||||
+/* Get mbstate_t, mbrtowc(). */
|
||||
+#if HAVE_WCHAR_H
|
||||
+# include <wchar.h>
|
||||
+#endif
|
||||
#include "system.h"
|
||||
|
||||
#include "error.h"
|
||||
@@ -38,6 +43,18 @@
|
||||
|
||||
#include "set-fields.h"
|
||||
|
||||
+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
|
||||
+ installation; work around this configuration error. */
|
||||
+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
|
||||
+# undef MB_LEN_MAX
|
||||
+# define MB_LEN_MAX 16
|
||||
+#endif
|
||||
+
|
||||
+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
|
||||
+#if HAVE_MBRTOWC && defined mbstate_t
|
||||
+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
|
||||
+#endif
|
||||
+
|
||||
/* The official name of this program (e.g., no 'g' prefix). */
|
||||
#define PROGRAM_NAME "cut"
|
||||
|
||||
@@ -54,6 +71,52 @@
|
||||
} \
|
||||
while (0)
|
||||
|
||||
+/* Refill the buffer BUF to get a multibyte character. */
|
||||
+#define REFILL_BUFFER(BUF, BUFPOS, BUFLEN, STREAM) \
|
||||
+ do \
|
||||
+ { \
|
||||
+ if (BUFLEN < MB_LEN_MAX && !feof (STREAM) && !ferror (STREAM)) \
|
||||
+ { \
|
||||
+ memmove (BUF, BUFPOS, BUFLEN); \
|
||||
+ BUFLEN += fread (BUF + BUFLEN, sizeof(char), BUFSIZ, STREAM); \
|
||||
+ BUFPOS = BUF; \
|
||||
+ } \
|
||||
+ } \
|
||||
+ while (0)
|
||||
+
|
||||
+/* Get wide character on BUFPOS. BUFPOS is not included after that.
|
||||
+ If byte sequence is not valid as a character, CONVFAIL is true. Otherwise false. */
|
||||
+#define GET_NEXT_WC_FROM_BUFFER(WC, BUFPOS, BUFLEN, MBLENGTH, STATE, CONVFAIL) \
|
||||
+ do \
|
||||
+ { \
|
||||
+ mbstate_t state_bak; \
|
||||
+ \
|
||||
+ if (BUFLEN < 1) \
|
||||
+ { \
|
||||
+ WC = WEOF; \
|
||||
+ break; \
|
||||
+ } \
|
||||
+ \
|
||||
+ /* Get a wide character. */ \
|
||||
+ CONVFAIL = false; \
|
||||
+ state_bak = STATE; \
|
||||
+ MBLENGTH = mbrtowc ((wchar_t *)&WC, BUFPOS, BUFLEN, &STATE); \
|
||||
+ \
|
||||
+ switch (MBLENGTH) \
|
||||
+ { \
|
||||
+ case (size_t)-1: \
|
||||
+ case (size_t)-2: \
|
||||
+ CONVFAIL = true; \
|
||||
+ STATE = state_bak; \
|
||||
+ /* Fall througn. */ \
|
||||
+ \
|
||||
+ case 0: \
|
||||
+ MBLENGTH = 1; \
|
||||
+ break; \
|
||||
+ } \
|
||||
+ } \
|
||||
+ while (0)
|
||||
+
|
||||
|
||||
/* Pointer inside RP. When checking if a byte or field is selected
|
||||
by a finite range, we check if it is between CURRENT_RP.LO
|
||||
@@ -61,6 +124,9 @@
|
||||
CURRENT_RP.HI then we make CURRENT_RP to point to the next range pair. */
|
||||
static struct field_range_pair *current_rp;
|
||||
|
||||
+/* Length of the delimiter given as argument to -d. */
|
||||
+size_t delimlen;
|
||||
+
|
||||
/* This buffer is used to support the semantics of the -s option
|
||||
(or lack of same) when the specified field list includes (does
|
||||
not include) the first field. In both of those cases, the entire
|
||||
@@ -77,15 +143,25 @@ enum operating_mode
|
||||
{
|
||||
undefined_mode,
|
||||
|
||||
- /* Output characters that are in the given bytes. */
|
||||
+ /* Output bytes that are at the given positions. */
|
||||
byte_mode,
|
||||
|
||||
+ /* Output characters that are at the given positions. */
|
||||
+ character_mode,
|
||||
+
|
||||
/* Output the given delimiter-separated fields. */
|
||||
field_mode
|
||||
};
|
||||
|
||||
static enum operating_mode operating_mode;
|
||||
|
||||
+/* If nonzero, when in byte mode, don't split multibyte characters. */
|
||||
+static int byte_mode_character_aware;
|
||||
+
|
||||
+/* If nonzero, the function for single byte locale is work
|
||||
+ if this program runs on multibyte locale. */
|
||||
+static int force_singlebyte_mode;
|
||||
+
|
||||
/* If true do not output lines containing no delimiter characters.
|
||||
Otherwise, all such lines are printed. This option is valid only
|
||||
with field mode. */
|
||||
@@ -97,6 +173,9 @@ static bool complement;
|
||||
|
||||
/* The delimiter character for field mode. */
|
||||
static unsigned char delim;
|
||||
+#if HAVE_WCHAR_H
|
||||
+static wchar_t wcdelim;
|
||||
+#endif
|
||||
|
||||
/* The delimiter for each line/record. */
|
||||
static unsigned char line_delim = '\n';
|
||||
@@ -164,7 +243,7 @@ Print selected parts of lines from each FILE to standard output.\n\
|
||||
-f, --fields=LIST select only these fields; also print any line\n\
|
||||
that contains no delimiter character, unless\n\
|
||||
the -s option is specified\n\
|
||||
- -n (ignored)\n\
|
||||
+ -n with -b: don't split multibyte characters\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
--complement complement the set of selected bytes, characters\n\
|
||||
@@ -280,6 +359,82 @@ cut_bytes (FILE *stream)
|
||||
}
|
||||
}
|
||||
|
||||
+#if HAVE_MBRTOWC
|
||||
+/* This function is in use for the following case.
|
||||
+
|
||||
+ 1. Read from the stream STREAM, printing to standard output any selected
|
||||
+ characters.
|
||||
+
|
||||
+ 2. Read from stream STREAM, printing to standard output any selected bytes,
|
||||
+ without splitting multibyte characters. */
|
||||
+
|
||||
+static void
|
||||
+cut_characters_or_cut_bytes_no_split (FILE *stream)
|
||||
+{
|
||||
+ uintmax_t idx; /* number of bytes or characters in the line so far. */
|
||||
+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
|
||||
+ char *bufpos; /* Next read position of BUF. */
|
||||
+ size_t buflen; /* The length of the byte sequence in buf. */
|
||||
+ wint_t wc; /* A gotten wide character. */
|
||||
+ size_t mblength; /* The byte size of a multibyte character which shows
|
||||
+ as same character as WC. */
|
||||
+ mbstate_t state; /* State of the stream. */
|
||||
+ bool convfail = false; /* true, when conversion failed. Otherwise false. */
|
||||
+ /* Whether to begin printing delimiters between ranges for the current line.
|
||||
+ Set after we've begun printing data corresponding to the first range. */
|
||||
+ bool print_delimiter = false;
|
||||
+
|
||||
+ idx = 0;
|
||||
+ buflen = 0;
|
||||
+ bufpos = buf;
|
||||
+ memset (&state, '\0', sizeof(mbstate_t));
|
||||
+
|
||||
+ current_rp = frp;
|
||||
+
|
||||
+ while (1)
|
||||
+ {
|
||||
+ REFILL_BUFFER (buf, bufpos, buflen, stream);
|
||||
+
|
||||
+ GET_NEXT_WC_FROM_BUFFER (wc, bufpos, buflen, mblength, state, convfail);
|
||||
+ (void) convfail; /* ignore unused */
|
||||
+
|
||||
+ if (wc == WEOF)
|
||||
+ {
|
||||
+ if (idx > 0)
|
||||
+ putchar (line_delim);
|
||||
+ break;
|
||||
+ }
|
||||
+ else if (wc == line_delim)
|
||||
+ {
|
||||
+ putchar (line_delim);
|
||||
+ idx = 0;
|
||||
+ print_delimiter = false;
|
||||
+ current_rp = frp;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ next_item (&idx);
|
||||
+ if (print_kth (idx))
|
||||
+ {
|
||||
+ if (output_delimiter_specified)
|
||||
+ {
|
||||
+ if (print_delimiter && is_range_start_index (idx))
|
||||
+ {
|
||||
+ fwrite (output_delimiter_string, sizeof (char),
|
||||
+ output_delimiter_length, stdout);
|
||||
+ }
|
||||
+ print_delimiter = true;
|
||||
+ }
|
||||
+ fwrite (bufpos, mblength, sizeof(char), stdout);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ buflen -= mblength;
|
||||
+ bufpos += mblength;
|
||||
+ }
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* Read from stream STREAM, printing to standard output any selected fields. */
|
||||
|
||||
static void
|
||||
@@ -425,13 +580,211 @@ cut_fields (FILE *stream)
|
||||
}
|
||||
}
|
||||
|
||||
+#if HAVE_MBRTOWC
|
||||
+static void
|
||||
+cut_fields_mb (FILE *stream)
|
||||
+{
|
||||
+ int c;
|
||||
+ uintmax_t field_idx;
|
||||
+ int found_any_selected_field;
|
||||
+ int buffer_first_field;
|
||||
+ int empty_input;
|
||||
+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
|
||||
+ char *bufpos; /* Next read position of BUF. */
|
||||
+ size_t buflen; /* The length of the byte sequence in buf. */
|
||||
+ wint_t wc = 0; /* A gotten wide character. */
|
||||
+ size_t mblength; /* The byte size of a multibyte character which shows
|
||||
+ as same character as WC. */
|
||||
+ mbstate_t state; /* State of the stream. */
|
||||
+ bool convfail = false; /* true, when conversion failed. Otherwise false. */
|
||||
+
|
||||
+ current_rp = frp;
|
||||
+
|
||||
+ found_any_selected_field = 0;
|
||||
+ field_idx = 1;
|
||||
+ bufpos = buf;
|
||||
+ buflen = 0;
|
||||
+ memset (&state, '\0', sizeof(mbstate_t));
|
||||
+
|
||||
+ c = getc (stream);
|
||||
+ empty_input = (c == EOF);
|
||||
+ if (c != EOF)
|
||||
+ {
|
||||
+ ungetc (c, stream);
|
||||
+ wc = 0;
|
||||
+ }
|
||||
+ else
|
||||
+ wc = WEOF;
|
||||
+
|
||||
+ /* To support the semantics of the -s flag, we may have to buffer
|
||||
+ all of the first field to determine whether it is `delimited.'
|
||||
+ But that is unnecessary if all non-delimited lines must be printed
|
||||
+ and the first field has been selected, or if non-delimited lines
|
||||
+ must be suppressed and the first field has *not* been selected.
|
||||
+ That is because a non-delimited line has exactly one field. */
|
||||
+ buffer_first_field = (suppress_non_delimited ^ !print_kth (1));
|
||||
+
|
||||
+ while (1)
|
||||
+ {
|
||||
+ if (field_idx == 1 && buffer_first_field)
|
||||
+ {
|
||||
+ int len = 0;
|
||||
+
|
||||
+ while (1)
|
||||
+ {
|
||||
+ REFILL_BUFFER (buf, bufpos, buflen, stream);
|
||||
+
|
||||
+ GET_NEXT_WC_FROM_BUFFER
|
||||
+ (wc, bufpos, buflen, mblength, state, convfail);
|
||||
+
|
||||
+ if (wc == WEOF)
|
||||
+ break;
|
||||
+
|
||||
+ field_1_buffer = xrealloc (field_1_buffer, len + mblength);
|
||||
+ memcpy (field_1_buffer + len, bufpos, mblength);
|
||||
+ len += mblength;
|
||||
+ buflen -= mblength;
|
||||
+ bufpos += mblength;
|
||||
+
|
||||
+ if (!convfail && (wc == line_delim || wc == wcdelim))
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (len <= 0 && wc == WEOF)
|
||||
+ break;
|
||||
+
|
||||
+ /* If the first field extends to the end of line (it is not
|
||||
+ delimited) and we are printing all non-delimited lines,
|
||||
+ print this one. */
|
||||
+ if (convfail || (!convfail && wc != wcdelim))
|
||||
+ {
|
||||
+ if (suppress_non_delimited)
|
||||
+ {
|
||||
+ /* Empty. */
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ fwrite (field_1_buffer, sizeof (char), len, stdout);
|
||||
+ /* Make sure the output line is newline terminated. */
|
||||
+ if (convfail || (!convfail && wc != line_delim))
|
||||
+ putchar (line_delim);
|
||||
+ }
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (print_kth (1))
|
||||
+ {
|
||||
+ /* Print the field, but not the trailing delimiter. */
|
||||
+ fwrite (field_1_buffer, sizeof (char), len - 1, stdout);
|
||||
+ found_any_selected_field = 1;
|
||||
+ }
|
||||
+ next_item (&field_idx);
|
||||
+ }
|
||||
+
|
||||
+ if (wc != WEOF)
|
||||
+ {
|
||||
+ if (print_kth (field_idx))
|
||||
+ {
|
||||
+ if (found_any_selected_field)
|
||||
+ {
|
||||
+ fwrite (output_delimiter_string, sizeof (char),
|
||||
+ output_delimiter_length, stdout);
|
||||
+ }
|
||||
+ found_any_selected_field = 1;
|
||||
+ }
|
||||
+
|
||||
+ while (1)
|
||||
+ {
|
||||
+ REFILL_BUFFER (buf, bufpos, buflen, stream);
|
||||
+
|
||||
+ GET_NEXT_WC_FROM_BUFFER
|
||||
+ (wc, bufpos, buflen, mblength, state, convfail);
|
||||
+
|
||||
+ if (wc == WEOF)
|
||||
+ break;
|
||||
+ else if (!convfail && (wc == wcdelim || wc == line_delim))
|
||||
+ {
|
||||
+ buflen -= mblength;
|
||||
+ bufpos += mblength;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (print_kth (field_idx))
|
||||
+ fwrite (bufpos, mblength, sizeof(char), stdout);
|
||||
+
|
||||
+ buflen -= mblength;
|
||||
+ bufpos += mblength;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if ((!convfail || wc == line_delim) && buflen < 1)
|
||||
+ wc = WEOF;
|
||||
+
|
||||
+ if (!convfail && wc == wcdelim)
|
||||
+ next_item (&field_idx);
|
||||
+ else if (wc == WEOF || (!convfail && wc == line_delim))
|
||||
+ {
|
||||
+ if (found_any_selected_field
|
||||
+ || (!empty_input && !(suppress_non_delimited && field_idx == 1)))
|
||||
+ putchar (line_delim);
|
||||
+ if (wc == WEOF)
|
||||
+ break;
|
||||
+ field_idx = 1;
|
||||
+ current_rp = frp;
|
||||
+ found_any_selected_field = 0;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static void
|
||||
cut_stream (FILE *stream)
|
||||
{
|
||||
- if (operating_mode == byte_mode)
|
||||
- cut_bytes (stream);
|
||||
+#if HAVE_MBRTOWC
|
||||
+ if (MB_CUR_MAX > 1 && !force_singlebyte_mode)
|
||||
+ {
|
||||
+ switch (operating_mode)
|
||||
+ {
|
||||
+ case byte_mode:
|
||||
+ if (byte_mode_character_aware)
|
||||
+ cut_characters_or_cut_bytes_no_split (stream);
|
||||
+ else
|
||||
+ cut_bytes (stream);
|
||||
+ break;
|
||||
+
|
||||
+ case character_mode:
|
||||
+ cut_characters_or_cut_bytes_no_split (stream);
|
||||
+ break;
|
||||
+
|
||||
+ case field_mode:
|
||||
+ if (delimlen == 1)
|
||||
+ {
|
||||
+ /* Check if we have utf8 multibyte locale, so we can use this
|
||||
+ optimization because of uniqueness of characters, which is
|
||||
+ not true for e.g. SJIS */
|
||||
+ char * loc = setlocale(LC_CTYPE, NULL);
|
||||
+ if (loc && (strstr (loc, "UTF-8") || strstr (loc, "utf-8") ||
|
||||
+ strstr (loc, "UTF8") || strstr (loc, "utf8")))
|
||||
+ {
|
||||
+ cut_fields (stream);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ cut_fields_mb (stream);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ abort ();
|
||||
+ }
|
||||
+ }
|
||||
else
|
||||
- cut_fields (stream);
|
||||
+#endif
|
||||
+ {
|
||||
+ if (operating_mode == field_mode)
|
||||
+ cut_fields (stream);
|
||||
+ else
|
||||
+ cut_bytes (stream);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Process file FILE to standard output.
|
||||
@@ -483,6 +836,7 @@ main (int argc, char **argv)
|
||||
bool ok;
|
||||
bool delim_specified = false;
|
||||
char *spec_list_string IF_LINT ( = NULL);
|
||||
+ char mbdelim[MB_LEN_MAX + 1];
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
set_program_name (argv[0]);
|
||||
@@ -505,7 +859,6 @@ main (int argc, char **argv)
|
||||
switch (optc)
|
||||
{
|
||||
case 'b':
|
||||
- case 'c':
|
||||
/* Build the byte list. */
|
||||
if (operating_mode != undefined_mode)
|
||||
FATAL_ERROR (_("only one type of list may be specified"));
|
||||
@@ -513,6 +866,14 @@ main (int argc, char **argv)
|
||||
spec_list_string = optarg;
|
||||
break;
|
||||
|
||||
+ case 'c':
|
||||
+ /* Build the character list. */
|
||||
+ if (operating_mode != undefined_mode)
|
||||
+ FATAL_ERROR (_("only one type of list may be specified"));
|
||||
+ operating_mode = character_mode;
|
||||
+ spec_list_string = optarg;
|
||||
+ break;
|
||||
+
|
||||
case 'f':
|
||||
/* Build the field list. */
|
||||
if (operating_mode != undefined_mode)
|
||||
@@ -524,10 +885,38 @@ main (int argc, char **argv)
|
||||
case 'd':
|
||||
/* New delimiter. */
|
||||
/* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */
|
||||
- if (optarg[0] != '\0' && optarg[1] != '\0')
|
||||
- FATAL_ERROR (_("the delimiter must be a single character"));
|
||||
- delim = optarg[0];
|
||||
- delim_specified = true;
|
||||
+ {
|
||||
+#if HAVE_MBRTOWC
|
||||
+ if(MB_CUR_MAX > 1)
|
||||
+ {
|
||||
+ mbstate_t state;
|
||||
+
|
||||
+ memset (&state, '\0', sizeof(mbstate_t));
|
||||
+ delimlen = mbrtowc (&wcdelim, optarg, strnlen(optarg, MB_LEN_MAX), &state);
|
||||
+
|
||||
+ if (delimlen == (size_t)-1 || delimlen == (size_t)-2)
|
||||
+ ++force_singlebyte_mode;
|
||||
+ else
|
||||
+ {
|
||||
+ delimlen = (delimlen < 1) ? 1 : delimlen;
|
||||
+ if (wcdelim != L'\0' && *(optarg + delimlen) != '\0')
|
||||
+ FATAL_ERROR (_("the delimiter must be a single character"));
|
||||
+ memcpy (mbdelim, optarg, delimlen);
|
||||
+ mbdelim[delimlen] = '\0';
|
||||
+ if (delimlen == 1)
|
||||
+ delim = *optarg;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (MB_CUR_MAX <= 1 || force_singlebyte_mode)
|
||||
+#endif
|
||||
+ {
|
||||
+ if (optarg[0] != '\0' && optarg[1] != '\0')
|
||||
+ FATAL_ERROR (_("the delimiter must be a single character"));
|
||||
+ delim = (unsigned char) optarg[0];
|
||||
+ }
|
||||
+ delim_specified = true;
|
||||
+ }
|
||||
break;
|
||||
|
||||
case OUTPUT_DELIMITER_OPTION:
|
||||
@@ -540,6 +929,7 @@ main (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
+ byte_mode_character_aware = 1;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
@@ -579,15 +969,34 @@ main (int argc, char **argv)
|
||||
| (complement ? SETFLD_COMPLEMENT : 0) );
|
||||
|
||||
if (!delim_specified)
|
||||
- delim = '\t';
|
||||
+ {
|
||||
+ delim = '\t';
|
||||
+#ifdef HAVE_MBRTOWC
|
||||
+ wcdelim = L'\t';
|
||||
+ mbdelim[0] = '\t';
|
||||
+ mbdelim[1] = '\0';
|
||||
+ delimlen = 1;
|
||||
+#endif
|
||||
+ }
|
||||
|
||||
if (output_delimiter_string == NULL)
|
||||
{
|
||||
- static char dummy[2];
|
||||
- dummy[0] = delim;
|
||||
- dummy[1] = '\0';
|
||||
- output_delimiter_string = dummy;
|
||||
- output_delimiter_length = 1;
|
||||
+#ifdef HAVE_MBRTOWC
|
||||
+ if (MB_CUR_MAX > 1 && !force_singlebyte_mode)
|
||||
+ {
|
||||
+ output_delimiter_string = xstrdup(mbdelim);
|
||||
+ output_delimiter_length = delimlen;
|
||||
+ }
|
||||
+
|
||||
+ if (MB_CUR_MAX <= 1 || force_singlebyte_mode)
|
||||
+#endif
|
||||
+ {
|
||||
+ static char dummy[2];
|
||||
+ dummy[0] = delim;
|
||||
+ dummy[1] = '\0';
|
||||
+ output_delimiter_string = dummy;
|
||||
+ output_delimiter_length = 1;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (optind == argc)
|
848
SOURCES/coreutils-i18n-expand-unexpand.patch
Normal file
848
SOURCES/coreutils-i18n-expand-unexpand.patch
Normal file
@ -0,0 +1,848 @@
|
||||
From e87ab5b991b08092a7e07af82b3ec822a8604151 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Oprala <ooprala@redhat.com>
|
||||
Date: Wed, 5 Aug 2015 09:15:09 +0200
|
||||
Subject: [PATCH] expand,unexpand: add multibyte support
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
* NEWS: Mention the changes.
|
||||
* bootstrap.conf: Add mbfile to the list of modules.
|
||||
* configure.ac: Properly initialize mbfile.
|
||||
* src/expand.c (expand): Iterate over multibyte characters properly.
|
||||
* src/unexpand.c (unexpand): Iterate over multibyte characters
|
||||
properly.
|
||||
* tests/local.mk: Add new tests.
|
||||
* tests/{expand,unexpand}/mb.sh: New tests.
|
||||
|
||||
Co-authored-by: Pádraig Brady <pbrady@redhat.com>
|
||||
---
|
||||
bootstrap.conf | 1 +
|
||||
configure.ac | 2 +
|
||||
lib/mbfile.c | 3 +
|
||||
lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
m4/mbfile.m4 | 14 +++
|
||||
src/expand.c | 43 +++++----
|
||||
src/unexpand.c | 54 +++++++----
|
||||
tests/expand/mb.sh | 98 ++++++++++++++++++++
|
||||
tests/local.mk | 2 +
|
||||
tests/unexpand/mb.sh | 97 ++++++++++++++++++++
|
||||
10 files changed, 535 insertions(+), 34 deletions(-)
|
||||
create mode 100644 lib/mbfile.c
|
||||
create mode 100644 lib/mbfile.h
|
||||
create mode 100644 m4/mbfile.m4
|
||||
create mode 100755 tests/expand/mb.sh
|
||||
create mode 100755 tests/unexpand/mb.sh
|
||||
|
||||
diff --git a/bootstrap.conf b/bootstrap.conf
|
||||
index 8a0ff31..a1c78b2 100644
|
||||
--- a/bootstrap.conf
|
||||
+++ b/bootstrap.conf
|
||||
@@ -152,6 +152,7 @@ gnulib_modules="
|
||||
maintainer-makefile
|
||||
malloc-gnu
|
||||
manywarnings
|
||||
+ mbfile
|
||||
mbrlen
|
||||
mbrtowc
|
||||
mbsalign
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 1e74b36..24c9725 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -427,6 +427,8 @@ fi
|
||||
# I'm leaving it here for now. This whole thing needs to be modernized...
|
||||
gl_WINSIZE_IN_PTEM
|
||||
|
||||
+gl_MBFILE
|
||||
+
|
||||
gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
|
||||
|
||||
if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \
|
||||
diff --git a/lib/mbfile.c b/lib/mbfile.c
|
||||
new file mode 100644
|
||||
index 0000000..b0a468e
|
||||
--- /dev/null
|
||||
+++ b/lib/mbfile.c
|
||||
@@ -0,0 +1,3 @@
|
||||
+#include <config.h>
|
||||
+#define MBFILE_INLINE _GL_EXTERN_INLINE
|
||||
+#include "mbfile.h"
|
||||
diff --git a/lib/mbfile.h b/lib/mbfile.h
|
||||
new file mode 100644
|
||||
index 0000000..11f1b12
|
||||
--- /dev/null
|
||||
+++ b/lib/mbfile.h
|
||||
@@ -0,0 +1,255 @@
|
||||
+/* Multibyte character I/O: macros for multi-byte encodings.
|
||||
+ Copyright (C) 2001, 2005, 2009-2015 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 <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* Written by Mitsuru Chinen <mchinen@yamato.ibm.com>
|
||||
+ and Bruno Haible <bruno@clisp.org>. */
|
||||
+
|
||||
+/* The macros in this file implement multi-byte character input from a
|
||||
+ stream.
|
||||
+
|
||||
+ mb_file_t
|
||||
+ is the type for multibyte character input stream, usable for variable
|
||||
+ declarations.
|
||||
+
|
||||
+ mbf_char_t
|
||||
+ is the type for multibyte character or EOF, usable for variable
|
||||
+ declarations.
|
||||
+
|
||||
+ mbf_init (mbf, stream)
|
||||
+ initializes the MB_FILE for reading from stream.
|
||||
+
|
||||
+ mbf_getc (mbc, mbf)
|
||||
+ reads the next multibyte character from mbf and stores it in mbc.
|
||||
+
|
||||
+ mb_iseof (mbc)
|
||||
+ returns true if mbc represents the EOF value.
|
||||
+
|
||||
+ Here are the function prototypes of the macros.
|
||||
+
|
||||
+ extern void mbf_init (mb_file_t mbf, FILE *stream);
|
||||
+ extern void mbf_getc (mbf_char_t mbc, mb_file_t mbf);
|
||||
+ extern bool mb_iseof (const mbf_char_t mbc);
|
||||
+ */
|
||||
+
|
||||
+#ifndef _MBFILE_H
|
||||
+#define _MBFILE_H 1
|
||||
+
|
||||
+#include <assert.h>
|
||||
+#include <stdbool.h>
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
||||
+ <wchar.h>.
|
||||
+ BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
|
||||
+ <wchar.h>. */
|
||||
+#include <stdio.h>
|
||||
+#include <time.h>
|
||||
+#include <wchar.h>
|
||||
+
|
||||
+#include "mbchar.h"
|
||||
+
|
||||
+#ifndef _GL_INLINE_HEADER_BEGIN
|
||||
+ #error "Please include config.h first."
|
||||
+#endif
|
||||
+_GL_INLINE_HEADER_BEGIN
|
||||
+#ifndef MBFILE_INLINE
|
||||
+# define MBFILE_INLINE _GL_INLINE
|
||||
+#endif
|
||||
+
|
||||
+struct mbfile_multi {
|
||||
+ FILE *fp;
|
||||
+ bool eof_seen;
|
||||
+ bool have_pushback;
|
||||
+ mbstate_t state;
|
||||
+ unsigned int bufcount;
|
||||
+ char buf[MBCHAR_BUF_SIZE];
|
||||
+ struct mbchar pushback;
|
||||
+};
|
||||
+
|
||||
+MBFILE_INLINE void
|
||||
+mbfile_multi_getc (struct mbchar *mbc, struct mbfile_multi *mbf)
|
||||
+{
|
||||
+ size_t bytes;
|
||||
+
|
||||
+ /* If EOF has already been seen, don't use getc. This matters if
|
||||
+ mbf->fp is connected to an interactive tty. */
|
||||
+ if (mbf->eof_seen)
|
||||
+ goto eof;
|
||||
+
|
||||
+ /* Return character pushed back, if there is one. */
|
||||
+ if (mbf->have_pushback)
|
||||
+ {
|
||||
+ mb_copy (mbc, &mbf->pushback);
|
||||
+ mbf->have_pushback = false;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Before using mbrtowc, we need at least one byte. */
|
||||
+ if (mbf->bufcount == 0)
|
||||
+ {
|
||||
+ int c = getc (mbf->fp);
|
||||
+ if (c == EOF)
|
||||
+ {
|
||||
+ mbf->eof_seen = true;
|
||||
+ goto eof;
|
||||
+ }
|
||||
+ mbf->buf[0] = (unsigned char) c;
|
||||
+ mbf->bufcount++;
|
||||
+ }
|
||||
+
|
||||
+ /* Handle most ASCII characters quickly, without calling mbrtowc(). */
|
||||
+ if (mbf->bufcount == 1 && mbsinit (&mbf->state) && is_basic (mbf->buf[0]))
|
||||
+ {
|
||||
+ /* These characters are part of the basic character set. ISO C 99
|
||||
+ guarantees that their wide character code is identical to their
|
||||
+ char code. */
|
||||
+ mbc->wc = mbc->buf[0] = mbf->buf[0];
|
||||
+ mbc->wc_valid = true;
|
||||
+ mbc->ptr = &mbc->buf[0];
|
||||
+ mbc->bytes = 1;
|
||||
+ mbf->bufcount = 0;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Use mbrtowc on an increasing number of bytes. Read only as many bytes
|
||||
+ from mbf->fp as needed. This is needed to give reasonable interactive
|
||||
+ behaviour when mbf->fp is connected to an interactive tty. */
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ /* We don't know whether the 'mbrtowc' function updates the state when
|
||||
+ it returns -2, - this is the ISO C 99 and glibc-2.2 behaviour - or
|
||||
+ not - amended ANSI C, glibc-2.1 and Solaris 2.7 behaviour. We
|
||||
+ don't have an autoconf test for this, yet.
|
||||
+ The new behaviour would allow us to feed the bytes one by one into
|
||||
+ mbrtowc. But the old behaviour forces us to feed all bytes since
|
||||
+ the end of the last character into mbrtowc. Since we want to retry
|
||||
+ with more bytes when mbrtowc returns -2, we must backup the state
|
||||
+ before calling mbrtowc, because implementations with the new
|
||||
+ behaviour will clobber it. */
|
||||
+ mbstate_t backup_state = mbf->state;
|
||||
+
|
||||
+ bytes = mbrtowc (&mbc->wc, &mbf->buf[0], mbf->bufcount, &mbf->state);
|
||||
+
|
||||
+ if (bytes == (size_t) -1)
|
||||
+ {
|
||||
+ /* An invalid multibyte sequence was encountered. */
|
||||
+ /* Return a single byte. */
|
||||
+ bytes = 1;
|
||||
+ mbc->wc_valid = false;
|
||||
+ break;
|
||||
+ }
|
||||
+ else if (bytes == (size_t) -2)
|
||||
+ {
|
||||
+ /* An incomplete multibyte character. */
|
||||
+ mbf->state = backup_state;
|
||||
+ if (mbf->bufcount == MBCHAR_BUF_SIZE)
|
||||
+ {
|
||||
+ /* An overlong incomplete multibyte sequence was encountered. */
|
||||
+ /* Return a single byte. */
|
||||
+ bytes = 1;
|
||||
+ mbc->wc_valid = false;
|
||||
+ break;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* Read one more byte and retry mbrtowc. */
|
||||
+ int c = getc (mbf->fp);
|
||||
+ if (c == EOF)
|
||||
+ {
|
||||
+ /* An incomplete multibyte character at the end. */
|
||||
+ mbf->eof_seen = true;
|
||||
+ bytes = mbf->bufcount;
|
||||
+ mbc->wc_valid = false;
|
||||
+ break;
|
||||
+ }
|
||||
+ mbf->buf[mbf->bufcount] = (unsigned char) c;
|
||||
+ mbf->bufcount++;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (bytes == 0)
|
||||
+ {
|
||||
+ /* A null wide character was encountered. */
|
||||
+ bytes = 1;
|
||||
+ assert (mbf->buf[0] == '\0');
|
||||
+ assert (mbc->wc == 0);
|
||||
+ }
|
||||
+ mbc->wc_valid = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Return the multibyte sequence mbf->buf[0..bytes-1]. */
|
||||
+ mbc->ptr = &mbc->buf[0];
|
||||
+ memcpy (&mbc->buf[0], &mbf->buf[0], bytes);
|
||||
+ mbc->bytes = bytes;
|
||||
+
|
||||
+ mbf->bufcount -= bytes;
|
||||
+ if (mbf->bufcount > 0)
|
||||
+ {
|
||||
+ /* It's not worth calling memmove() for so few bytes. */
|
||||
+ unsigned int count = mbf->bufcount;
|
||||
+ char *p = &mbf->buf[0];
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ *p = *(p + bytes);
|
||||
+ p++;
|
||||
+ }
|
||||
+ while (--count > 0);
|
||||
+ }
|
||||
+ return;
|
||||
+
|
||||
+eof:
|
||||
+ /* An mbchar_t with bytes == 0 is used to indicate EOF. */
|
||||
+ mbc->ptr = NULL;
|
||||
+ mbc->bytes = 0;
|
||||
+ mbc->wc_valid = false;
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+MBFILE_INLINE void
|
||||
+mbfile_multi_ungetc (const struct mbchar *mbc, struct mbfile_multi *mbf)
|
||||
+{
|
||||
+ mb_copy (&mbf->pushback, mbc);
|
||||
+ mbf->have_pushback = true;
|
||||
+}
|
||||
+
|
||||
+typedef struct mbfile_multi mb_file_t;
|
||||
+
|
||||
+typedef mbchar_t mbf_char_t;
|
||||
+
|
||||
+#define mbf_init(mbf, stream) \
|
||||
+ ((mbf).fp = (stream), \
|
||||
+ (mbf).eof_seen = false, \
|
||||
+ (mbf).have_pushback = false, \
|
||||
+ memset (&(mbf).state, '\0', sizeof (mbstate_t)), \
|
||||
+ (mbf).bufcount = 0)
|
||||
+
|
||||
+#define mbf_getc(mbc, mbf) mbfile_multi_getc (&(mbc), &(mbf))
|
||||
+
|
||||
+#define mbf_ungetc(mbc, mbf) mbfile_multi_ungetc (&(mbc), &(mbf))
|
||||
+
|
||||
+#define mb_iseof(mbc) ((mbc).bytes == 0)
|
||||
+
|
||||
+#ifndef _GL_INLINE_HEADER_BEGIN
|
||||
+ #error "Please include config.h first."
|
||||
+#endif
|
||||
+_GL_INLINE_HEADER_BEGIN
|
||||
+
|
||||
+#endif /* _MBFILE_H */
|
||||
diff --git a/m4/mbfile.m4 b/m4/mbfile.m4
|
||||
new file mode 100644
|
||||
index 0000000..8589902
|
||||
--- /dev/null
|
||||
+++ b/m4/mbfile.m4
|
||||
@@ -0,0 +1,14 @@
|
||||
+# mbfile.m4 serial 7
|
||||
+dnl Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc.
|
||||
+dnl This file is free software; the Free Software Foundation
|
||||
+dnl gives unlimited permission to copy and/or distribute it,
|
||||
+dnl with or without modifications, as long as this notice is preserved.
|
||||
+
|
||||
+dnl autoconf tests required for use of mbfile.h
|
||||
+dnl From Bruno Haible.
|
||||
+
|
||||
+AC_DEFUN([gl_MBFILE],
|
||||
+[
|
||||
+ AC_REQUIRE([AC_TYPE_MBSTATE_T])
|
||||
+ :
|
||||
+])
|
||||
diff --git a/src/expand.c b/src/expand.c
|
||||
index 9fa2e10..380e020 100644
|
||||
--- a/src/expand.c
|
||||
+++ b/src/expand.c
|
||||
@@ -37,6 +37,9 @@
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
+
|
||||
+#include <mbfile.h>
|
||||
+
|
||||
#include "system.h"
|
||||
#include "die.h"
|
||||
#include "xstrndup.h"
|
||||
@@ -100,19 +103,19 @@ expand (void)
|
||||
{
|
||||
/* Input stream. */
|
||||
FILE *fp = next_file (NULL);
|
||||
+ mb_file_t mbf;
|
||||
+ mbf_char_t c;
|
||||
|
||||
if (!fp)
|
||||
return;
|
||||
|
||||
+ mbf_init (mbf, fp);
|
||||
+
|
||||
while (true)
|
||||
{
|
||||
- /* Input character, or EOF. */
|
||||
- int c;
|
||||
-
|
||||
/* If true, perform translations. */
|
||||
bool convert = true;
|
||||
|
||||
-
|
||||
/* The following variables have valid values only when CONVERT
|
||||
is true: */
|
||||
|
||||
@@ -122,17 +125,23 @@ expand (void)
|
||||
/* Index in TAB_LIST of next tab stop to examine. */
|
||||
size_t tab_index = 0;
|
||||
|
||||
-
|
||||
/* Convert a line of text. */
|
||||
|
||||
do
|
||||
{
|
||||
- while ((c = getc (fp)) < 0 && (fp = next_file (fp)))
|
||||
- continue;
|
||||
+ do {
|
||||
+ mbf_getc (c, mbf);
|
||||
+ if (mb_iseof (c))
|
||||
+ {
|
||||
+ mbf_init (mbf, fp = next_file (fp));
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ while (false);
|
||||
|
||||
if (convert)
|
||||
{
|
||||
- if (c == '\t')
|
||||
+ if (mb_iseq (c, '\t'))
|
||||
{
|
||||
/* Column the next input tab stop is on. */
|
||||
uintmax_t next_tab_column;
|
||||
@@ -151,32 +160,34 @@ expand (void)
|
||||
if (putchar (' ') < 0)
|
||||
die (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
- c = ' ';
|
||||
+ mb_setascii (&c, ' ');
|
||||
}
|
||||
- else if (c == '\b')
|
||||
+ else if (mb_iseq (c, '\b'))
|
||||
{
|
||||
/* Go back one column, and force recalculation of the
|
||||
next tab stop. */
|
||||
column -= !!column;
|
||||
tab_index -= !!tab_index;
|
||||
}
|
||||
- else
|
||||
+ /* A leading control character could make us trip over. */
|
||||
+ else if (!mb_iscntrl (c))
|
||||
{
|
||||
- column++;
|
||||
+ column += mb_width (c);
|
||||
if (!column)
|
||||
die (EXIT_FAILURE, 0, _("input line is too long"));
|
||||
}
|
||||
|
||||
- convert &= convert_entire_line || !! isblank (c);
|
||||
+ convert &= convert_entire_line || mb_isblank (c);
|
||||
}
|
||||
|
||||
- if (c < 0)
|
||||
+ if (mb_iseof (c))
|
||||
return;
|
||||
|
||||
- if (putchar (c) < 0)
|
||||
+ mb_putc (c, stdout);
|
||||
+ if (ferror (stdout))
|
||||
die (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
- while (c != '\n');
|
||||
+ while (!mb_iseq (c, '\n'));
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/unexpand.c b/src/unexpand.c
|
||||
index 7801274..569a7ee 100644
|
||||
--- a/src/unexpand.c
|
||||
+++ b/src/unexpand.c
|
||||
@@ -38,6 +38,9 @@
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
+
|
||||
+#include <mbfile.h>
|
||||
+
|
||||
#include "system.h"
|
||||
#include "die.h"
|
||||
#include "xstrndup.h"
|
||||
@@ -107,11 +110,12 @@ unexpand (void)
|
||||
{
|
||||
/* Input stream. */
|
||||
FILE *fp = next_file (NULL);
|
||||
+ mb_file_t mbf;
|
||||
|
||||
/* The array of pending blanks. In non-POSIX locales, blanks can
|
||||
include characters other than spaces, so the blanks must be
|
||||
stored, not merely counted. */
|
||||
- char *pending_blank;
|
||||
+ mbf_char_t *pending_blank;
|
||||
|
||||
if (!fp)
|
||||
return;
|
||||
@@ -119,12 +123,14 @@ unexpand (void)
|
||||
/* The worst case is a non-blank character, then one blank, then a
|
||||
tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
|
||||
allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
|
||||
- pending_blank = xmalloc (max_column_width);
|
||||
+ pending_blank = xmalloc (max_column_width * sizeof (mbf_char_t));
|
||||
+
|
||||
+ mbf_init (mbf, fp);
|
||||
|
||||
while (true)
|
||||
{
|
||||
/* Input character, or EOF. */
|
||||
- int c;
|
||||
+ mbf_char_t c;
|
||||
|
||||
/* If true, perform translations. */
|
||||
bool convert = true;
|
||||
@@ -158,12 +164,19 @@ unexpand (void)
|
||||
|
||||
do
|
||||
{
|
||||
- while ((c = getc (fp)) < 0 && (fp = next_file (fp)))
|
||||
- continue;
|
||||
+ do {
|
||||
+ mbf_getc (c, mbf);
|
||||
+ if (mb_iseof (c))
|
||||
+ {
|
||||
+ mbf_init (mbf, fp = next_file (fp));
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ while (false);
|
||||
|
||||
if (convert)
|
||||
{
|
||||
- bool blank = !! isblank (c);
|
||||
+ bool blank = mb_isblank (c);
|
||||
|
||||
if (blank)
|
||||
{
|
||||
@@ -180,16 +193,16 @@ unexpand (void)
|
||||
if (next_tab_column < column)
|
||||
die (EXIT_FAILURE, 0, _("input line is too long"));
|
||||
|
||||
- if (c == '\t')
|
||||
+ if (mb_iseq (c, '\t'))
|
||||
{
|
||||
column = next_tab_column;
|
||||
|
||||
if (pending)
|
||||
- pending_blank[0] = '\t';
|
||||
+ mb_setascii (&pending_blank[0], '\t');
|
||||
}
|
||||
else
|
||||
{
|
||||
- column++;
|
||||
+ column += mb_width (c);
|
||||
|
||||
if (! (prev_blank && column == next_tab_column))
|
||||
{
|
||||
@@ -197,13 +210,14 @@ unexpand (void)
|
||||
will be replaced by tabs. */
|
||||
if (column == next_tab_column)
|
||||
one_blank_before_tab_stop = true;
|
||||
- pending_blank[pending++] = c;
|
||||
+ mb_copy (&pending_blank[pending++], &c);
|
||||
prev_blank = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Replace the pending blanks by a tab or two. */
|
||||
- pending_blank[0] = c = '\t';
|
||||
+ mb_setascii (&c, '\t');
|
||||
+ mb_setascii (&pending_blank[0], '\t');
|
||||
}
|
||||
|
||||
/* Discard pending blanks, unless it was a single
|
||||
@@ -211,7 +225,7 @@ unexpand (void)
|
||||
pending = one_blank_before_tab_stop;
|
||||
}
|
||||
}
|
||||
- else if (c == '\b')
|
||||
+ else if (mb_iseq (c, '\b'))
|
||||
{
|
||||
/* Go back one column, and force recalculation of the
|
||||
next tab stop. */
|
||||
@@ -221,7 +235,7 @@ unexpand (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
- column++;
|
||||
+ column += mb_width (c);
|
||||
if (!column)
|
||||
die (EXIT_FAILURE, 0, _("input line is too long"));
|
||||
}
|
||||
@@ -229,8 +243,11 @@ unexpand (void)
|
||||
if (pending)
|
||||
{
|
||||
if (pending > 1 && one_blank_before_tab_stop)
|
||||
- pending_blank[0] = '\t';
|
||||
- if (fwrite (pending_blank, 1, pending, stdout) != pending)
|
||||
+ mb_setascii (&pending_blank[0], '\t');
|
||||
+
|
||||
+ for (int n = 0; n < pending; ++n)
|
||||
+ mb_putc (pending_blank[n], stdout);
|
||||
+ if (ferror (stdout))
|
||||
die (EXIT_FAILURE, errno, _("write error"));
|
||||
pending = 0;
|
||||
one_blank_before_tab_stop = false;
|
||||
@@ -240,16 +257,17 @@ unexpand (void)
|
||||
convert &= convert_entire_line || blank;
|
||||
}
|
||||
|
||||
- if (c < 0)
|
||||
+ if (mb_iseof (c))
|
||||
{
|
||||
free (pending_blank);
|
||||
return;
|
||||
}
|
||||
|
||||
- if (putchar (c) < 0)
|
||||
+ mb_putc (c, stdout);
|
||||
+ if (ferror (stdout))
|
||||
die (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
- while (c != '\n');
|
||||
+ while (!mb_iseq (c, '\n'));
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
|
||||
new file mode 100755
|
||||
index 0000000..7971e18
|
||||
--- /dev/null
|
||||
+++ b/tests/expand/mb.sh
|
||||
@@ -0,0 +1,98 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+# Copyright (C) 2012-2015 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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
+print_ver_ expand
|
||||
+
|
||||
+export LC_ALL=en_US.UTF-8
|
||||
+
|
||||
+#input containing multibyte characters
|
||||
+cat <<\EOF > in || framework_failure_
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+EOF
|
||||
+env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_
|
||||
+
|
||||
+cat <<\EOF > exp || framework_failure_
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+EOF
|
||||
+
|
||||
+expand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+#test characters with display widths != 1
|
||||
+env printf '12345678
|
||||
+e\t|ascii(1)
|
||||
+\u00E9\t|composed(1)
|
||||
+e\u0301\t|decomposed(1)
|
||||
+\u3000\t|ideo-space(2)
|
||||
+\uFF0D\t|full-hypen(2)
|
||||
+' > in || framework_failure_
|
||||
+
|
||||
+env printf '12345678
|
||||
+e |ascii(1)
|
||||
+\u00E9 |composed(1)
|
||||
+e\u0301 |decomposed(1)
|
||||
+\u3000 |ideo-space(2)
|
||||
+\uFF0D |full-hypen(2)
|
||||
+' > exp || framework_failure_
|
||||
+
|
||||
+expand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+#shouldn't fail with "input line too long"
|
||||
+#when a line starts with a control character
|
||||
+env printf '\n' > in || framework_failure_
|
||||
+
|
||||
+expand < in > out || fail=1
|
||||
+compare in out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+#non-Unicode characters interspersed between Unicode ones
|
||||
+env printf '12345678
|
||||
+\t\xFF|
|
||||
+\xFF\t|
|
||||
+\t\xFFä|
|
||||
+ä\xFF\t|
|
||||
+\tä\xFF|
|
||||
+\xFF\tä|
|
||||
+äbcdef\xFF\t|
|
||||
+' > in || framework_failure_
|
||||
+
|
||||
+env printf '12345678
|
||||
+ \xFF|
|
||||
+\xFF |
|
||||
+ \xFFä|
|
||||
+ä\xFF |
|
||||
+ ä\xFF|
|
||||
+\xFF ä|
|
||||
+äbcdef\xFF |
|
||||
+' > exp || framework_failure_
|
||||
+
|
||||
+expand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+exit $fail
|
||||
diff --git a/tests/local.mk b/tests/local.mk
|
||||
index 192f776..8053397 100644
|
||||
--- a/tests/local.mk
|
||||
+++ b/tests/local.mk
|
||||
@@ -544,6 +544,7 @@ all_tests = \
|
||||
tests/du/threshold.sh \
|
||||
tests/du/trailing-slash.sh \
|
||||
tests/du/two-args.sh \
|
||||
+ tests/expand/mb.sh \
|
||||
tests/id/gnu-zero-uids.sh \
|
||||
tests/id/no-context.sh \
|
||||
tests/id/context.sh \
|
||||
@@ -684,6 +685,7 @@ all_tests = \
|
||||
tests/touch/read-only.sh \
|
||||
tests/touch/relative.sh \
|
||||
tests/touch/trailing-slash.sh \
|
||||
+ tests/unexpand/mb.sh \
|
||||
$(all_root_tests)
|
||||
|
||||
# See tests/factor/create-test.sh.
|
||||
diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
|
||||
new file mode 100755
|
||||
index 0000000..60d4c1a
|
||||
--- /dev/null
|
||||
+++ b/tests/unexpand/mb.sh
|
||||
@@ -0,0 +1,97 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+# Copyright (C) 2012-2015 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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
+print_ver_ unexpand
|
||||
+
|
||||
+export LC_ALL=en_US.UTF-8
|
||||
+
|
||||
+#input containing multibyte characters
|
||||
+cat > in <<\EOF
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+EOF
|
||||
+
|
||||
+cat > exp <<\EOF
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+EOF
|
||||
+
|
||||
+unexpand -a < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+#test characters with a display width larger than 1
|
||||
+
|
||||
+env printf '12345678
|
||||
+e |ascii(1)
|
||||
+\u00E9 |composed(1)
|
||||
+e\u0301 |decomposed(1)
|
||||
+\u3000 |ideo-space(2)
|
||||
+\uFF0D |full-hypen(2)
|
||||
+' > in || framework_failure_
|
||||
+
|
||||
+env printf '12345678
|
||||
+e\t|ascii(1)
|
||||
+\u00E9\t|composed(1)
|
||||
+e\u0301\t|decomposed(1)
|
||||
+\u3000\t|ideo-space(2)
|
||||
+\uFF0D\t|full-hypen(2)
|
||||
+' > exp || framework_failure_
|
||||
+
|
||||
+unexpand -a < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+#test input where a blank of width > 1 is not being substituted
|
||||
+in="$(LC_ALL=en_US.UTF-8 printf ' \u3000 ö ü ß')"
|
||||
+exp=' ö ü ß'
|
||||
+
|
||||
+unexpand -a < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+#non-Unicode characters interspersed between Unicode ones
|
||||
+env printf '12345678
|
||||
+ \xFF|
|
||||
+\xFF |
|
||||
+ \xFFä|
|
||||
+ä\xFF |
|
||||
+ ä\xFF|
|
||||
+\xFF ä|
|
||||
+äbcdef\xFF |
|
||||
+' > in || framework_failure_
|
||||
+
|
||||
+env printf '12345678
|
||||
+\t\xFF|
|
||||
+\xFF\t|
|
||||
+\t\xFFä|
|
||||
+ä\xFF\t|
|
||||
+\tä\xFF|
|
||||
+\xFF\tä|
|
||||
+äbcdef\xFF\t|
|
||||
+' > exp || framework_failure_
|
||||
+
|
||||
+unexpand -a < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
--
|
||||
2.7.4
|
||||
|
28
SOURCES/coreutils-i18n-fix-unexpand.patch
Normal file
28
SOURCES/coreutils-i18n-fix-unexpand.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From 02424bfcd719bbaa695f4e1c3ef17ad91b0d23c0 Mon Sep 17 00:00:00 2001
|
||||
From: Lubomir Rintel <lkundrak@v3.sk>
|
||||
Date: Thu, 28 Jan 2016 20:57:22 +0100
|
||||
Subject: [PATCH] unexpand: fix blank line handling
|
||||
|
||||
echo '' |./src/unexpand -a
|
||||
|
||||
Really?
|
||||
---
|
||||
src/unexpand.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/unexpand.c b/src/unexpand.c
|
||||
index 569a7ee..3bbbd66 100644
|
||||
--- a/src/unexpand.c
|
||||
+++ b/src/unexpand.c
|
||||
@@ -233,7 +233,7 @@ unexpand (void)
|
||||
next_tab_column = column;
|
||||
tab_index -= !!tab_index;
|
||||
}
|
||||
- else
|
||||
+ else if (!mb_iseq (c, '\n'))
|
||||
{
|
||||
column += mb_width (c);
|
||||
if (!column)
|
||||
--
|
||||
2.7.4
|
||||
|
108
SOURCES/coreutils-i18n-fix2-expand-unexpand.patch
Normal file
108
SOURCES/coreutils-i18n-fix2-expand-unexpand.patch
Normal file
@ -0,0 +1,108 @@
|
||||
diff --git a/src/expand.c b/src/expand.c
|
||||
index 380e020..310b349 100644
|
||||
--- a/src/expand.c
|
||||
+++ b/src/expand.c
|
||||
@@ -129,15 +129,19 @@ expand (void)
|
||||
|
||||
do
|
||||
{
|
||||
- do {
|
||||
+ while (true) {
|
||||
mbf_getc (c, mbf);
|
||||
- if (mb_iseof (c))
|
||||
+ if ((mb_iseof (c)) && (fp = next_file (fp)))
|
||||
{
|
||||
- mbf_init (mbf, fp = next_file (fp));
|
||||
+ mbf_init (mbf, fp);
|
||||
continue;
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
- while (false);
|
||||
+
|
||||
|
||||
if (convert)
|
||||
{
|
||||
diff --git a/src/unexpand.c b/src/unexpand.c
|
||||
index 3bbbd66..863a90a 100644
|
||||
--- a/src/unexpand.c
|
||||
+++ b/src/unexpand.c
|
||||
@@ -164,15 +164,19 @@ unexpand (void)
|
||||
|
||||
do
|
||||
{
|
||||
- do {
|
||||
+ while (true) {
|
||||
mbf_getc (c, mbf);
|
||||
- if (mb_iseof (c))
|
||||
+ if ((mb_iseof (c)) && (fp = next_file (fp)))
|
||||
{
|
||||
- mbf_init (mbf, fp = next_file (fp));
|
||||
+ mbf_init (mbf, fp);
|
||||
continue;
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
- while (false);
|
||||
+
|
||||
|
||||
if (convert)
|
||||
{
|
||||
diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
|
||||
index 7971e18..031be7a 100755
|
||||
--- a/tests/expand/mb.sh
|
||||
+++ b/tests/expand/mb.sh
|
||||
@@ -44,6 +44,20 @@ EOF
|
||||
expand < in > out || fail=1
|
||||
compare exp out > /dev/null 2>&1 || fail=1
|
||||
|
||||
+#multiple files as an input
|
||||
+cat <<\EOF >> exp || framework_failure_
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+EOF
|
||||
+
|
||||
+expand ./in ./in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
#test characters with display widths != 1
|
||||
env printf '12345678
|
||||
e\t|ascii(1)
|
||||
diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
|
||||
index 60d4c1a..8d75652 100755
|
||||
--- a/tests/unexpand/mb.sh
|
||||
+++ b/tests/unexpand/mb.sh
|
||||
@@ -44,6 +44,22 @@ EOF
|
||||
unexpand -a < in > out || fail=1
|
||||
compare exp out > /dev/null 2>&1 || fail=1
|
||||
|
||||
+
|
||||
+#multiple files as an input
|
||||
+cat >> exp <<\EOF
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+EOF
|
||||
+
|
||||
+
|
||||
+unexpand -a ./in ./in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
#test characters with a display width larger than 1
|
||||
|
||||
env printf '12345678
|
80
SOURCES/coreutils-i18n-fold-newline.patch
Normal file
80
SOURCES/coreutils-i18n-fold-newline.patch
Normal file
@ -0,0 +1,80 @@
|
||||
From ff424639fe863cbd6963add1a79b97290c1606c6 Mon Sep 17 00:00:00 2001
|
||||
From: rpm-build <rpm-build>
|
||||
Date: Fri, 3 Feb 2017 12:26:53 +0100
|
||||
Subject: [PATCH] fold.c: preserve new-lines in mutlibyte text
|
||||
|
||||
---
|
||||
src/fold.c | 49 ++++++++++++++++++++++++-------------------------
|
||||
1 file changed, 24 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/src/fold.c b/src/fold.c
|
||||
index d23edd5..8c232a7 100644
|
||||
--- a/src/fold.c
|
||||
+++ b/src/fold.c
|
||||
@@ -342,39 +342,38 @@ fold_multibyte_text (FILE *istream, size_t width, int *saved_errno)
|
||||
}
|
||||
|
||||
rescan:
|
||||
- if (operating_mode == byte_mode) /* byte mode */
|
||||
+ if (convfail)
|
||||
+ increment = 1;
|
||||
+ else if (wc == L'\n')
|
||||
+ {
|
||||
+ /* preserve newline */
|
||||
+ fwrite (line_out, sizeof(char), offset_out, stdout);
|
||||
+ START_NEW_LINE;
|
||||
+ continue;
|
||||
+ }
|
||||
+ else if (operating_mode == byte_mode) /* byte mode */
|
||||
increment = mblength;
|
||||
else if (operating_mode == character_mode) /* character mode */
|
||||
increment = 1;
|
||||
- else /* column mode */
|
||||
+ else /* column mode */
|
||||
{
|
||||
- if (convfail)
|
||||
- increment = 1;
|
||||
- else
|
||||
+ switch (wc)
|
||||
{
|
||||
- switch (wc)
|
||||
- {
|
||||
- case L'\n':
|
||||
- fwrite (line_out, sizeof(char), offset_out, stdout);
|
||||
- START_NEW_LINE;
|
||||
- continue;
|
||||
+ case L'\b':
|
||||
+ increment = (column > 0) ? -1 : 0;
|
||||
+ break;
|
||||
|
||||
- case L'\b':
|
||||
- increment = (column > 0) ? -1 : 0;
|
||||
- break;
|
||||
+ case L'\r':
|
||||
+ increment = -1 * column;
|
||||
+ break;
|
||||
|
||||
- case L'\r':
|
||||
- increment = -1 * column;
|
||||
- break;
|
||||
+ case L'\t':
|
||||
+ increment = 8 - column % 8;
|
||||
+ break;
|
||||
|
||||
- case L'\t':
|
||||
- increment = 8 - column % 8;
|
||||
- break;
|
||||
-
|
||||
- default:
|
||||
- increment = wcwidth (wc);
|
||||
- increment = (increment < 0) ? 0 : increment;
|
||||
- }
|
||||
+ default:
|
||||
+ increment = wcwidth (wc);
|
||||
+ increment = (increment < 0) ? 0 : increment;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
35
SOURCES/coreutils-i18n-sort-human.patch
Normal file
35
SOURCES/coreutils-i18n-sort-human.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 3976ef5a20369d8b490907ab2cba2d617305a5e0 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Mon, 30 May 2016 16:19:20 +0200
|
||||
Subject: [PATCH] sort: do not use static array 'blanks' in human_numcompare()
|
||||
|
||||
... because the array is not initialized with MB locales. Note this is
|
||||
rather a conservative fix. I plan to do more cleanup of the i18n patch
|
||||
in Fedora to prevent mistakes like this in future updates of coreutils.
|
||||
---
|
||||
src/sort.c | 8 +++-----
|
||||
1 file changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/sort.c b/src/sort.c
|
||||
index 9e07ad8..e47b039 100644
|
||||
--- a/src/sort.c
|
||||
+++ b/src/sort.c
|
||||
@@ -2304,12 +2304,10 @@ find_unit_order (char const *number)
|
||||
<none/unknown> < K/k < M < G < T < P < E < Z < Y */
|
||||
|
||||
static int
|
||||
-human_numcompare (char const *a, char const *b)
|
||||
+human_numcompare (char *a, char *b)
|
||||
{
|
||||
- while (blanks[to_uchar (*a)])
|
||||
- a++;
|
||||
- while (blanks[to_uchar (*b)])
|
||||
- b++;
|
||||
+ skipblanks(&a, a + strlen(a));
|
||||
+ skipblanks(&b, b + strlen(b));
|
||||
|
||||
int diff = find_unit_order (a) - find_unit_order (b);
|
||||
return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep));
|
||||
--
|
||||
2.5.5
|
||||
|
456
SOURCES/coreutils-i18n-un-expand-BOM.patch
Normal file
456
SOURCES/coreutils-i18n-un-expand-BOM.patch
Normal file
@ -0,0 +1,456 @@
|
||||
From 7a7c776a4e228d180e74614fd8c8afcad5d4bdf7 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Martisko <jamartis@redhat.com>
|
||||
Date: Thu, 7 Jul 2016 12:53:26 +0200
|
||||
Subject: [PATCH] coreutils-i18n-un-expand-BOM.patch
|
||||
|
||||
---
|
||||
src/expand-common.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/expand-common.h | 12 ++++++
|
||||
src/expand.c | 45 +++++++++++++++++++-
|
||||
src/unexpand.c | 43 ++++++++++++++++++-
|
||||
tests/expand/mb.sh | 71 ++++++++++++++++++++++++++++++++
|
||||
tests/unexpand/mb.sh | 59 ++++++++++++++++++++++++++
|
||||
6 files changed, 342 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/expand-common.c b/src/expand-common.c
|
||||
index 4657e46..97cbb09 100644
|
||||
--- a/src/expand-common.c
|
||||
+++ b/src/expand-common.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
+#include <mbfile.h>
|
||||
#include "system.h"
|
||||
#include "die.h"
|
||||
#include "error.h"
|
||||
@@ -126,6 +127,119 @@ set_increment_size (uintmax_t tabval)
|
||||
return ok;
|
||||
}
|
||||
|
||||
+extern int
|
||||
+set_utf_locale (void)
|
||||
+{
|
||||
+ /*try using some predefined locale */
|
||||
+ const char* predef_locales[] = {"C.UTF8","en_US.UTF8","en_GB.UTF8"};
|
||||
+
|
||||
+ const int predef_locales_count=3;
|
||||
+ for (int i=0;i<predef_locales_count;i++)
|
||||
+ {
|
||||
+ if (setlocale(LC_ALL,predef_locales[i])!=NULL)
|
||||
+ {
|
||||
+ break;
|
||||
+ }
|
||||
+ else if (i==predef_locales_count-1)
|
||||
+ {
|
||||
+ return 1;
|
||||
+ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale"));
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+extern bool
|
||||
+check_utf_locale(void)
|
||||
+{
|
||||
+ char* locale = setlocale (LC_CTYPE , NULL);
|
||||
+ if (locale == NULL)
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+ else if (strcasestr(locale, "utf8") == NULL && strcasestr(locale, "utf-8") == NULL)
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+extern bool
|
||||
+check_bom(FILE* fp, mb_file_t *mbf)
|
||||
+{
|
||||
+ int c;
|
||||
+
|
||||
+
|
||||
+ c=fgetc(fp);
|
||||
+
|
||||
+ /*test BOM header of the first file */
|
||||
+ mbf->bufcount=0;
|
||||
+ if (c == 0xEF)
|
||||
+ {
|
||||
+ c=fgetc(fp);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (c != EOF)
|
||||
+ {
|
||||
+ ungetc(c,fp);
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (c == 0xBB)
|
||||
+ {
|
||||
+ c=fgetc(fp);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if ( c!= EOF )
|
||||
+ {
|
||||
+ mbf->buf[0]=(unsigned char) 0xEF;
|
||||
+ mbf->bufcount=1;
|
||||
+ ungetc(c,fp);
|
||||
+ return false;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ ungetc(0xEF,fp);
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ if (c == 0xBF)
|
||||
+ {
|
||||
+ mbf->bufcount=0;
|
||||
+ return true;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (c != EOF)
|
||||
+ {
|
||||
+ mbf->buf[0]=(unsigned char) 0xEF;
|
||||
+ mbf->buf[1]=(unsigned char) 0xBB;
|
||||
+ mbf->bufcount=2;
|
||||
+ ungetc(c,fp);
|
||||
+ return false;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ mbf->buf[0]=(unsigned char) 0xEF;
|
||||
+ mbf->bufcount=1;
|
||||
+ ungetc(0xBB,fp);
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+extern void
|
||||
+print_bom(void)
|
||||
+{
|
||||
+ putc (0xEF, stdout);
|
||||
+ putc (0xBB, stdout);
|
||||
+ putc (0xBF, stdout);
|
||||
+}
|
||||
+
|
||||
/* Add the comma or blank separated list of tab stops STOPS
|
||||
to the list of tab stops. */
|
||||
extern void
|
||||
diff --git a/src/expand-common.h b/src/expand-common.h
|
||||
index 8cb2079..763bfda 100644
|
||||
--- a/src/expand-common.h
|
||||
+++ b/src/expand-common.h
|
||||
@@ -34,6 +34,18 @@ extern size_t max_column_width;
|
||||
/* The desired exit status. */
|
||||
extern int exit_status;
|
||||
|
||||
+extern int
|
||||
+set_utf_locale (void);
|
||||
+
|
||||
+extern bool
|
||||
+check_utf_locale(void);
|
||||
+
|
||||
+extern bool
|
||||
+check_bom(FILE* fp, mb_file_t *mbf);
|
||||
+
|
||||
+extern void
|
||||
+print_bom(void);
|
||||
+
|
||||
/* Add tab stop TABVAL to the end of 'tab_list'. */
|
||||
extern void
|
||||
add_tab_stop (uintmax_t tabval);
|
||||
diff --git a/src/expand.c b/src/expand.c
|
||||
index 310b349..4136824 100644
|
||||
--- a/src/expand.c
|
||||
+++ b/src/expand.c
|
||||
@@ -103,11 +103,33 @@ expand (void)
|
||||
FILE *fp = next_file (NULL);
|
||||
mb_file_t mbf;
|
||||
mbf_char_t c;
|
||||
+ /* True if the starting locale is utf8. */
|
||||
+ bool using_utf_locale;
|
||||
+
|
||||
+ /* True if the first file contains BOM header. */
|
||||
+ bool found_bom;
|
||||
+ using_utf_locale=check_utf_locale();
|
||||
|
||||
if (!fp)
|
||||
return;
|
||||
-
|
||||
mbf_init (mbf, fp);
|
||||
+ found_bom=check_bom(fp,&mbf);
|
||||
+
|
||||
+ if (using_utf_locale == false && found_bom == true)
|
||||
+ {
|
||||
+ /*try using some predefined locale */
|
||||
+
|
||||
+ if (set_utf_locale () != 0)
|
||||
+ {
|
||||
+ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale"));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ if (found_bom == true)
|
||||
+ {
|
||||
+ print_bom();
|
||||
+ }
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -132,6 +154,27 @@ expand (void)
|
||||
if ((mb_iseof (c)) && (fp = next_file (fp)))
|
||||
{
|
||||
mbf_init (mbf, fp);
|
||||
+ if (fp!=NULL)
|
||||
+ {
|
||||
+ if (check_bom(fp,&mbf)==true)
|
||||
+ {
|
||||
+ /*Not the first file - check BOM header*/
|
||||
+ if (using_utf_locale==false && found_bom==false)
|
||||
+ {
|
||||
+ /*BOM header in subsequent file but not in the first one. */
|
||||
+ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if(using_utf_locale==false && found_bom==true)
|
||||
+ {
|
||||
+ /*First file conatined BOM header - locale was switched to UTF
|
||||
+ *all subsequent files should contain BOM. */
|
||||
+ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
continue;
|
||||
}
|
||||
else
|
||||
diff --git a/src/unexpand.c b/src/unexpand.c
|
||||
index 863a90a..5681b58 100644
|
||||
--- a/src/unexpand.c
|
||||
+++ b/src/unexpand.c
|
||||
@@ -116,16 +116,36 @@ unexpand (void)
|
||||
include characters other than spaces, so the blanks must be
|
||||
stored, not merely counted. */
|
||||
mbf_char_t *pending_blank;
|
||||
+ /* True if the starting locale is utf8. */
|
||||
+ bool using_utf_locale;
|
||||
+
|
||||
+ /* True if the first file contains BOM header. */
|
||||
+ bool found_bom;
|
||||
+ using_utf_locale=check_utf_locale();
|
||||
|
||||
if (!fp)
|
||||
return;
|
||||
+ mbf_init (mbf, fp);
|
||||
+ found_bom=check_bom(fp,&mbf);
|
||||
+
|
||||
+ if (using_utf_locale == false && found_bom == true)
|
||||
+ {
|
||||
+ /*try using some predefined locale */
|
||||
|
||||
+ if (set_utf_locale () != 0)
|
||||
+ {
|
||||
+ error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale"));
|
||||
+ }
|
||||
+ }
|
||||
/* The worst case is a non-blank character, then one blank, then a
|
||||
tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
|
||||
allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
|
||||
pending_blank = xmalloc (max_column_width * sizeof (mbf_char_t));
|
||||
|
||||
- mbf_init (mbf, fp);
|
||||
+ if (found_bom == true)
|
||||
+ {
|
||||
+ print_bom();
|
||||
+ }
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -169,6 +189,27 @@ unexpand (void)
|
||||
if ((mb_iseof (c)) && (fp = next_file (fp)))
|
||||
{
|
||||
mbf_init (mbf, fp);
|
||||
+ if (fp!=NULL)
|
||||
+ {
|
||||
+ if (check_bom(fp,&mbf)==true)
|
||||
+ {
|
||||
+ /*Not the first file - check BOM header*/
|
||||
+ if (using_utf_locale==false && found_bom==false)
|
||||
+ {
|
||||
+ /*BOM header in subsequent file but not in the first one. */
|
||||
+ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if(using_utf_locale==false && found_bom==true)
|
||||
+ {
|
||||
+ /*First file conatined BOM header - locale was switched to UTF
|
||||
+ *all subsequent files should contain BOM. */
|
||||
+ error (EXIT_FAILURE, errno, _("combination of files with and without BOM header"));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
continue;
|
||||
}
|
||||
else
|
||||
diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
|
||||
index 031be7a..1621c84 100755
|
||||
--- a/tests/expand/mb.sh
|
||||
+++ b/tests/expand/mb.sh
|
||||
@@ -109,4 +109,75 @@ env printf '12345678
|
||||
expand < in > out || fail=1
|
||||
compare exp out > /dev/null 2>&1 || fail=1
|
||||
|
||||
+
|
||||
+
|
||||
+#BOM header test 1
|
||||
+printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+EOF
|
||||
+env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_
|
||||
+
|
||||
+printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+EOF
|
||||
+
|
||||
+
|
||||
+expand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+LANG=C expand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+LC_ALL=C expand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+
|
||||
+printf '\xEF\xBB\xBF' > in1; cat <<\EOF >> in1 || framework_failure_
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+EOF
|
||||
+env printf ' äöü\t. öüä. \tä xx\n' >> in1 || framework_failure_
|
||||
+
|
||||
+
|
||||
+printf '\xEF\xBB\xBF' > exp; cat <<\EOF >> exp || framework_failure_
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+EOF
|
||||
+
|
||||
+expand in1 in1 > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+LANG=C expand in1 in1 > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+LC_ALL=C expand in1 in1 > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
exit $fail
|
||||
diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
|
||||
index 8d75652..9d4ee3e 100755
|
||||
--- a/tests/unexpand/mb.sh
|
||||
+++ b/tests/unexpand/mb.sh
|
||||
@@ -111,3 +111,62 @@ env printf '12345678
|
||||
|
||||
unexpand -a < in > out || fail=1
|
||||
compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+#BOM header test 1
|
||||
+printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+EOF
|
||||
+env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_
|
||||
+
|
||||
+printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+EOF
|
||||
+
|
||||
+unexpand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+LANG=C unexpand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+LC_ALL=C unexpand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+
|
||||
+printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+1234567812345678123456781
|
||||
+. . . .
|
||||
+a b c d
|
||||
+. . . .
|
||||
+ä ö ü ß
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+EOF
|
||||
+
|
||||
+
|
||||
+unexpand in in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+LANG=C unexpand in in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+LC_ALL=C unexpand in in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
--
|
||||
2.9.3
|
||||
|
3761
SOURCES/coreutils-i18n.patch
Normal file
3761
SOURCES/coreutils-i18n.patch
Normal file
File diff suppressed because it is too large
Load Diff
37
SOURCES/coreutils-provides.inc
Normal file
37
SOURCES/coreutils-provides.inc
Normal file
@ -0,0 +1,37 @@
|
||||
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: fileutils = %{version}-%{release}
|
||||
Provides: mktemp = 4:%{version}-%{release}
|
||||
Provides: sh-utils = %{version}-%{release}
|
||||
Provides: stat = %{version}-%{release}
|
||||
Provides: textutils = %{version}-%{release}
|
120
SOURCES/coreutils-selinux.patch
Normal file
120
SOURCES/coreutils-selinux.patch
Normal file
@ -0,0 +1,120 @@
|
||||
diff --git a/man/chcon.x b/man/chcon.x
|
||||
index 8c1ff6f..c84fb96 100644
|
||||
--- a/man/chcon.x
|
||||
+++ b/man/chcon.x
|
||||
@@ -1,4 +1,4 @@
|
||||
[NAME]
|
||||
-chcon \- change file security context
|
||||
+chcon \- change file SELinux security context
|
||||
[DESCRIPTION]
|
||||
.\" Add any additional description here
|
||||
diff --git a/man/runcon.x b/man/runcon.x
|
||||
index d2df13e..5c5f5d8 100644
|
||||
--- a/man/runcon.x
|
||||
+++ b/man/runcon.x
|
||||
@@ -1,5 +1,5 @@
|
||||
[NAME]
|
||||
-runcon \- run command with specified security context
|
||||
+runcon \- run command with specified SELinux security context
|
||||
[DESCRIPTION]
|
||||
Run COMMAND with completely-specified CONTEXT, or with current or
|
||||
transitioned security context modified by one or more of LEVEL,
|
||||
diff --git a/src/cp.c b/src/cp.c
|
||||
index 1b528c6..25dbb88 100644
|
||||
--- a/src/cp.c
|
||||
+++ b/src/cp.c
|
||||
@@ -203,6 +203,9 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
|
||||
all\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
+ -c deprecated, same as --preserve=context\n\
|
||||
+"), stdout);
|
||||
+ fputs (_("\
|
||||
--no-preserve=ATTR_LIST don't preserve the specified attributes\n\
|
||||
--parents use full source file name under DIRECTORY\n\
|
||||
"), stdout);
|
||||
@@ -929,7 +932,7 @@ main (int argc, char **argv)
|
||||
selinux_enabled = (0 < is_selinux_enabled ());
|
||||
cp_option_init (&x);
|
||||
|
||||
- while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:TZ",
|
||||
+ while ((c = getopt_long (argc, argv, "abcdfHilLnprst:uvxPRS:TZ",
|
||||
long_opts, NULL))
|
||||
!= -1)
|
||||
{
|
||||
@@ -977,6 +980,17 @@ main (int argc, char **argv)
|
||||
copy_contents = true;
|
||||
break;
|
||||
|
||||
+ case 'c':
|
||||
+ fprintf (stderr, "%s: warning: option '-c' is deprecated, please use '--preserve=context' instead\n", argv[0]);
|
||||
+ if ( x.set_security_context ) {
|
||||
+ (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]);
|
||||
+ exit( 1 );
|
||||
+ }
|
||||
+ else if (selinux_enabled) {
|
||||
+ x.preserve_security_context = true;
|
||||
+ x.require_preserve_context = true;
|
||||
+ }
|
||||
+ break;
|
||||
case 'd':
|
||||
x.preserve_links = true;
|
||||
x.dereference = DEREF_NEVER;
|
||||
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
|
||||
index 47e4480..cff2ead 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -8083,6 +8083,11 @@ done
|
||||
exit $fail
|
||||
@end example
|
||||
|
||||
+@item -c
|
||||
+@cindex SELinux security context information, preserving
|
||||
+Preserve SELinux security context of the original files if possible.
|
||||
+Some file systems don't support storing of SELinux security context.
|
||||
+
|
||||
@item --copy-contents
|
||||
@cindex directories, copying recursively
|
||||
@cindex copying directories recursively
|
||||
diff --git a/src/install.c b/src/install.c
|
||||
index d79d597..437889a 100644
|
||||
--- a/src/install.c
|
||||
+++ b/src/install.c
|
||||
@@ -673,7 +673,7 @@ In the 4th form, create all components of the given DIRECTORY(ies).\n\
|
||||
-v, --verbose print the name of each directory as it is created\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
- --preserve-context preserve SELinux security context\n\
|
||||
+ -P, --preserve-context preserve SELinux security context (-P deprecated)\n\
|
||||
-Z set SELinux security context of destination\n\
|
||||
file and each created directory to default type\n\
|
||||
--context[=CTX] like -Z, or if CTX is specified then set the\n\
|
||||
@@ -824,7 +824,7 @@ main (int argc, char **argv)
|
||||
dir_arg = false;
|
||||
umask (0);
|
||||
|
||||
- while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z", long_options,
|
||||
+ while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pPt:TvS:Z", long_options,
|
||||
NULL)) != -1)
|
||||
{
|
||||
switch (optc)
|
||||
@@ -885,6 +885,8 @@ main (int argc, char **argv)
|
||||
no_target_directory = true;
|
||||
break;
|
||||
|
||||
+ case 'P':
|
||||
+ fprintf (stderr, "%s: warning: option '-P' is deprecated, please use '--preserve-context' instead\n", argv[0]);
|
||||
case PRESERVE_CONTEXT_OPTION:
|
||||
if (! selinux_enabled)
|
||||
{
|
||||
@@ -892,6 +894,10 @@ main (int argc, char **argv)
|
||||
"this kernel is not SELinux-enabled"));
|
||||
break;
|
||||
}
|
||||
+ if ( x.set_security_context ) {
|
||||
+ (void) fprintf(stderr, "%s: cannot force target context and preserve it\n", argv[0]);
|
||||
+ exit( 1 );
|
||||
+ }
|
||||
x.preserve_security_context = true;
|
||||
use_default_selinux_context = false;
|
||||
break;
|
12
SOURCES/sh-utils-2.0.11-dateman.patch
Normal file
12
SOURCES/sh-utils-2.0.11-dateman.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -urNp coreutils-5.97-orig/man/date.x coreutils-5.97/man/date.x
|
||||
--- coreutils-5.97-orig/man/date.x 1999-11-02 15:07:36.000000000 +0100
|
||||
+++ coreutils-5.97/man/date.x 2008-10-15 10:13:31.000000000 +0200
|
||||
@@ -11,3 +11,8 @@ calendar date, time of day, time zone, day of week, relative time,
|
||||
relative date, and numbers. An empty string indicates the beginning
|
||||
of the day. The date string format is more complex than is easily
|
||||
documented here but is fully described in the info documentation.
|
||||
+[ENVIRONMENT]
|
||||
+.TP
|
||||
+TZ
|
||||
+Specifies the timezone, unless overridden by command line parameters.
|
||||
+If neither is specified, the setting from /etc/localtime is used.
|
104
SOURCES/supported_utils
Normal file
104
SOURCES/supported_utils
Normal file
@ -0,0 +1,104 @@
|
||||
%{_bindir}/arch
|
||||
%{_bindir}/b2sum
|
||||
%{_bindir}/basename
|
||||
%{_bindir}/cat
|
||||
%{_bindir}/chgrp
|
||||
%{_bindir}/chmod
|
||||
%{_bindir}/chown
|
||||
%{_bindir}/cp
|
||||
%{_bindir}/cut
|
||||
%{_bindir}/date
|
||||
%{_bindir}/dd
|
||||
%{_bindir}/df
|
||||
%{_bindir}/echo
|
||||
%{_bindir}/env
|
||||
%{_bindir}/false
|
||||
%{_bindir}/link
|
||||
%{_bindir}/ln
|
||||
%{_bindir}/ls
|
||||
%{_bindir}/mkdir
|
||||
%{_bindir}/mknod
|
||||
%{_bindir}/mv
|
||||
%{_bindir}/nice
|
||||
%{_bindir}/pwd
|
||||
%{_bindir}/readlink
|
||||
%{_bindir}/rm
|
||||
%{_bindir}/rmdir
|
||||
%{_bindir}/sleep
|
||||
%{_bindir}/sort
|
||||
%{_bindir}/stty
|
||||
%{_bindir}/sync
|
||||
%{_bindir}/mktemp
|
||||
%{_bindir}/touch
|
||||
%{_bindir}/true
|
||||
%{_bindir}/uname
|
||||
%{_bindir}/unlink
|
||||
%{_bindir}/[
|
||||
%{_bindir}/base32
|
||||
%{_bindir}/base64
|
||||
%{_bindir}/chcon
|
||||
%{_bindir}/cksum
|
||||
%{_bindir}/comm
|
||||
%{_bindir}/csplit
|
||||
%{_bindir}/dir
|
||||
%{_bindir}/dircolors
|
||||
%{_bindir}/dirname
|
||||
%{_bindir}/du
|
||||
%{_bindir}/expand
|
||||
%{_bindir}/expr
|
||||
%{_bindir}/factor
|
||||
%{_bindir}/fmt
|
||||
%{_bindir}/fold
|
||||
%{_bindir}/groups
|
||||
%{_bindir}/head
|
||||
%{_bindir}/hostid
|
||||
%{_bindir}/id
|
||||
%{_bindir}/install
|
||||
%{_bindir}/join
|
||||
%{_bindir}/logname
|
||||
%{_bindir}/md5sum
|
||||
%{_bindir}/mkfifo
|
||||
%{_bindir}/nl
|
||||
%{_bindir}/nohup
|
||||
%{_bindir}/nproc
|
||||
%{_bindir}/numfmt
|
||||
%{_bindir}/od
|
||||
%{_bindir}/paste
|
||||
%{_bindir}/pathchk
|
||||
%{_bindir}/pinky
|
||||
%{_bindir}/pr
|
||||
%{_bindir}/printenv
|
||||
%{_bindir}/printf
|
||||
%{_bindir}/ptx
|
||||
%{_bindir}/realpath
|
||||
%{_bindir}/runcon
|
||||
%{_bindir}/seq
|
||||
%{_bindir}/sha1sum
|
||||
%{_bindir}/sha224sum
|
||||
%{_bindir}/sha256sum
|
||||
%{_bindir}/sha384sum
|
||||
%{_bindir}/sha512sum
|
||||
%{_bindir}/shred
|
||||
%{_bindir}/shuf
|
||||
%{_bindir}/split
|
||||
%{_bindir}/stat
|
||||
%{_bindir}/stdbuf
|
||||
%{_bindir}/sum
|
||||
%{_bindir}/tac
|
||||
%{_bindir}/tail
|
||||
%{_bindir}/tee
|
||||
%{_bindir}/test
|
||||
%{_bindir}/timeout
|
||||
%{_bindir}/tr
|
||||
%{_bindir}/truncate
|
||||
%{_bindir}/tsort
|
||||
%{_bindir}/tty
|
||||
%{_bindir}/unexpand
|
||||
%{_bindir}/uniq
|
||||
%{_bindir}/users
|
||||
%{_bindir}/vdir
|
||||
%{_bindir}/wc
|
||||
%{_bindir}/who
|
||||
%{_bindir}/whoami
|
||||
%{_bindir}/yes
|
||||
%{_sbindir}/chroot
|
2159
SPECS/coreutils.spec
Normal file
2159
SPECS/coreutils.spec
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user