mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
coreutils: bump version
This commit is contained in:
736
sys-apps/coreutils/patches/coreutils-9.1.patchset
Normal file
736
sys-apps/coreutils/patches/coreutils-9.1.patchset
Normal file
@@ -0,0 +1,736 @@
|
||||
From e5e1815a0af4280c4d2176e9ba95efb5e32e2cae Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Tue, 13 May 2014 17:18:52 +0000
|
||||
Subject: define __USE_GNU for wempcpy
|
||||
|
||||
|
||||
diff --git a/lib/fnmatch.c b/lib/fnmatch.c
|
||||
index b33a127..a84975d 100644
|
||||
--- a/lib/fnmatch.c
|
||||
+++ b/lib/fnmatch.c
|
||||
@@ -23,6 +23,9 @@
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
+#ifndef __USE_GNU
|
||||
+# define __USE_GNU 1
|
||||
+#endif
|
||||
|
||||
#include <fnmatch.h>
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From 7be9386aca21161cfe5b9ea969b7043aa3d7b582 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Tue, 13 May 2014 17:22:10 +0000
|
||||
Subject: force declaration of rpl_inet_ntop
|
||||
|
||||
|
||||
diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h
|
||||
index f5d7db2..96399e2 100644
|
||||
--- a/lib/arpa_inet.in.h
|
||||
+++ b/lib/arpa_inet.in.h
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
For more details, see the POSIX:2008 specification
|
||||
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html>. */
|
||||
-# if @REPLACE_INET_NTOP@
|
||||
+# if 1
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef inet_ntop
|
||||
# define inet_ntop rpl_inet_ntop
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From 4cb50474e898d22a044c7558e9305eec934404ac Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Tue, 13 May 2014 17:32:36 +0000
|
||||
Subject: Haiku defines mknod in unistd.h
|
||||
|
||||
|
||||
diff --git a/lib/mknod.c b/lib/mknod.c
|
||||
index 3627ee3..56d7866 100644
|
||||
--- a/lib/mknod.c
|
||||
+++ b/lib/mknod.c
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
+#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <errno.h>
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From a412c27a91c895540e340a05f147fbdbbdc5965d Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Tue, 13 May 2014 17:35:25 +0000
|
||||
Subject: protect the label, not used on Haiku
|
||||
|
||||
|
||||
diff --git a/lib/mountlist.c b/lib/mountlist.c
|
||||
index fac5c45..1c2812a 100644
|
||||
--- a/lib/mountlist.c
|
||||
+++ b/lib/mountlist.c
|
||||
@@ -1089,7 +1089,8 @@ read_file_system_list (bool need_fs_type)
|
||||
return mount_list;
|
||||
|
||||
|
||||
- free_then_fail: _GL_UNUSED_LABEL;
|
||||
+ #ifndef __HAIKU__
|
||||
+free_then_fail: _GL_UNUSED_LABEL;
|
||||
{
|
||||
int saved_errno = errno;
|
||||
*mtail = NULL;
|
||||
@@ -1104,6 +1105,7 @@ read_file_system_list (bool need_fs_type)
|
||||
errno = saved_errno;
|
||||
return NULL;
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Free a mount entry as returned from read_file_system_list (). */
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From 408e4290cd364356e97edf9304a5cf238a5a61da Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Thu, 15 May 2014 15:40:32 +0000
|
||||
Subject: strchrnul needs __USE_GNU on Haiku
|
||||
|
||||
|
||||
diff --git a/lib/regex.h b/lib/regex.h
|
||||
index a7e0bd0..691334a 100644
|
||||
--- a/lib/regex.h
|
||||
+++ b/lib/regex.h
|
||||
@@ -30,8 +30,10 @@ extern "C" {
|
||||
/* Define __USE_GNU to declare GNU extensions that violate the
|
||||
POSIX name space rules. */
|
||||
#ifdef _GNU_SOURCE
|
||||
+#ifndef __USE_GNU
|
||||
# define __USE_GNU 1
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
#ifdef _REGEX_LARGE_OFFSETS
|
||||
|
||||
diff --git a/lib/string.in.h b/lib/string.in.h
|
||||
index c943294..26f556b 100644
|
||||
--- a/lib/string.in.h
|
||||
+++ b/lib/string.in.h
|
||||
@@ -37,6 +37,9 @@
|
||||
#define _GL_ALREADY_INCLUDING_STRING_H
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
+#ifndef __USE_GNU
|
||||
+#define __USE_GNU
|
||||
+#endif
|
||||
#@INCLUDE_NEXT@ @NEXT_STRING_H@
|
||||
|
||||
#undef _GL_ALREADY_INCLUDING_STRING_H
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From 70f9f980cb41d00f338d9968b3221503918f4edf Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Thu, 15 May 2014 20:13:58 +0000
|
||||
Subject: don't build hostid, nice, users, who
|
||||
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 6011805..fb6146d 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -1145,8 +1145,8 @@ CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__EXEEXT_1 = src/arch$(EXEEXT) src/coreutils$(EXEEXT) \
|
||||
src/hostname$(EXEEXT)
|
||||
-am__EXEEXT_2 = src/chroot$(EXEEXT) src/df$(EXEEXT) src/hostid$(EXEEXT) \
|
||||
- src/libstdbuf.so$(EXEEXT) src/nice$(EXEEXT) src/pinky$(EXEEXT) \
|
||||
+am__EXEEXT_2 = src/chroot$(EXEEXT) src/df$(EXEEXT) \
|
||||
+ src/libstdbuf.so$(EXEEXT) \
|
||||
src/stdbuf$(EXEEXT) src/stty$(EXEEXT) src/timeout$(EXEEXT) \
|
||||
src/uptime$(EXEEXT) src/users$(EXEEXT) src/who$(EXEEXT)
|
||||
am__EXEEXT_3 = src/[$(EXEEXT) src/b2sum$(EXEEXT) src/base64$(EXEEXT) \
|
||||
@@ -6589,7 +6589,7 @@ WARN_ON_USE_H = $(top_srcdir)/lib/warn-on-use.h
|
||||
# FIXME: once lib/ and gnulib-tests/ are also converted, hoist to Makefile.am
|
||||
AM_CFLAGS = $(WERROR_CFLAGS)
|
||||
no_install__progs = src/arch src/coreutils src/hostname
|
||||
-build_if_possible__progs = src/chroot src/df src/hostid \
|
||||
+build_if_possible__progs = src/chroot src/df \
|
||||
src/libstdbuf.so src/nice src/pinky src/stdbuf src/stty \
|
||||
src/timeout src/uptime src/users src/who
|
||||
default__progs = src/[ src/b2sum src/base64 src/base32 src/basenc \
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From 4024d54f8c1bf10cb4bc8819ff2dec64ec5ba4d3 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Fri, 6 Feb 2015 20:24:12 +0000
|
||||
Subject: import Haiku changes, fix warnings.
|
||||
|
||||
|
||||
diff --git a/INSTALL b/INSTALL
|
||||
index e82fd21..771315d 100644
|
||||
--- a/INSTALL
|
||||
+++ b/INSTALL
|
||||
@@ -245,10 +245,10 @@ directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||
in your 'PATH', put it _after_ '/usr/bin'.
|
||||
|
||||
- On Haiku, software installed for all users goes in '/boot/common',
|
||||
+ On Haiku, software installed for all users goes in '/boot/system',
|
||||
not '/usr/local'. It is recommended to use the following options:
|
||||
|
||||
- ./configure --prefix=/boot/common
|
||||
+ ./configure --prefix=/boot/system
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
diff --git a/lib/localcharset.c b/lib/localcharset.c
|
||||
index 17a4a1e..1fbd2d3 100644
|
||||
--- a/lib/localcharset.c
|
||||
+++ b/lib/localcharset.c
|
||||
@@ -41,6 +41,13 @@
|
||||
# ifndef OS2
|
||||
# define OS2
|
||||
# endif
|
||||
+
|
||||
+# if defined __HAIKU__
|
||||
+ /* To avoid the troubles of installing a separate file in the same
|
||||
+ directory as the DLL and of retrieving the DLL's directory at
|
||||
+ runtime, simply inline the aliases here. */
|
||||
+ cp = "UTF-8" "\0";
|
||||
+# endif
|
||||
#endif
|
||||
|
||||
#if !defined WINDOWS_NATIVE
|
||||
diff --git a/src/copy.c b/src/copy.c
|
||||
index b15d919..2b1549a 100644
|
||||
--- a/src/copy.c
|
||||
+++ b/src/copy.c
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
@@ -69,6 +70,10 @@
|
||||
# define USE_XATTR false
|
||||
#endif
|
||||
|
||||
+#if (defined(__BEOS__) || defined(__HAIKU__))
|
||||
+# include <fs_attr.h>
|
||||
+#endif
|
||||
+
|
||||
#if USE_XATTR
|
||||
# include <attr/error_context.h>
|
||||
# include <attr/libattr.h>
|
||||
@@ -601,6 +606,92 @@ is_ancestor (const struct stat *sb, const struct dir_list *ancestors)
|
||||
return false;
|
||||
}
|
||||
|
||||
+
|
||||
+static int
|
||||
+copy_attributes(int fromFd, int toFd)
|
||||
+{
|
||||
+ struct dirent *dirent;
|
||||
+ char buffer[65536];
|
||||
+
|
||||
+ DIR *attributes = fs_fopen_attr_dir(fromFd);
|
||||
+ if (attributes == NULL)
|
||||
+ return errno == B_UNSUPPORTED ? 0 : -1;
|
||||
+
|
||||
+ while ((dirent = fs_read_attr_dir(attributes)) != NULL) {
|
||||
+ struct stat stat;
|
||||
+ off_t pos = 0;
|
||||
+ int attrFromFD = fs_fopen_attr(fromFd, dirent->d_name, 0, O_RDONLY);
|
||||
+ int attrToFD;
|
||||
+
|
||||
+ if (attrFromFD < 0)
|
||||
+ continue;
|
||||
+
|
||||
+ if (fstat(attrFromFD, &stat) != 0) {
|
||||
+ close(attrFromFD);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ attrToFD = fs_fopen_attr(toFd, dirent->d_name, stat.st_type,
|
||||
+ O_WRONLY | O_TRUNC | O_CREAT);
|
||||
+ if (attrToFD < 0) {
|
||||
+ close(attrFromFD);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ while (true) {
|
||||
+ ssize_t bytesRead, bytesWritten;
|
||||
+
|
||||
+ bytesRead = read_pos(attrFromFD, pos, buffer, sizeof(buffer));
|
||||
+ if (bytesRead < 0) {
|
||||
+ fprintf(stderr, "error reading attribute '%s'", dirent->d_name);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ bytesWritten = write_pos(attrToFD, pos, buffer, bytesRead);
|
||||
+ if (bytesWritten != bytesRead) {
|
||||
+ fprintf(stderr, "error writing attribute '%s'", dirent->d_name);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ pos += bytesWritten;
|
||||
+ stat.st_size -= bytesWritten;
|
||||
+
|
||||
+ if (stat.st_size <= 0)
|
||||
+ break;
|
||||
+ }
|
||||
+ close(attrToFD);
|
||||
+ close(attrFromFD);
|
||||
+ }
|
||||
+
|
||||
+ fs_close_attr_dir(attributes);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+copy_attributes_by_name(const char *from, const char *to, int resolveLinks)
|
||||
+{
|
||||
+ int fromFd, toFd, result;
|
||||
+
|
||||
+ fromFd = open(from, O_RDONLY | (resolveLinks ? 0 : O_NOTRAVERSE));
|
||||
+ if (fromFd < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ toFd = open(to, O_RDONLY | (resolveLinks ? 0 : O_NOTRAVERSE));
|
||||
+ if (toFd < 0) {
|
||||
+ close(fromFd);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ result = copy_attributes(fromFd, toFd);
|
||||
+
|
||||
+ close(fromFd);
|
||||
+ close(toFd);
|
||||
+
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static bool
|
||||
errno_unsupported (int err)
|
||||
{
|
||||
@@ -744,6 +835,10 @@ copy_dir (char const *src_name_in, char const *dst_name_in,
|
||||
error (0, errno, _("cannot access %s"), quoteaf (src_name_in));
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ if (x->ignore_attributes == 0
|
||||
+ && copy_attributes_by_name(src_name_in, dst_name_in, true) != 0)
|
||||
+ fprintf(stderr, "%s: could not copy attributes\n", src_name_in);
|
||||
|
||||
/* For cp's -H option, dereference command line arguments, but do not
|
||||
dereference symlinks that are found via recursive traversal. */
|
||||
@@ -1447,6 +1542,11 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
return_val = false;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ if (x->ignore_attributes == 0
|
||||
+ && copy_attributes(source_desc, dest_desc) != 0)
|
||||
+ fprintf(stderr, "%s: could not copy attributes\n", src_name);
|
||||
+
|
||||
|
||||
close_src_and_dst_desc:
|
||||
if (close (dest_desc) < 0)
|
||||
@@ -2468,6 +2568,12 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
true, x->verbose, dereference))
|
||||
goto un_backup;
|
||||
|
||||
+ if (x->ignore_attributes == 0
|
||||
+ && copy_attributes_by_name (earlier_file, dst_name,
|
||||
+ false) != 0)
|
||||
+ error (0, errno, "cannot copy attributes from %s\n",
|
||||
+ earlier_file);
|
||||
+
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2900,6 +3006,11 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
preserving owner/group is a potential security problem. */
|
||||
}
|
||||
}
|
||||
+
|
||||
+ if (x->ignore_attributes == 0
|
||||
+ && copy_attributes_by_name(src_name, dst_name, false) != 0)
|
||||
+ fprintf(stderr, "%s: could not copy attributes\n", src_name);
|
||||
+
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/src/copy.h b/src/copy.h
|
||||
index 1f1de86..f8365cf 100644
|
||||
--- a/src/copy.h
|
||||
+++ b/src/copy.h
|
||||
@@ -189,6 +189,9 @@ struct cp_options
|
||||
must be false. */
|
||||
bool require_preserve;
|
||||
|
||||
+ /* If nonzero, attributes will be ignored when copying. */
|
||||
+ int ignore_attributes;
|
||||
+
|
||||
/* If true, attempt to preserve the SELinux security context, too.
|
||||
Set this only if the kernel is SELinux enabled. */
|
||||
bool preserve_security_context;
|
||||
diff --git a/src/cp.c b/src/cp.c
|
||||
index 0f44b35..31f5764 100644
|
||||
--- a/src/cp.c
|
||||
+++ b/src/cp.c
|
||||
@@ -61,6 +61,7 @@ struct dir_attr
|
||||
enum
|
||||
{
|
||||
ATTRIBUTES_ONLY_OPTION = CHAR_MAX + 1,
|
||||
+ IGNORE_ATTRIBUTES,
|
||||
COPY_CONTENTS_OPTION,
|
||||
NO_PRESERVE_ATTRIBUTES_OPTION,
|
||||
PARENTS_OPTION,
|
||||
@@ -109,6 +110,7 @@ static struct option const long_opts[] =
|
||||
{"copy-contents", no_argument, NULL, COPY_CONTENTS_OPTION},
|
||||
{"dereference", no_argument, NULL, 'L'},
|
||||
{"force", no_argument, NULL, 'f'},
|
||||
+ {"ignore-attributes", no_argument, NULL, IGNORE_ATTRIBUTES},
|
||||
{"interactive", no_argument, NULL, 'i'},
|
||||
{"link", no_argument, NULL, 'l'},
|
||||
{"no-clobber", no_argument, NULL, 'n'},
|
||||
@@ -167,6 +169,7 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
|
||||
-f, --force if an existing destination file cannot be\n\
|
||||
opened, remove it and try again (this option\n\
|
||||
is ignored when the -n option is also used)\n\
|
||||
+ --ignore-attributes do not copy attributes\n\
|
||||
-i, --interactive prompt before overwrite (overrides a previous -n\
|
||||
\n\
|
||||
option)\n\
|
||||
@@ -812,6 +815,7 @@ cp_option_init (struct cp_options *x)
|
||||
x->data_copy_required = true;
|
||||
x->require_preserve = false;
|
||||
x->recursive = false;
|
||||
+ x->ignore_attributes = false;
|
||||
x->sparse_mode = SPARSE_AUTO;
|
||||
x->symbolic_link = false;
|
||||
x->set_mode = false;
|
||||
@@ -1013,6 +1017,10 @@ main (int argc, char **argv)
|
||||
x.dereference = DEREF_COMMAND_LINE_ARGUMENTS;
|
||||
break;
|
||||
|
||||
+ case IGNORE_ATTRIBUTES:
|
||||
+ x.ignore_attributes = true;
|
||||
+ break;
|
||||
+
|
||||
case 'i':
|
||||
x.interactive = I_ASK_USER;
|
||||
break;
|
||||
diff --git a/src/dircolors.h b/src/dircolors.h
|
||||
index abe1a1f..1972483 100644
|
||||
--- a/src/dircolors.h
|
||||
+++ b/src/dircolors.h
|
||||
@@ -64,7 +64,7 @@ static char const G_line[] =
|
||||
'S','E','T','G','I','D',' ','3','0',';','4','3',' ','#',' ','f','i','l','e',' ','t','h','a','t',' ','i','s',' ','s','e','t','g','i','d',' ','(','g','+','s',')',0,
|
||||
'C','A','P','A','B','I','L','I','T','Y',' ','0','0',' ','#',' ','f','i','l','e',' ','w','i','t','h',' ','c','a','p','a','b','i','l','i','t','y',' ','(','v','e','r','y',' ','e','x','p','e','n','s','i','v','e',' ','t','o',' ','l','o','o','k','u','p',')',0,
|
||||
'S','T','I','C','K','Y','_','O','T','H','E','R','_','W','R','I','T','A','B','L','E',' ','3','0',';','4','2',' ','#',' ','d','i','r',' ','t','h','a','t',' ','i','s',' ','s','t','i','c','k','y',' ','a','n','d',' ','o','t','h','e','r','-','w','r','i','t','a','b','l','e',' ','(','+','t',',','o','+','w',')',0,
|
||||
- 'O','T','H','E','R','_','W','R','I','T','A','B','L','E',' ','3','4',';','4','2',' ','#',' ','d','i','r',' ','t','h','a','t',' ','i','s',' ','o','t','h','e','r','-','w','r','i','t','a','b','l','e',' ','(','o','+','w',')',' ','a','n','d',' ','n','o','t',' ','s','t','i','c','k','y',0,
|
||||
+ 'O','T','H','E','R','_','W','R','I','T','A','B','L','E',' ','3','4',';','4','3',' ','#',' ','d','i','r',' ','t','h','a','t',' ','i','s',' ','o','t','h','e','r','-','w','r','i','t','a','b','l','e',' ','(','o','+','w',')',' ','a','n','d',' ','n','o','t',' ','s','t','i','c','k','y',0,
|
||||
'S','T','I','C','K','Y',' ','3','7',';','4','4',' ','#',' ','d','i','r',' ','w','i','t','h',' ','t','h','e',' ','s','t','i','c','k','y',' ','b','i','t',' ','s','e','t',' ','(','+','t',')',' ','a','n','d',' ','n','o','t',' ','o','t','h','e','r','-','w','r','i','t','a','b','l','e',0,
|
||||
'#',' ','T','h','i','s',' ','i','s',' ','f','o','r',' ','f','i','l','e','s',' ','w','i','t','h',' ','e','x','e','c','u','t','e',' ','p','e','r','m','i','s','s','i','o','n',':',0,
|
||||
'E','X','E','C',' ','0','1',';','3','2',0,
|
||||
diff --git a/src/dircolors.hin b/src/dircolors.hin
|
||||
index f117359..e189948 100644
|
||||
--- a/src/dircolors.hin
|
||||
+++ b/src/dircolors.hin
|
||||
@@ -67,7 +67,7 @@ SETUID 37;41 # file that is setuid (u+s)
|
||||
SETGID 30;43 # file that is setgid (g+s)
|
||||
CAPABILITY 00 # file with capability (very expensive to lookup)
|
||||
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
|
||||
+OTHER_WRITABLE 34;43 # 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:
|
||||
diff --git a/src/ls.c b/src/ls.c
|
||||
index d15a103..de10484 100644
|
||||
--- a/src/ls.c
|
||||
+++ b/src/ls.c
|
||||
@@ -719,6 +719,11 @@ static struct ignore_pattern *hide_patterns;
|
||||
want to mess up the terminal if control chars get sent to it, and some
|
||||
quoting methods pass through control chars as-is. */
|
||||
static bool qmark_funny_chars;
|
||||
+#if defined(__HAIKU__) /* Default to show UTF8 chars in Haiku terminal. */
|
||||
+#define QMARK_FUNNY_CHARS_TTY 0
|
||||
+#else
|
||||
+#define QMARK_FUNNY_CHARS_TTY 1
|
||||
+#endif
|
||||
|
||||
/* Quoting options for file and dir name output. */
|
||||
|
||||
@@ -4400,6 +4405,7 @@ print_long_format (const struct fileinfo *f)
|
||||
p = buf;
|
||||
}
|
||||
|
||||
+#if !defined(__HAIKU__)
|
||||
if (f->stat_ok
|
||||
&& (S_ISCHR (f->stat.st_mode) || S_ISBLK (f->stat.st_mode)))
|
||||
{
|
||||
@@ -4415,6 +4421,7 @@ print_long_format (const struct fileinfo *f)
|
||||
umaxtostr (minor (f->stat.st_rdev), minorbuf));
|
||||
}
|
||||
else
|
||||
+#endif
|
||||
{
|
||||
char hbuf[LONGEST_HUMAN_READABLE + 1];
|
||||
char const *size =
|
||||
diff --git a/src/mv.c b/src/mv.c
|
||||
index 53b9c13..8d8c7be 100644
|
||||
--- a/src/mv.c
|
||||
+++ b/src/mv.c
|
||||
@@ -127,6 +127,7 @@ cp_option_init (struct cp_options *x)
|
||||
x->reduce_diagnostics = false;
|
||||
x->data_copy_required = true;
|
||||
x->require_preserve = false; /* FIXME: maybe make this an option */
|
||||
+ x->ignore_attributes = false;
|
||||
x->require_preserve_context = false;
|
||||
x->preserve_xattr = true;
|
||||
x->require_preserve_xattr = false;
|
||||
diff --git a/src/remove.c b/src/remove.c
|
||||
index b5d1ea8..f3b3a6b 100644
|
||||
--- a/src/remove.c
|
||||
+++ b/src/remove.c
|
||||
@@ -215,7 +215,7 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir,
|
||||
wp_errno = errno;
|
||||
}
|
||||
|
||||
- if (write_protected || x->interactive == RMI_ALWAYS)
|
||||
+ if (write_protected || errno || x->interactive == RMI_ALWAYS)
|
||||
{
|
||||
if (0 <= write_protected && dirent_type == DT_UNKNOWN)
|
||||
{
|
||||
diff --git a/src/uname.c b/src/uname.c
|
||||
index 385674f..cdb9e81 100644
|
||||
--- a/src/uname.c
|
||||
+++ b/src/uname.c
|
||||
@@ -44,6 +44,10 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+# include <OS.h>
|
||||
+#endif
|
||||
+
|
||||
#include "system.h"
|
||||
#include "die.h"
|
||||
#include "error.h"
|
||||
@@ -341,6 +345,30 @@ main (int argc, char **argv)
|
||||
element = processor;
|
||||
}
|
||||
#endif
|
||||
+
|
||||
+#ifdef __HAIKU__
|
||||
+ {
|
||||
+ cpu_topology_node_info root;
|
||||
+ uint32 count = 1;
|
||||
+ status_t error = get_cpu_topology_info(&root, &count);
|
||||
+ if (error != B_OK || count < 1)
|
||||
+ element = "unknown";
|
||||
+ else {
|
||||
+ switch (root.data.root.platform) {
|
||||
+ case B_CPU_x86:
|
||||
+ element = "x86";
|
||||
+ break;
|
||||
+ case B_CPU_x86_64:
|
||||
+ element = "x86_64";
|
||||
+ break;
|
||||
+ default:
|
||||
+ element = "other";
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if (! (toprint == UINT_MAX && element == unknown))
|
||||
print_element (element);
|
||||
}
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From 01549c096a5b86c11402f63e616a5195cc9509ec Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Thu, 21 Oct 2021 20:28:22 +0200
|
||||
Subject: config.h is required for stdint.h
|
||||
|
||||
|
||||
diff --git a/src/crctab.c b/src/crctab.c
|
||||
index 20a1e41..fdf2fdf 100644
|
||||
--- a/src/crctab.c
|
||||
+++ b/src/crctab.c
|
||||
@@ -1,3 +1,4 @@
|
||||
+#include <config.h>
|
||||
#include <stdint.h>
|
||||
|
||||
uint_fast32_t const crctab[8][256] = {
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From 98f0505371e0b0e9626897ec20c4a4a097224659 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Mon, 1 Nov 2021 21:08:55 +0100
|
||||
Subject: ln: handle negative errno
|
||||
|
||||
explicit check for -1 which is a special value in this code.
|
||||
|
||||
diff --git a/src/copy.c b/src/copy.c
|
||||
index 2b1549a..74cda27 100644
|
||||
--- a/src/copy.c
|
||||
+++ b/src/copy.c
|
||||
@@ -1966,7 +1966,7 @@ create_hard_link (char const *src_name, int src_dirfd, char const *src_relname,
|
||||
int err = force_linkat (src_dirfd, src_relname, dst_dirfd, dst_relname,
|
||||
dereference ? AT_SYMLINK_FOLLOW : 0,
|
||||
replace, -1);
|
||||
- if (0 < err)
|
||||
+ if (err != 0 && err != -1)
|
||||
{
|
||||
|
||||
char *a_src_name = NULL;
|
||||
@@ -1978,7 +1978,7 @@ create_hard_link (char const *src_name, int src_dirfd, char const *src_relname,
|
||||
free (a_src_name);
|
||||
return false;
|
||||
}
|
||||
- if (err < 0 && verbose)
|
||||
+ if (err == -1 && verbose)
|
||||
printf (_("removed %s\n"), quoteaf (dst_name));
|
||||
return true;
|
||||
}
|
||||
@@ -2869,7 +2869,7 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
|
||||
int err = force_symlinkat (src_name, dst_dirfd, dst_relname,
|
||||
x->unlink_dest_after_failed_open, -1);
|
||||
- if (0 < err)
|
||||
+ if (err != 0 && err != -1)
|
||||
{
|
||||
error (0, err, _("cannot create symbolic link %s to %s"),
|
||||
quoteaf_n (0, dst_name), quoteaf_n (1, src_name));
|
||||
@@ -2956,7 +2956,8 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
|
||||
int symlink_err = force_symlinkat (src_link_val, dst_dirfd, dst_relname,
|
||||
x->unlink_dest_after_failed_open, -1);
|
||||
- if (0 < symlink_err && x->update && !new_dst && S_ISLNK (dst_sb.st_mode)
|
||||
+ if (symlink_err != 0 && symlink_err != -1 && x->update && !new_dst
|
||||
+ && S_ISLNK (dst_sb.st_mode)
|
||||
&& dst_sb.st_size == strlen (src_link_val))
|
||||
{
|
||||
/* See if the destination is already the desired symlink.
|
||||
@@ -2973,7 +2974,7 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
}
|
||||
}
|
||||
free (src_link_val);
|
||||
- if (0 < symlink_err)
|
||||
+ if (symlink_err != 0 && symlink_err != -1)
|
||||
{
|
||||
error (0, symlink_err, _("cannot create symbolic link %s"),
|
||||
quoteaf (dst_name));
|
||||
diff --git a/src/ln.c b/src/ln.c
|
||||
index bb46958..4cfa36e 100644
|
||||
--- a/src/ln.c
|
||||
+++ b/src/ln.c
|
||||
@@ -154,7 +154,7 @@ convert_abs_rel (char const *from, char const *target)
|
||||
|
||||
/* Link SOURCE to DESTDIR_FD + DEST_BASE atomically. DESTDIR_FD is
|
||||
the directory containing DEST_BASE. Return 0 if successful, a
|
||||
- positive errno value on failure, and -1 if an atomic link cannot be
|
||||
+ errno value on failure, and -1 if an atomic link cannot be
|
||||
done. This handles the common case where the destination does not
|
||||
already exist and -r is not specified. */
|
||||
|
||||
@@ -185,7 +185,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
|
||||
char *backup_base = NULL;
|
||||
char *rel_source = NULL;
|
||||
int nofollow_flag = logical ? 0 : AT_SYMLINK_NOFOLLOW;
|
||||
- if (link_errno < 0)
|
||||
+ if (link_errno == -1)
|
||||
link_errno = atomic_link (source, destdir_fd, dest_base);
|
||||
|
||||
/* Get SOURCE_STATS if later code will need it, if only for sharper
|
||||
@@ -272,7 +272,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
|
||||
}
|
||||
}
|
||||
|
||||
- if (link_errno < 0 || link_errno == EEXIST)
|
||||
+ if (link_errno == -1 || link_errno == EEXIST)
|
||||
{
|
||||
if (interactive)
|
||||
{
|
||||
@@ -338,7 +338,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
|
||||
required removing the destination first. */
|
||||
}
|
||||
|
||||
- if (link_errno <= 0)
|
||||
+ if (link_errno == 0 || link_errno == -1)
|
||||
{
|
||||
/* Right after creating a hard link, do this: (note dest name and
|
||||
source_stats, which are also the just-linked-destinations stats) */
|
||||
@@ -393,7 +393,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
|
||||
|
||||
free (backup_base);
|
||||
free (rel_source);
|
||||
- return link_errno <= 0;
|
||||
+ return link_errno == 0 || link_errno == -1;
|
||||
|
||||
fail:
|
||||
free (rel_source);
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From 37f12fc0ac8373632c58616302cb989fae7f28f8 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Tue, 16 Nov 2021 10:22:30 +0100
|
||||
Subject: uptime: make utmp error not critical
|
||||
|
||||
|
||||
diff --git a/src/uptime.c b/src/uptime.c
|
||||
index 1adacaa..711ea60 100644
|
||||
--- a/src/uptime.c
|
||||
+++ b/src/uptime.c
|
||||
@@ -105,7 +105,7 @@ print_uptime (size_t n, const STRUCT_UTMP *this)
|
||||
#if HAVE_UTMPX_H || HAVE_UTMP_H
|
||||
/* Loop through all the utmp entries we just read and count up the valid
|
||||
ones, also in the process possibly gleaning boottime. */
|
||||
- while (n--)
|
||||
+ while (this && n--)
|
||||
{
|
||||
entries += IS_USER_PROCESS (this);
|
||||
if (UT_TYPE_BOOT_TIME (this))
|
||||
@@ -181,7 +181,11 @@ uptime (char const *filename, int options)
|
||||
|
||||
#if HAVE_UTMPX_H || HAVE_UTMP_H
|
||||
if (read_utmp (filename, &n_users, &utmp_buf, options) != 0)
|
||||
+#if HAVE_OS_H
|
||||
+ ;
|
||||
+#else
|
||||
die (EXIT_FAILURE, errno, "%s", quotef (filename));
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
print_uptime (n_users, utmp_buf);
|
||||
--
|
||||
2.30.2
|
||||
|
||||
Reference in New Issue
Block a user