upstream consolidation: verbose outputs should be on stdout if possible

This commit is contained in:
Ondrej Vasik 2008-03-03 14:00:19 +00:00
parent 6feaf70251
commit d3c0f6f098
2 changed files with 194 additions and 2 deletions

View File

@ -0,0 +1,187 @@
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index df6792d..e3a0d50 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -2838,7 +2838,7 @@ Use digits in suffixes rather than lower-case letters.
@itemx --verbose
@opindex --verbose
-Write a diagnostic to standard error just before each output file is opened.
+Write a diagnostic just before each output file is opened.
@end table
@@ -8190,7 +8190,7 @@ If a file has multiple links, only the named links will be removed.
@itemx --verbose
@opindex -v
@opindex --verbose
-Display status updates as sterilization proceeds.
+Display to standard error status updates as sterilization proceeds.
@item -x
@itemx --exact
diff --git a/src/install.c b/src/install.c
index db08751..95e37fc 100644
--- a/src/install.c
+++ b/src/install.c
@@ -1,5 +1,5 @@
/* install - copy files and set attributes
- Copyright (C) 89, 90, 91, 1995-2007 Free Software Foundation, Inc.
+ Copyright (C) 89, 90, 91, 1995-2008 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
@@ -762,7 +762,7 @@ announce_mkdir (char const *dir, void *options)
{
struct cp_options const *x = options;
if (x->verbose)
- error (0, 0, _("creating directory %s"), quote (dir));
+ printf (_("%s: creating directory %s\n"), program_name, quote (dir));
}
/* Make ancestor directory DIR, whose last file name component is
diff --git a/src/rmdir.c b/src/rmdir.c
index bb1a0c8..609c387 100644
--- a/src/rmdir.c
+++ b/src/rmdir.c
@@ -1,6 +1,6 @@
/* rmdir -- remove directories
- Copyright (C) 90, 91, 1995-2002, 2004, 2005, 2006, 2007 Free Software
+ Copyright (C) 90, 91, 1995-2002, 2004-2008 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -134,7 +134,7 @@ remove_parents (char *dir)
/* Give a diagnostic for each attempted removal if --verbose. */
if (verbose)
- error (0, 0, _("removing directory, %s"), quote (dir));
+ printf(_("%s: removing directory, %s\n"), program_name, quote (dir));
ok = (rmdir (dir) == 0);
@@ -233,7 +233,7 @@ main (int argc, char **argv)
/* Give a diagnostic for each attempted removal if --verbose. */
if (verbose)
- error (0, 0, _("removing directory, %s"), dir);
+ printf(_("%s: removing directory, %s\n"), program_name, dir);
if (rmdir (dir) != 0)
{
diff --git a/src/mkdir.c b/src/mkdir.c
index 0704077..3781065 100644
--- a/src/mkdir.c
+++ b/src/mkdir.c
@@ -1,5 +1,5 @@
/* mkdir -- make directories
- Copyright (C) 90, 1995-2002, 2004-2007 Free Software Foundation, Inc.
+ Copyright (C) 90, 1995-2002, 2004-2008 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
@@ -79,6 +79,19 @@ Mandatory arguments to long options are mandatory for short options too.\n\
exit (status);
}
+/* Verbose formatted output of variable count of arguments. */
+static void
+verbose_output (FILE *fp, char const *fmt, ...)
+{
+ va_list ap;
+ fputs (program_name, fp);
+ fputs (": ", fp);
+ va_start (ap, fmt);
+ vfprintf (fp, fmt, ap);
+ va_end (ap);
+ fputc ('\n', fp);
+}
+
/* Options passed to subsidiary functions. */
struct mkdir_options
{
@@ -105,7 +118,7 @@ announce_mkdir (char const *dir, void *options)
{
struct mkdir_options const *o = options;
if (o->created_directory_format)
- error (0, 0, o->created_directory_format, quote (dir));
+ verbose_output (stdout, o->created_directory_format, quote (dir));
}
/* Make ancestor directory DIR, whose last component is COMPONENT,
diff --git a/src/split.c b/src/split.c
index 5807a1c..f84d40e 100644
--- a/src/split.c
+++ b/src/split.c
@@ -1,5 +1,5 @@
/* split.c -- split a file into pieces.
- Copyright (C) 1988, 1991, 1995-2007 Free Software Foundation, Inc.
+ Copyright (C) 1988, 1991, 1995-2008 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
@@ -122,8 +122,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
-l, --lines=NUMBER put NUMBER lines per output file\n\
"), DEFAULT_SUFFIX_LENGTH);
fputs (_("\
- --verbose print a diagnostic to standard error just\n\
- before each output file is opened\n\
+ --verbose print a diagnostic just before each\n\
+ output file is opened\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
@@ -208,7 +208,7 @@ cwrite (bool new_file_flag, const char *bp, size_t bytes)
next_file_name ();
if (verbose)
- fprintf (stderr, _("creating file %s\n"), quote (outfile));
+ fprintf (stdout, _("creating file %s\n"), quote (outfile));
output_desc = open (outfile,
O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
diff --git a/tests/misc/split-a b/tests/misc/split-a
index 794115f..a8eed38 100755
--- a/tests/misc/split-a
+++ b/tests/misc/split-a
@@ -1,7 +1,7 @@
#!/bin/sh
# Show that split -a works.
-# Copyright (C) 2002-2007 Free Software Foundation, Inc.
+# Copyright (C) 2002-2008 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
@@ -39,7 +39,7 @@ test -f xaz && fail=1
rm -f x*
# With a longer suffix, it must succeed.
-split --verbose -b 1 -a 2 in 2> err || fail=1
+split --verbose -b 1 -a 2 in > err || fail=1
test -f xaa || fail=1
test -f xaz || fail=1
test -f xba || fail=1
diff --git a/tests/mkdir/p-v b/tests/mkdir/p-v
index 2c84b41..569e9b0 100755
--- a/tests/mkdir/p-v
+++ b/tests/mkdir/p-v
@@ -1,7 +1,7 @@
#!/bin/sh
# Test mkdir -pv.
-# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2006-2008 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
@@ -24,7 +24,7 @@ fi
. $srcdir/../lang-default
. $srcdir/../test-lib.sh
-mkdir -pv foo/a/b/c/d 2>out || exit
+mkdir -pv foo/a/b/c/d >out || exit
diff - out <<\EOF
mkdir: created directory `foo'

View File

@ -1,7 +1,7 @@
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
Name: coreutils
Version: 6.10
Release: 8%{?dist}
Release: 9%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -18,6 +18,7 @@ Source202: coreutils-su-l.pamd
Source203: coreutils-runuser-l.pamd
# From upstream
Patch1:coreutils-6.10-verbose.patch
# Our patches
Patch100: coreutils-chgrp.patch
@ -95,6 +96,7 @@ lzma -dc %SOURCE0 | tar xf -
cd %name-%version
# From upstream
%patch1 -p1 -b .verbose
# Our patches
%patch100 -p1 -b .chgrp
@ -245,7 +247,7 @@ fi
%defattr(-,root,root,-)
%dir %{_datadir}/locale/*/LC_TIME
%config(noreplace) %{_sysconfdir}/DIR_COLORS*
%config %{_sysconfdir}/profile.d/*
%config(noreplace) %{_sysconfdir}/profile.d/*
%{?!nopam:%config(noreplace) %{_sysconfdir}/pam.d/su}
%{?!nopam:%config(noreplace) %{_sysconfdir}/pam.d/su-l}
%{?!nopam:%config(noreplace) %{_sysconfdir}/pam.d/runuser}
@ -291,6 +293,9 @@ fi
/sbin/runuser
%changelog
* Mon Mar 3 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-9
- consolidation of verbose output to stdout (upstream)
* Mon Feb 18 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-8
- use default security context in install - broken by
coreutils-6.10 update(#319231)