mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 03:30:05 +02:00
Merged in cdesai/haikuports/sys-apps/coreutils (pull request #268)
coreutils updates
This commit is contained in:
@@ -130,12 +130,15 @@ PROVIDES="
|
||||
cmd:whoami = $portVersion compat >= 8
|
||||
cmd:yes = $portVersion compat >= 8
|
||||
"
|
||||
|
||||
REQUIRES="
|
||||
haiku >= $haikuVersion
|
||||
"
|
||||
|
||||
BUILD_PREREQUIRES="
|
||||
haiku_devel >= $haikuVersion
|
||||
cmd:gcc
|
||||
cmd:grep
|
||||
cmd:ld
|
||||
cmd:make
|
||||
cmd:awk
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
DESCRIPTION="standard GNU file utilities"
|
||||
HOMEPAGE="http://www.gnu.org/software/coreutils"
|
||||
SRC_URI="http://ftp.gnu.org/gnu/coreutils/coreutils-8.5.tar.gz"
|
||||
REVISION="1"
|
||||
STATUS_HAIKU="stable"
|
||||
DEPEND=""
|
||||
CHECKSUM_MD5="c1ffe586d001e87d66cd80c4536ee823"
|
||||
BUILD()
|
||||
{
|
||||
cd coreutils-8.5
|
||||
MANDIR=`finddir B_COMMON_DOCUMENTATION_DIRECTORY`/man
|
||||
./configure --prefix=`finddir B_COMMON_DIRECTORY` \
|
||||
--datarootdir=`finddir B_COMMON_DATA_DIRECTORY` \
|
||||
--infodir=`finddir B_COMMON_DOCUMENTATION`/info \
|
||||
--mandir=`finddir B_COMMON_DOCUMENTATION`/man
|
||||
make
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
cd coreutils-8.5
|
||||
make install
|
||||
}
|
||||
|
||||
TEST()
|
||||
{
|
||||
cd coreutils-8.5
|
||||
make check
|
||||
}
|
||||
|
||||
LICENSE="GNU GPL v3"
|
||||
COPYRIGHT="1994-1996, 2000-2010 Free Software Foundation, Inc."
|
||||
@@ -1,457 +0,0 @@
|
||||
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;
|
||||
@@ -1,646 +0,0 @@
|
||||
diff -urN coreutils-8.5/lib/mbsalign.c coreutils-8.5-gcc2/lib/mbsalign.c
|
||||
--- coreutils-8.5/lib/mbsalign.c 2010-04-20 19:52:04.018350080 +0000
|
||||
+++ coreutils-8.5-gcc2/lib/mbsalign.c 2010-09-24 13:26:41.000000000 +0000
|
||||
@@ -140,6 +140,7 @@
|
||||
size_t n_cols = src_size - 1;
|
||||
size_t n_used_bytes = n_cols; /* Not including NUL */
|
||||
size_t n_spaces = 0;
|
||||
+ size_t space_left;
|
||||
bool conversion = false;
|
||||
bool wc_enabled = false;
|
||||
|
||||
@@ -238,7 +239,7 @@
|
||||
}
|
||||
|
||||
dest = mbs_align_pad (dest, dest_end, start_spaces);
|
||||
- size_t space_left = dest_end - dest;
|
||||
+ space_left = dest_end - dest;
|
||||
dest = mempcpy (dest, str_to_print, MIN (n_used_bytes, space_left));
|
||||
mbs_align_pad (dest, dest_end, end_spaces);
|
||||
}
|
||||
@@ -262,11 +263,12 @@
|
||||
size_t size = *width; /* Start with enough for unibyte mode. */
|
||||
size_t req = size;
|
||||
char *buf = NULL;
|
||||
+ char *nbuf;
|
||||
|
||||
while (req >= size)
|
||||
{
|
||||
size = req + 1; /* Space for NUL. */
|
||||
- char *nbuf = realloc (buf, size);
|
||||
+ nbuf = realloc (buf, size);
|
||||
if (nbuf == NULL)
|
||||
{
|
||||
free (buf);
|
||||
diff -urN coreutils-8.5/src/chroot.c coreutils-8.5-gcc2/src/chroot.c
|
||||
--- coreutils-8.5/src/chroot.c 2010-04-20 19:52:04.033030144 +0000
|
||||
+++ coreutils-8.5-gcc2/src/chroot.c 2010-09-24 13:39:03.000000000 +0000
|
||||
@@ -151,6 +151,7 @@
|
||||
int c;
|
||||
char const *userspec = NULL;
|
||||
char const *groups = NULL;
|
||||
+ bool fail;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
set_program_name (argv[0]);
|
||||
@@ -211,7 +212,7 @@
|
||||
argv += optind + 1;
|
||||
}
|
||||
|
||||
- bool fail = false;
|
||||
+ fail = false;
|
||||
|
||||
/* Attempt to set all three: supplementary groups, group ID, user ID.
|
||||
Diagnose any failures. If any have failed, exit before execvp. */
|
||||
diff -urN coreutils-8.5/src/copy.c coreutils-8.5-gcc2/src/copy.c
|
||||
--- coreutils-8.5/src/copy.c 2010-04-20 19:52:04.049807360 +0000
|
||||
+++ coreutils-8.5-gcc2/src/copy.c 2010-09-24 13:43:19.000000000 +0000
|
||||
@@ -2280,6 +2280,7 @@
|
||||
bool nonexistent_dst, const struct cp_options *options,
|
||||
bool *copy_into_self, bool *rename_succeeded)
|
||||
{
|
||||
+ bool first_dir_created_per_command_line_arg = false;
|
||||
assert (valid_options (options));
|
||||
|
||||
/* Record the file names: they're used in case of error, when copying
|
||||
@@ -2292,7 +2293,6 @@
|
||||
top_level_src_name = src_name;
|
||||
top_level_dst_name = dst_name;
|
||||
|
||||
- bool first_dir_created_per_command_line_arg = false;
|
||||
return copy_internal (src_name, dst_name, nonexistent_dst, 0, NULL,
|
||||
options, true,
|
||||
&first_dir_created_per_command_line_arg,
|
||||
diff -urN coreutils-8.5/src/du.c coreutils-8.5-gcc2/src/du.c
|
||||
--- coreutils-8.5/src/du.c 2010-01-01 13:06:47.039321600 +0000
|
||||
+++ coreutils-8.5-gcc2/src/du.c 2010-09-24 14:00:37.000000000 +0000
|
||||
@@ -664,7 +664,9 @@
|
||||
bool max_depth_specified = false;
|
||||
bool ok = true;
|
||||
char *files_from = NULL;
|
||||
-
|
||||
+ struct argv_iterator *ai;
|
||||
+ static char *temp_argv[] = { NULL, NULL };
|
||||
+
|
||||
/* Bit flags that control how fts works. */
|
||||
int bit_flags = FTS_TIGHT_CYCLE_CHECK | FTS_DEFER_STAT;
|
||||
|
||||
@@ -918,7 +920,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- struct argv_iterator *ai;
|
||||
if (files_from)
|
||||
{
|
||||
/* When using --files0-from=F, you may not specify any files
|
||||
@@ -950,7 +951,6 @@
|
||||
hash_init ();
|
||||
|
||||
bit_flags |= symlink_deref_bits;
|
||||
- static char *temp_argv[] = { NULL, NULL };
|
||||
|
||||
while (true)
|
||||
{
|
||||
diff -urN coreutils-8.5/src/expr.c coreutils-8.5-gcc2/src/expr.c
|
||||
--- coreutils-8.5/src/expr.c 2010-03-13 15:14:09.039845888 +0000
|
||||
+++ coreutils-8.5-gcc2/src/expr.c 2010-09-24 14:11:15.000000000 +0000
|
||||
@@ -116,8 +116,8 @@
|
||||
static char *
|
||||
mpz_get_str (char const *str, int base, mpz_t z)
|
||||
{
|
||||
- (void) str; (void) base;
|
||||
char buf[INT_BUFSIZE_BOUND (intmax_t)];
|
||||
+ (void) str; (void) base;
|
||||
return xstrdup (imaxtostr (z[0], buf));
|
||||
}
|
||||
static int
|
||||
@@ -138,8 +138,8 @@
|
||||
static int
|
||||
mpz_out_str (FILE *stream, int base, mpz_t z)
|
||||
{
|
||||
- (void) base;
|
||||
char buf[INT_BUFSIZE_BOUND (intmax_t)];
|
||||
+ (void) base;
|
||||
return fputs (imaxtostr (z[0], buf), stream) != EOF;
|
||||
}
|
||||
#endif
|
||||
diff -urN coreutils-8.5/src/join.c coreutils-8.5-gcc2/src/join.c
|
||||
--- coreutils-8.5/src/join.c 2010-04-20 19:52:04.033554432 +0000
|
||||
+++ coreutils-8.5-gcc2/src/join.c 2010-09-24 14:13:58.000000000 +0000
|
||||
@@ -616,7 +616,9 @@
|
||||
struct seq seq1, seq2;
|
||||
int diff;
|
||||
bool eof1, eof2;
|
||||
-
|
||||
+ struct line *line = NULL;
|
||||
+ bool checktail = false;
|
||||
+
|
||||
/* Read the first line of each file. */
|
||||
initseq (&seq1);
|
||||
getseq (fp1, &seq1, 1);
|
||||
@@ -711,8 +713,6 @@
|
||||
tail ends of both inputs to verify that they are in order. We
|
||||
skip the rest of the tail once we have issued a warning for that
|
||||
file, unless we actually need to print the unpairable lines. */
|
||||
- struct line *line = NULL;
|
||||
- bool checktail = false;
|
||||
|
||||
if (check_input_order != CHECK_ORDER_DISABLED
|
||||
&& !(issued_disorder_warning[0] && issued_disorder_warning[1]))
|
||||
diff -urN coreutils-8.5/src/libstdbuf.c coreutils-8.5-gcc2/src/libstdbuf.c
|
||||
--- coreutils-8.5/src/libstdbuf.c 2010-03-13 15:14:09.034340864 +0000
|
||||
+++ coreutils-8.5-gcc2/src/libstdbuf.c 2010-09-24 15:13:11.000000000 +0000
|
||||
@@ -96,7 +96,7 @@
|
||||
else
|
||||
{
|
||||
setvbuf_mode = _IOFBF;
|
||||
- verify (SIZE_MAX <= ULONG_MAX);
|
||||
+ { verify (SIZE_MAX <= ULONG_MAX); }
|
||||
size = strtoul (mode, NULL, 10);
|
||||
if (size > 0)
|
||||
{
|
||||
diff -urN coreutils-8.5/src/ls.c coreutils-8.5-gcc2/src/ls.c
|
||||
--- coreutils-8.5/src/ls.c 2010-04-20 19:52:04.038273024 +0000
|
||||
+++ coreutils-8.5-gcc2/src/ls.c 2010-09-24 13:54:45.000000000 +0000
|
||||
@@ -1039,17 +1039,21 @@
|
||||
abmon_init (void)
|
||||
{
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
- required_mon_width = MAX_MON_WIDTH;
|
||||
+ int i;
|
||||
+ size_t width;
|
||||
+ size_t req;
|
||||
size_t curr_max_width;
|
||||
+ required_mon_width = MAX_MON_WIDTH;
|
||||
+
|
||||
do
|
||||
{
|
||||
curr_max_width = required_mon_width;
|
||||
required_mon_width = 0;
|
||||
- for (int i = 0; i < 12; i++)
|
||||
+ for (i = 0; i < 12; i++)
|
||||
{
|
||||
- size_t width = curr_max_width;
|
||||
+ width = curr_max_width;
|
||||
|
||||
- size_t req = mbsalign (nl_langinfo (ABMON_1 + i),
|
||||
+ req = mbsalign (nl_langinfo (ABMON_1 + i),
|
||||
abmon[i], sizeof (abmon[i]),
|
||||
&width, MBS_ALIGN_LEFT, 0);
|
||||
|
||||
@@ -3476,6 +3480,7 @@
|
||||
the replacement is not done. A malloc here slows ls down by 2% */
|
||||
char rpl_fmt[sizeof (abmon[0]) + 100];
|
||||
const char *pb;
|
||||
+ size_t ret;
|
||||
if (required_mon_width && (pb = strstr (fmt, "%b")))
|
||||
{
|
||||
if (strlen (fmt) < (sizeof (rpl_fmt) - sizeof (abmon[0]) + 2))
|
||||
@@ -3488,7 +3493,7 @@
|
||||
strcpy (pfmt, pb + 2);
|
||||
}
|
||||
}
|
||||
- size_t ret = nstrftime (buf, size, nfmt, tm, __utc, __ns);
|
||||
+ ret = nstrftime (buf, size, nfmt, tm, __utc, __ns);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3639,6 +3644,7 @@
|
||||
char *p;
|
||||
struct timespec when_timespec;
|
||||
struct tm *when_local;
|
||||
+ size_t w;
|
||||
|
||||
/* Compute the mode string, except remove the trailing space if no
|
||||
file in this directory has an ACL or SELinux security context. */
|
||||
@@ -3825,7 +3831,7 @@
|
||||
}
|
||||
|
||||
DIRED_FPUTS (buf, stdout, p - buf);
|
||||
- size_t w = print_name_with_quoting (f, false, &dired_obstack, p - buf);
|
||||
+ w = print_name_with_quoting (f, false, &dired_obstack, p - buf);
|
||||
|
||||
if (f->filetype == symbolic_link)
|
||||
{
|
||||
@@ -4014,7 +4020,8 @@
|
||||
size_t start_col)
|
||||
{
|
||||
const char* name = symlink_target ? f->linkname : f->name;
|
||||
-
|
||||
+ size_t width;
|
||||
+
|
||||
bool used_color_this_time
|
||||
= (print_with_color
|
||||
&& (print_color_indicator (f, symlink_target)
|
||||
@@ -4023,7 +4030,7 @@
|
||||
if (stack)
|
||||
PUSH_CURRENT_DIRED_POS (stack);
|
||||
|
||||
- size_t width = quote_name (stdout, name, filename_quoting_options, NULL);
|
||||
+ width = quote_name (stdout, name, filename_quoting_options, NULL);
|
||||
dired_pos += width;
|
||||
|
||||
if (stack)
|
||||
@@ -4060,6 +4067,7 @@
|
||||
static size_t
|
||||
print_file_name_and_frills (const struct fileinfo *f, size_t start_col)
|
||||
{
|
||||
+ size_t width;
|
||||
char buf[MAX (LONGEST_HUMAN_READABLE + 1, INT_BUFSIZE_BOUND (uintmax_t))];
|
||||
|
||||
set_normal_color ();
|
||||
@@ -4077,7 +4085,7 @@
|
||||
if (print_scontext)
|
||||
printf ("%*s ", format == with_commas ? 0 : scontext_width, f->scontext);
|
||||
|
||||
- size_t width = print_name_with_quoting (f, false, NULL, start_col);
|
||||
+ width = print_name_with_quoting (f, false, NULL, start_col);
|
||||
|
||||
if (indicator_style != none)
|
||||
width += print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype);
|
||||
diff -urN coreutils-8.5/src/nproc.c coreutils-8.5-gcc2/src/nproc.c
|
||||
--- coreutils-8.5/src/nproc.c 2010-01-01 13:06:47.032505856 +0000
|
||||
+++ coreutils-8.5-gcc2/src/nproc.c 2010-09-24 14:41:24.000000000 +0000
|
||||
@@ -76,6 +76,7 @@
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
unsigned long nproc, ignore = 0;
|
||||
+ enum nproc_query mode;
|
||||
initialize_main (&argc, &argv);
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
@@ -84,7 +85,7 @@
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
- enum nproc_query mode = NPROC_CURRENT_OVERRIDABLE;
|
||||
+ mode = NPROC_CURRENT_OVERRIDABLE;
|
||||
|
||||
while (1)
|
||||
{
|
||||
diff -urN coreutils-8.5/src/remove.c coreutils-8.5-gcc2/src/remove.c
|
||||
--- coreutils-8.5/src/remove.c 2010-03-13 15:14:09.049020928 +0000
|
||||
+++ coreutils-8.5-gcc2/src/remove.c 2010-09-24 14:39:23.000000000 +0000
|
||||
@@ -114,6 +114,7 @@
|
||||
char const *full_name,
|
||||
struct stat *buf)
|
||||
{
|
||||
+ size_t file_name_len;
|
||||
if (can_write_any_file ())
|
||||
return 0;
|
||||
if (cache_fstatat (fd_cwd, file, buf, AT_SYMLINK_NOFOLLOW) != 0)
|
||||
@@ -180,7 +181,7 @@
|
||||
}
|
||||
|
||||
/* This implements #5: */
|
||||
- size_t file_name_len = strlen (full_name);
|
||||
+ file_name_len = strlen (full_name);
|
||||
|
||||
if (MIN (PATH_MAX, 8192) <= file_name_len)
|
||||
return ! euidaccess_stat (buf, W_OK);
|
||||
@@ -218,16 +219,21 @@
|
||||
{
|
||||
int fd_cwd = fts->fts_cwd_fd;
|
||||
char const *full_name = ent->fts_path;
|
||||
+ char const *quoted_name = quote (full_name);
|
||||
char const *filename = ent->fts_accpath;
|
||||
+ struct stat st;
|
||||
+ struct stat *sbuf = &st;
|
||||
+ bool is_empty;
|
||||
+ int dirent_type;
|
||||
+ int write_protected = 0;
|
||||
+ int wp_errno = 0;
|
||||
+
|
||||
if (is_empty_p)
|
||||
*is_empty_p = T_UNKNOWN;
|
||||
|
||||
- struct stat st;
|
||||
- struct stat *sbuf = &st;
|
||||
cache_stat_init (sbuf);
|
||||
|
||||
- int dirent_type = is_dir ? DT_DIR : DT_UNKNOWN;
|
||||
- int write_protected = 0;
|
||||
+ dirent_type = is_dir ? DT_DIR : DT_UNKNOWN;
|
||||
|
||||
/* When nonzero, this indicates that we failed to remove a child entry,
|
||||
either because the user declined an interactive prompt, or due to
|
||||
@@ -238,7 +244,6 @@
|
||||
if (x->interactive == RMI_NEVER)
|
||||
return RM_OK;
|
||||
|
||||
- int wp_errno = 0;
|
||||
if (!x->ignore_missing_files
|
||||
&& ((x->interactive == RMI_ALWAYS) || x->stdin_tty)
|
||||
&& dirent_type != DT_LNK)
|
||||
@@ -286,15 +291,12 @@
|
||||
break;
|
||||
}
|
||||
|
||||
- char const *quoted_name = quote (full_name);
|
||||
-
|
||||
if (write_protected < 0)
|
||||
{
|
||||
error (0, wp_errno, _("cannot remove %s"), quoted_name);
|
||||
return RM_ERROR;
|
||||
}
|
||||
|
||||
- bool is_empty;
|
||||
if (is_empty_p)
|
||||
{
|
||||
is_empty = is_empty_dir (fd_cwd, filename);
|
||||
@@ -473,6 +475,8 @@
|
||||
static enum RM_status
|
||||
rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x)
|
||||
{
|
||||
+ bool is_dir;
|
||||
+ enum RM_status s;
|
||||
switch (ent->fts_info)
|
||||
{
|
||||
case FTS_D: /* preorder directory */
|
||||
@@ -557,8 +561,8 @@
|
||||
return RM_ERROR;
|
||||
}
|
||||
|
||||
- bool is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR;
|
||||
- enum RM_status s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL);
|
||||
+ is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR;
|
||||
+ s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL);
|
||||
if (s != RM_OK)
|
||||
return s;
|
||||
return excise (fts, ent, x, is_dir);
|
||||
@@ -593,6 +597,8 @@
|
||||
rm (char *const *file, struct rm_options const *x)
|
||||
{
|
||||
enum RM_status rm_status = RM_OK;
|
||||
+ FTS *fts;
|
||||
+ enum RM_status s;
|
||||
|
||||
if (*file)
|
||||
{
|
||||
@@ -603,7 +609,7 @@
|
||||
if (x->one_file_system)
|
||||
bit_flags |= FTS_XDEV;
|
||||
|
||||
- FTS *fts = xfts_open (file, bit_flags, NULL);
|
||||
+ fts = xfts_open (file, bit_flags, NULL);
|
||||
|
||||
while (1)
|
||||
{
|
||||
@@ -620,7 +626,7 @@
|
||||
break;
|
||||
}
|
||||
|
||||
- enum RM_status s = rm_fts (fts, ent, x);
|
||||
+ s = rm_fts (fts, ent, x);
|
||||
|
||||
assert (VALID_STATUS (s));
|
||||
UPDATE_STATUS (rm_status, s);
|
||||
diff -urN coreutils-8.5/src/rm.c coreutils-8.5-gcc2/src/rm.c
|
||||
--- coreutils-8.5/src/rm.c 2010-04-20 19:52:05.032768000 +0000
|
||||
+++ coreutils-8.5-gcc2/src/rm.c 2010-09-24 14:46:12.000000000 +0000
|
||||
@@ -208,6 +208,9 @@
|
||||
struct rm_options x;
|
||||
bool prompt_once = false;
|
||||
int c;
|
||||
+ size_t n_files;
|
||||
+ char **file;
|
||||
+ enum RM_status status;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
set_program_name (argv[0]);
|
||||
@@ -334,8 +337,8 @@
|
||||
quote ("/"));
|
||||
}
|
||||
|
||||
- size_t n_files = argc - optind;
|
||||
- char **file = argv + optind;
|
||||
+ n_files = argc - optind;
|
||||
+ file = argv + optind;
|
||||
|
||||
if (prompt_once && (x.recursive || 3 < n_files))
|
||||
{
|
||||
@@ -348,7 +351,7 @@
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
- enum RM_status status = rm (file, &x);
|
||||
+ status = rm (file, &x);
|
||||
assert (VALID_STATUS (status));
|
||||
exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
||||
diff -urN coreutils-8.5/src/seq.c coreutils-8.5-gcc2/src/seq.c
|
||||
--- coreutils-8.5/src/seq.c 2010-01-01 13:06:47.036175872 +0000
|
||||
+++ coreutils-8.5-gcc2/src/seq.c 2010-09-24 14:50:32.000000000 +0000
|
||||
@@ -132,6 +132,7 @@
|
||||
scan_arg (const char *arg)
|
||||
{
|
||||
operand ret;
|
||||
+ char const *e;
|
||||
|
||||
if (! xstrtold (arg, NULL, &ret.value, c_strtold))
|
||||
{
|
||||
@@ -161,7 +162,7 @@
|
||||
: (decimal_point == arg /* .# -> 0.# */
|
||||
|| ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */
|
||||
}
|
||||
- char const *e = strchr (arg, 'e');
|
||||
+ e = strchr (arg, 'e');
|
||||
if (! e)
|
||||
e = strchr (arg, 'E');
|
||||
if (e)
|
||||
@@ -311,6 +312,7 @@
|
||||
{
|
||||
if (equal_width)
|
||||
{
|
||||
+ size_t width;
|
||||
/* increase first_width by any increased precision in step */
|
||||
size_t first_width = first.width + (prec - first.precision);
|
||||
/* adjust last_width to use precision from first/step */
|
||||
@@ -319,7 +321,7 @@
|
||||
last_width--; /* don't include space for '.' */
|
||||
if (last.precision == 0 && prec)
|
||||
last_width++; /* include space for '.' */
|
||||
- size_t width = MAX (first_width, last_width);
|
||||
+ width = MAX (first_width, last_width);
|
||||
if (width <= INT_MAX)
|
||||
{
|
||||
int w = width;
|
||||
diff -urN coreutils-8.5/src/shred.c coreutils-8.5-gcc2/src/shred.c
|
||||
--- coreutils-8.5/src/shred.c 2010-01-01 13:06:47.035651584 +0000
|
||||
+++ coreutils-8.5-gcc2/src/shred.c 2010-09-24 14:58:02.000000000 +0000
|
||||
@@ -468,7 +468,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;
|
||||
diff -urN coreutils-8.5/src/sort.c coreutils-8.5-gcc2/src/sort.c
|
||||
--- coreutils-8.5/src/sort.c 2010-04-21 07:06:17.044040192 +0000
|
||||
+++ coreutils-8.5-gcc2/src/sort.c 2010-09-24 15:04:51.000000000 +0000
|
||||
@@ -1794,6 +1794,7 @@
|
||||
|
||||
const unsigned char *p = number;
|
||||
|
||||
+ int order;
|
||||
int sign = 1;
|
||||
|
||||
if (*p == '-')
|
||||
@@ -1818,7 +1819,7 @@
|
||||
p += 2;
|
||||
}
|
||||
|
||||
- int order = orders[*p];
|
||||
+ order = orders[*p];
|
||||
|
||||
/* For valid units check for MiB vs MB etc. */
|
||||
if (order)
|
||||
@@ -1835,13 +1836,16 @@
|
||||
static int
|
||||
human_numcompare (const char *a, const char *b, struct keyfield *key)
|
||||
{
|
||||
+ int order_a;
|
||||
+ int order_b;
|
||||
+
|
||||
while (blanks[to_uchar (*a)])
|
||||
a++;
|
||||
while (blanks[to_uchar (*b)])
|
||||
b++;
|
||||
|
||||
- int order_a = find_unit_order (a, key);
|
||||
- int order_b = find_unit_order (b, key);
|
||||
+ order_a = find_unit_order (a, key);
|
||||
+ order_b = find_unit_order (b, key);
|
||||
|
||||
return (order_a > order_b ? 1
|
||||
: order_a < order_b ? -1
|
||||
@@ -2081,6 +2085,8 @@
|
||||
|
||||
for (;;)
|
||||
{
|
||||
+ size_t lena;
|
||||
+ size_t lenb;
|
||||
char const *translate = key->translate;
|
||||
bool const *ignore = key->ignore;
|
||||
|
||||
@@ -2089,8 +2095,8 @@
|
||||
limb = MAX (textb, limb);
|
||||
|
||||
/* Find the lengths. */
|
||||
- size_t lena = lima - texta;
|
||||
- size_t lenb = limb - textb;
|
||||
+ lena = lima - texta;
|
||||
+ lenb = limb - textb;
|
||||
|
||||
/* Actually compare the fields. */
|
||||
|
||||
@@ -2879,6 +2885,9 @@
|
||||
{
|
||||
/* Merge directly into the output file if possible. */
|
||||
FILE **fps;
|
||||
+ FILE *tfp;
|
||||
+ pid_t pid;
|
||||
+ char *temp;
|
||||
size_t nopened = open_input_files (files, nfiles, &fps);
|
||||
|
||||
if (nopened == nfiles)
|
||||
@@ -2900,9 +2909,6 @@
|
||||
file with our spare file descriptor. Retry if that failed
|
||||
(e.g., some other process could open a file between the time
|
||||
we closed and tried to create). */
|
||||
- FILE *tfp;
|
||||
- pid_t pid;
|
||||
- char *temp;
|
||||
do
|
||||
{
|
||||
nopened--;
|
||||
diff -urN coreutils-8.5/src/system.h coreutils-8.5-gcc2/src/system.h
|
||||
--- coreutils-8.5/src/system.h 2010-04-20 19:52:05.040108032 +0000
|
||||
+++ coreutils-8.5-gcc2/src/system.h 2010-09-24 13:37:18.000000000 +0000
|
||||
@@ -585,6 +585,7 @@
|
||||
static inline void
|
||||
emit_ancillary_info (void)
|
||||
{
|
||||
+ const char *lc_messages;
|
||||
printf (_("\nReport %s bugs to %s\n"), last_component (program_name),
|
||||
PACKAGE_BUGREPORT);
|
||||
/* FIXME 2010: use AC_PACKAGE_URL once we require autoconf-2.64 */
|
||||
@@ -594,7 +595,7 @@
|
||||
stdout);
|
||||
/* Don't output this redundant message for English locales.
|
||||
Note we still output for 'C' so that it gets included in the man page. */
|
||||
- const char *lc_messages = setlocale (LC_MESSAGES, NULL);
|
||||
+ lc_messages = setlocale (LC_MESSAGES, NULL);
|
||||
if (lc_messages && strncmp (lc_messages, "en_", 3))
|
||||
{
|
||||
/* TRANSLATORS: Replace LANG_CODE in this URL with your language code
|
||||
diff -urN coreutils-8.5/src/tac.c coreutils-8.5-gcc2/src/tac.c
|
||||
--- coreutils-8.5/src/tac.c 2010-03-13 15:14:09.040632320 +0000
|
||||
+++ coreutils-8.5-gcc2/src/tac.c 2010-09-24 15:06:41.000000000 +0000
|
||||
@@ -572,6 +572,7 @@
|
||||
were specified on the command line. */
|
||||
static char const *const default_file_list[] = {"-", NULL};
|
||||
char const *const *file;
|
||||
+ void *buf;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
set_program_name (argv[0]);
|
||||
@@ -633,7 +634,7 @@
|
||||
if (! (read_size < half_buffer_size && half_buffer_size < G_buffer_size))
|
||||
xalloc_die ();
|
||||
G_buffer = xmalloc (G_buffer_size);
|
||||
- void *buf = G_buffer;
|
||||
+ buf = G_buffer;
|
||||
if (sentinel_length)
|
||||
{
|
||||
strcpy (G_buffer, separator);
|
||||
diff -urN coreutils-8.5/src/wc.c coreutils-8.5-gcc2/src/wc.c
|
||||
--- coreutils-8.5/src/wc.c 2010-04-20 19:52:05.035127296 +0000
|
||||
+++ coreutils-8.5-gcc2/src/wc.c 2010-09-24 15:11:46.000000000 +0000
|
||||
@@ -584,12 +584,15 @@
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
bool ok;
|
||||
+ int i;
|
||||
int optc;
|
||||
int nfiles;
|
||||
char **files;
|
||||
char *files_from = NULL;
|
||||
struct fstatus *fstatus;
|
||||
struct Tokens tok;
|
||||
+ bool read_tokens = false;
|
||||
+ struct argv_iterator *ai;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
set_program_name (argv[0]);
|
||||
@@ -646,11 +649,10 @@
|
||||
|| print_linelength))
|
||||
print_lines = print_words = print_bytes = true;
|
||||
|
||||
- bool read_tokens = false;
|
||||
- struct argv_iterator *ai;
|
||||
if (files_from)
|
||||
{
|
||||
FILE *stream;
|
||||
+ struct stat st;
|
||||
|
||||
/* When using --files0-from=F, you may not specify any files
|
||||
on the command-line. */
|
||||
@@ -674,7 +676,6 @@
|
||||
|
||||
/* Read the file list into RAM if we can detect its size and that
|
||||
size is reasonable. Otherwise, we'll read a name at a time. */
|
||||
- struct stat st;
|
||||
if (fstat (fileno (stream), &st) == 0
|
||||
&& S_ISREG (st.st_mode)
|
||||
&& st.st_size <= MIN (10 * 1024 * 1024, physmem_available () / 2))
|
||||
@@ -706,7 +707,6 @@
|
||||
fstatus = get_input_fstatus (nfiles, files);
|
||||
number_width = compute_number_width (nfiles, fstatus);
|
||||
|
||||
- int i;
|
||||
ok = true;
|
||||
for (i = 0; /* */; i++)
|
||||
{
|
||||
Reference in New Issue
Block a user