mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-12 23:00:10 +02:00
458 lines
15 KiB
Diff
458 lines
15 KiB
Diff
diff -urN coreutils-6.12.orig/configure coreutils-6.12/configure
|
|
--- coreutils-6.12.orig/configure 2008-11-30 21:41:13.000000000 +0000
|
|
+++ coreutils-6.12/configure 2008-11-30 22:05:25.000000000 +0000
|
|
@@ -25272,7 +25272,7 @@
|
|
cat >>conftest.$ac_ext <<_ACEOF
|
|
/* end confdefs.h. */
|
|
#include <sys/types.h>
|
|
-#if defined __GLIBC__ && !defined __BEOS__
|
|
+#if defined __GLIBC__ && !(defined(__BEOS__) || defined(__HAIKU__))
|
|
Do not use statvfs on systems with GNU libc, because that function stats
|
|
all preceding entries in /proc/mounts, and that makes df hang if even
|
|
one of the corresponding file systems is hard-mounted, but not available.
|
|
diff -urN coreutils-6.12.orig/lib/fcntl.in.h coreutils-6.12/lib/fcntl.in.h
|
|
--- coreutils-6.12.orig/lib/fcntl.in.h 2008-11-30 21:40:44.000000000 +0000
|
|
+++ coreutils-6.12/lib/fcntl.in.h 2008-11-30 22:05:25.000000000 +0000
|
|
@@ -104,7 +104,7 @@
|
|
# define O_TEXT _O_TEXT
|
|
#endif
|
|
|
|
-#ifdef __BEOS__
|
|
+#if (defined(__BEOS__) || defined(__HAIKU__))
|
|
/* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
|
|
# undef O_BINARY
|
|
# undef O_TEXT
|
|
diff -urN coreutils-6.12.orig/lib/freadahead.c coreutils-6.12/lib/freadahead.c
|
|
--- coreutils-6.12.orig/lib/freadahead.c 2008-11-30 21:40:47.000000000 +0000
|
|
+++ coreutils-6.12/lib/freadahead.c 2008-11-30 20:57:54.000000000 +0000
|
|
@@ -24,7 +24,7 @@
|
|
size_t
|
|
freadahead (FILE *fp)
|
|
{
|
|
-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
|
+#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
|
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
|
return 0;
|
|
return (fp->_IO_read_end - fp->_IO_read_ptr)
|
|
diff -urN coreutils-6.12.orig/lib/freadptr.c coreutils-6.12/lib/freadptr.c
|
|
--- coreutils-6.12.orig/lib/freadptr.c 2008-11-30 21:40:44.000000000 +0000
|
|
+++ coreutils-6.12/lib/freadptr.c 2008-11-30 21:13:58.000000000 +0000
|
|
@@ -29,7 +29,7 @@
|
|
size_t size;
|
|
|
|
/* Keep this code in sync with freadahead! */
|
|
-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
|
+#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
|
if (fp->_IO_write_ptr > fp->_IO_write_base)
|
|
return NULL;
|
|
size = fp->_IO_read_end - fp->_IO_read_ptr;
|
|
diff -urN coreutils-6.12.orig/lib/freadseek.c coreutils-6.12/lib/freadseek.c
|
|
--- coreutils-6.12.orig/lib/freadseek.c 2008-11-30 21:40:46.000000000 +0000
|
|
+++ coreutils-6.12/lib/freadseek.c 2008-11-30 21:15:22.000000000 +0000
|
|
@@ -34,7 +34,7 @@
|
|
freadptrinc (FILE *fp, size_t increment)
|
|
{
|
|
/* Keep this code in sync with freadptr! */
|
|
-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
|
+#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
|
fp->_IO_read_ptr += increment;
|
|
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
|
fp_->_p += increment;
|
|
diff -urN coreutils-6.12.orig/lib/fseterr.c coreutils-6.12/lib/fseterr.c
|
|
--- coreutils-6.12.orig/lib/fseterr.c 2008-11-30 21:40:48.000000000 +0000
|
|
+++ coreutils-6.12/lib/fseterr.c 2008-11-30 21:16:48.000000000 +0000
|
|
@@ -29,7 +29,7 @@
|
|
/* Most systems provide FILE as a struct and the necessary bitmask in
|
|
<stdio.h>, because they need it for implementing getc() and putc() as
|
|
fast macros. */
|
|
-#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
|
+#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */
|
|
fp->_flags |= _IO_ERR_SEEN;
|
|
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
|
|
fp_->_flags |= __SERR;
|
|
diff -urN coreutils-6.12.orig/lib/physmem.c coreutils-6.12/lib/physmem.c
|
|
--- coreutils-6.12.orig/lib/physmem.c 2008-11-30 21:40:44.000000000 +0000
|
|
+++ coreutils-6.12/lib/physmem.c 2008-11-30 22:05:25.000000000 +0000
|
|
@@ -17,6 +17,7 @@
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
/* Written by Paul Eggert. */
|
|
+#undef DEBUG
|
|
|
|
#include <config.h>
|
|
|
|
diff -urN coreutils-6.12.orig/src/copy.c coreutils-6.12/src/copy.c
|
|
--- coreutils-6.12.orig/src/copy.c 2008-11-30 21:40:58.000000000 +0000
|
|
+++ coreutils-6.12/src/copy.c 2008-11-30 22:05:25.000000000 +0000
|
|
@@ -55,6 +55,10 @@
|
|
#include "areadlink.h"
|
|
#include "yesno.h"
|
|
|
|
+#if (defined(__BEOS__) || defined(__HAIKU__))
|
|
+# include <fs_attr.h>
|
|
+#endif
|
|
+
|
|
#ifndef HAVE_FCHOWN
|
|
# define HAVE_FCHOWN false
|
|
# define fchown(fd, uid, gid) (-1)
|
|
@@ -127,6 +131,68 @@
|
|
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 -1;
|
|
+
|
|
+ while ((dirent = fs_read_attr_dir(attributes)) != NULL) {
|
|
+ attr_info info;
|
|
+ off_t pos = 0;
|
|
+
|
|
+ if (fs_stat_attr(fromFd, dirent->d_name, &info) != 0)
|
|
+ continue;
|
|
+
|
|
+ while (info.size > 0) {
|
|
+ ssize_t bytesRead, bytesWritten;
|
|
+
|
|
+ bytesRead = fs_read_attr(fromFd, dirent->d_name, info.type, pos, buffer, sizeof(buffer));
|
|
+ if (bytesRead <= 0)
|
|
+ break;
|
|
+
|
|
+ bytesWritten = fs_write_attr(toFd, dirent->d_name, info.type, pos, buffer, bytesRead);
|
|
+ if (bytesWritten != bytesRead)
|
|
+ break;
|
|
+
|
|
+ pos += bytesWritten;
|
|
+ info.size -= bytesWritten;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ fs_close_attr_dir(attributes);
|
|
+}
|
|
+
|
|
+
|
|
+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;
|
|
+}
|
|
+
|
|
+
|
|
/* Read the contents of the directory SRC_NAME_IN, and recursively
|
|
copy the contents to DST_NAME_IN. NEW_DST is true if
|
|
DST_NAME_IN is a directory that was created previously in the
|
|
@@ -154,6 +220,10 @@
|
|
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. */
|
|
if (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS)
|
|
@@ -709,6 +779,11 @@
|
|
}
|
|
}
|
|
|
|
+ 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)
|
|
{
|
|
@@ -1516,6 +1591,19 @@
|
|
goto un_backup;
|
|
}
|
|
|
|
+ if (link_failed)
|
|
+ {
|
|
+ error (0, errno, _("cannot create hard link %s to %s"),
|
|
+ quote_n (0, dst_name), quote_n (1, earlier_file));
|
|
+ goto un_backup;
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ if (x->ignore_attributes == 0
|
|
+ && copy_attributes_by_name(earlier_file, dst_name, false) != 0)
|
|
+ fprintf(stderr, "%s: could not copy attributes\n", earlier_file);
|
|
+ }
|
|
+
|
|
return true;
|
|
}
|
|
}
|
|
diff -urN coreutils-6.12.orig/src/copy.h coreutils-6.12/src/copy.h
|
|
--- coreutils-6.12.orig/src/copy.h 2008-11-30 21:40:53.000000000 +0000
|
|
+++ coreutils-6.12/src/copy.h 2008-11-30 22:05:25.000000000 +0000
|
|
@@ -174,6 +174,9 @@
|
|
fail if it is unable to do so. */
|
|
bool require_preserve_context;
|
|
|
|
+ /* If nonzero, attributes will be ignored when copying. */
|
|
+ int ignore_attributes;
|
|
+
|
|
/* If true, copy directories recursively and copy special files
|
|
as themselves rather than copying their contents. */
|
|
bool recursive;
|
|
diff -urN coreutils-6.12.orig/src/cp.c coreutils-6.12/src/cp.c
|
|
--- coreutils-6.12.orig/src/cp.c 2008-11-30 21:40:59.000000000 +0000
|
|
+++ coreutils-6.12/src/cp.c 2008-11-30 22:05:25.000000000 +0000
|
|
@@ -73,6 +73,7 @@
|
|
enum
|
|
{
|
|
COPY_CONTENTS_OPTION = CHAR_MAX + 1,
|
|
+ IGNORE_ATTRIBUTES,
|
|
NO_PRESERVE_ATTRIBUTES_OPTION,
|
|
PARENTS_OPTION,
|
|
PRESERVE_ATTRIBUTES_OPTION,
|
|
@@ -130,6 +131,7 @@
|
|
{"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-dereference", no_argument, NULL, 'P'},
|
|
@@ -186,6 +188,7 @@
|
|
fputs (_("\
|
|
-f, --force if an existing destination file cannot be\n\
|
|
opened, remove it and try again\n\
|
|
+ --ignore-attributes do not copy attributes\n\
|
|
-i, --interactive prompt before overwrite\n\
|
|
-H follow command-line symbolic links in SOURCE\n\
|
|
"), stdout);
|
|
@@ -779,6 +782,7 @@
|
|
x->require_preserve_context = false;
|
|
|
|
x->require_preserve = false;
|
|
+ x->ignore_attributes = false;
|
|
x->recursive = false;
|
|
x->sparse_mode = SPARSE_AUTO;
|
|
x->symbolic_link = false;
|
|
@@ -956,6 +960,10 @@
|
|
x.dereference = DEREF_COMMAND_LINE_ARGUMENTS;
|
|
break;
|
|
|
|
+ case IGNORE_ATTRIBUTES:
|
|
+ x.ignore_attributes = true;
|
|
+ break;
|
|
+
|
|
case 'i':
|
|
x.interactive = I_ASK_USER;
|
|
break;
|
|
diff -urN coreutils-6.12.orig/src/ls.c coreutils-6.12/src/ls.c
|
|
--- coreutils-6.12.orig/src/ls.c 2008-11-30 21:40:54.000000000 +0000
|
|
+++ coreutils-6.12/src/ls.c 2008-11-30 22:05:25.000000000 +0000
|
|
@@ -635,6 +635,11 @@
|
|
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(__BEOS__) || defined(__HAIKU__)) /* Default to show UTF8 chars in BeOS terminal. */
|
|
+#define QMARK_FUNNY_CHARS_TTY 0
|
|
+#else
|
|
+#define QMARK_FUNNY_CHARS_TTY 1
|
|
+#endif
|
|
|
|
/* Quoting options for file and dir name output. */
|
|
|
|
@@ -1391,7 +1396,7 @@
|
|
/* Record whether there is an option specifying sort type. */
|
|
bool sort_type_specified = false;
|
|
|
|
- qmark_funny_chars = false;
|
|
+ qmark_funny_chars = QMARK_FUNNY_CHARS_TTY;
|
|
|
|
/* initialize all switches to default settings */
|
|
|
|
@@ -3513,6 +3518,7 @@
|
|
p = buf;
|
|
}
|
|
|
|
+#ifndef __BEOS__
|
|
if (f->stat_ok
|
|
&& (S_ISCHR (f->stat.st_mode) || S_ISBLK (f->stat.st_mode)))
|
|
{
|
|
@@ -3529,6 +3535,7 @@
|
|
p += file_size_width + 1;
|
|
}
|
|
else
|
|
+#endif
|
|
{
|
|
char hbuf[LONGEST_HUMAN_READABLE + 1];
|
|
char const *size =
|
|
diff -urN coreutils-6.12.orig/src/mv.c coreutils-6.12/src/mv.c
|
|
--- coreutils-6.12.orig/src/mv.c 2008-11-30 21:40:59.000000000 +0000
|
|
+++ coreutils-6.12/src/mv.c 2008-11-30 22:05:25.000000000 +0000
|
|
@@ -142,6 +142,7 @@
|
|
x->preserve_security_context = selinux_enabled;
|
|
x->require_preserve = false; /* FIXME: maybe make this an option */
|
|
x->require_preserve_context = false;
|
|
+ x->ignore_attributes = false;
|
|
x->recursive = true;
|
|
x->sparse_mode = SPARSE_AUTO; /* FIXME: maybe make this an option */
|
|
x->symbolic_link = false;
|
|
diff -urN coreutils-6.12.orig/src/remove.c coreutils-6.12/src/remove.c
|
|
--- coreutils-6.12.orig/src/remove.c 2008-11-30 21:40:59.000000000 +0000
|
|
+++ coreutils-6.12/src/remove.c 2008-11-30 18:25:45.000000000 +0000
|
|
@@ -264,9 +264,10 @@
|
|
{
|
|
size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t);
|
|
size_t *length = obstack_base (&ds->len_stack);
|
|
+ size_t top_len;
|
|
|
|
assert (n_lengths > 0);
|
|
- size_t top_len = length[n_lengths - 1];
|
|
+ top_len = length[n_lengths - 1];
|
|
assert (top_len >= 2);
|
|
|
|
/* Pop the specified length of file name. */
|
|
@@ -424,10 +425,11 @@
|
|
static void
|
|
AD_stack_pop (Dirstack_state *ds)
|
|
{
|
|
+ struct AD_ent *top;
|
|
assert (0 < AD_stack_height (ds));
|
|
|
|
/* operate on Active_dir. pop and free top entry */
|
|
- struct AD_ent *top = AD_stack_top (ds);
|
|
+ top = AD_stack_top (ds);
|
|
if (top->unremovable)
|
|
hash_free (top->unremovable);
|
|
obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
|
|
@@ -891,6 +893,7 @@
|
|
break;
|
|
}
|
|
|
|
+ {
|
|
char const *quoted_name = quote (full_filename (filename));
|
|
|
|
if (write_protected < 0)
|
|
@@ -930,6 +933,7 @@
|
|
: _("%s: remove %s %s? ")),
|
|
program_name, file_type (sbuf), quoted_name);
|
|
}
|
|
+ }
|
|
|
|
if (!yesno ())
|
|
return RM_USER_DECLINED;
|
|
@@ -1549,6 +1553,7 @@
|
|
return RM_ERROR;
|
|
}
|
|
|
|
+ {
|
|
struct stat st;
|
|
cache_stat_init (&st);
|
|
cycle_check_init (&ds->cycle_check_state);
|
|
@@ -1571,6 +1576,7 @@
|
|
AD_push_initial (ds);
|
|
AD_INIT_OTHER_MEMBERS ();
|
|
|
|
+ {
|
|
enum RM_status status = remove_entry (AT_FDCWD, ds, filename,
|
|
DT_UNKNOWN, &st, x);
|
|
if (status == RM_NONEMPTY_DIR)
|
|
@@ -1589,6 +1595,8 @@
|
|
ds_clear (ds);
|
|
return status;
|
|
}
|
|
+ }
|
|
+}
|
|
|
|
/* Remove all files and/or directories specified by N_FILES and FILE.
|
|
Apply the options in X. */
|
|
diff -urN coreutils-6.12.orig/src/rm.c coreutils-6.12/src/rm.c
|
|
--- coreutils-6.12.orig/src/rm.c 2008-11-30 21:40:58.000000000 +0000
|
|
+++ coreutils-6.12/src/rm.c 2008-11-30 18:25:45.000000000 +0000
|
|
@@ -357,6 +357,7 @@
|
|
quote ("/"));
|
|
}
|
|
|
|
+ {
|
|
size_t n_files = argc - optind;
|
|
char const *const *file = (char const *const *) argv + optind;
|
|
|
|
@@ -370,7 +371,10 @@
|
|
if (!yesno ())
|
|
exit (EXIT_SUCCESS);
|
|
}
|
|
+ {
|
|
enum RM_status status = rm (n_files, file, &x);
|
|
assert (VALID_STATUS (status));
|
|
exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS);
|
|
+ }
|
|
+ }
|
|
}
|
|
diff -urN coreutils-6.12.orig/src/seq.c coreutils-6.12/src/seq.c
|
|
--- coreutils-6.12.orig/src/seq.c 2008-11-30 21:40:52.000000000 +0000
|
|
+++ coreutils-6.12/src/seq.c 2008-11-30 18:25:45.000000000 +0000
|
|
@@ -166,6 +166,7 @@
|
|
: (decimal_point == arg /* .# -> 0.# */
|
|
|| ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */
|
|
}
|
|
+ {
|
|
char const *e = strchr (arg, 'e');
|
|
if (! e)
|
|
e = strchr (arg, 'E');
|
|
@@ -174,6 +175,7 @@
|
|
long exponent = strtol (e + 1, NULL, 10);
|
|
ret.precision += exponent < 0 ? -exponent : 0;
|
|
}
|
|
+ }
|
|
}
|
|
|
|
return ret;
|
|
@@ -349,6 +351,7 @@
|
|
size_t last_width = last.width + (prec - last.precision);
|
|
if (last.precision && prec == 0)
|
|
last_width--; /* don't include space for '.' */
|
|
+ {
|
|
size_t width = MAX (first_width, last_width);
|
|
if (width <= INT_MAX)
|
|
{
|
|
@@ -356,6 +359,7 @@
|
|
sprintf (format_buf, "%%0%d.%dLf", w, prec);
|
|
return format_buf;
|
|
}
|
|
+ }
|
|
}
|
|
else
|
|
{
|
|
diff -urN coreutils-6.12.orig/src/shred.c coreutils-6.12/src/shred.c
|
|
--- coreutils-6.12.orig/src/shred.c 2008-11-30 21:40:53.000000000 +0000
|
|
+++ coreutils-6.12/src/shred.c 2008-11-30 18:25:45.000000000 +0000
|
|
@@ -461,7 +461,7 @@
|
|
out. Thus, it shouldn't give up on bad blocks. This
|
|
code works because lim is always a multiple of
|
|
SECTOR_SIZE, except at the end. */
|
|
- verify (sizeof r % SECTOR_SIZE == 0);
|
|
+ { verify (sizeof r % SECTOR_SIZE == 0); }
|
|
if (errnum == EIO && 0 <= size && (soff | SECTOR_MASK) < lim)
|
|
{
|
|
size_t soff1 = (soff | SECTOR_MASK) + 1;
|