Bug 3358 - cpio verbose output is on stderr instead of (SVR4) stdout
cpio verbose output is on stderr instead of (SVR4) stdout
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: cpio (Show other bugs)
6.0
i386 Linux
low Severity low
: ---
: ---
Assigned To: bero
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-06-09 06:11 EDT by eczema
Modified: 2015-07-02 11:11 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-12-17 13:54:54 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description eczema 1999-06-09 06:11:53 EDT
Unlike cpio from other unix the current release on Linux 6.0
write all message on stderr.

For exemple: cpio -iv < /dev/nst0 1>/tmp/log 2>/tmp/error,
will write all informations in /tmp/error.

I've seen in the code that all messages are written to
stderr in the conditionnal routine "verbose"...
Just a change in the source code from stderr to stdout in
this conditionnal case (verbose) and cpio is working
well....
Comment 1 Jeff Johnson 1999-06-09 06:45:59 EDT
I'm not sure what the problem is here. Linux uses GNU cpio which
is a different implementation than what "other unix" vendors
probably use. I would say that other unix vendors have a problem
if they are writing error messages to stdout :-)

You can of course do
	cpio -iv < /dev/nst0 2>&1 > /tmp/log
if you wish all messages in the same file.

Please reopen with more specific details if there is a problem
here.

------- Email Received From  Alain.DEGREFFE@SG.cec.be 06/09/99 09:01 -------
Comment 2 Jeff Johnson 1999-06-09 09:05:59 EDT
OK, I understand now. I'm changing the summary to clarify ...
Comment 3 eczema 1999-06-09 13:53:59 EDT
Find here the patch...

cpio-2.4.2-stderr-stdout.patch

--- cpio-2.4.2/copyin.c Wed Nov 30 23:49:06 1994
+++ cpio-2.4.2/copyin.c Wed Jun  9 17:39:34 1999
@@ -1001,9 +1001,9 @@
            }

          if (verbose_flag)
-           fprintf (stderr, "%s\n", file_hdr.c_name);
+           fprintf (stdout, "%s\n", file_hdr.c_name);
          if (dot_flag)
-           fputc ('.', stderr);
+           fputc ('.', stdout);
        }
     }

--- cpio-2.4.2/copyout.c        Wed Jan 10 17:10:45 1996
+++ cpio-2.4.2/copyout.c        Wed Jun  9 17:53:45 1999
@@ -492,9 +492,9 @@
            }

          if (verbose_flag)
-           fprintf (stderr, "%s\n", input_name.ds_string);
+           fprintf (stdout, "%s\n", input_name.ds_string);
          if (dot_flag)
-           fputc ('.', stderr);
+           fputc ('.', stdout);
        }
     }

Alain

to apply to srpms in patch6 for exemple.... (see cpio SPEC)
Comment 4 eczema 1999-06-09 14:05:59 EDT
Find here the patch...

cpio-2.4.2-stderr-stdout.patch

--- cpio-2.4.2/copyin.c Wed Nov 30 23:49:06 1994
+++ cpio-2.4.2/copyin.c Wed Jun  9 17:39:34 1999
@@ -1001,9 +1001,9 @@
            }

          if (verbose_flag)
-           fprintf (stderr, "%s\n", file_hdr.c_name);
+           fprintf (stdout, "%s\n", file_hdr.c_name);
          if (dot_flag)
-           fputc ('.', stderr);
+           fputc ('.', stdout);
        }
     }

--- cpio-2.4.2/copyout.c        Wed Jan 10 17:10:45 1996
+++ cpio-2.4.2/copyout.c        Wed Jun  9 17:53:45 1999
@@ -492,9 +492,9 @@
            }

          if (verbose_flag)
-           fprintf (stderr, "%s\n", input_name.ds_string);
+           fprintf (stdout, "%s\n", input_name.ds_string);
          if (dot_flag)
-           fputc ('.', stderr);
+           fputc ('.', stdout);
        }
     }

Alain

to apply to srpms in patch6 for exemple.... (see cpio SPEC)
Comment 5 eczema 1999-06-09 14:39:59 EDT
sorry reload cause this double sending...

oops :-)

Alain
Comment 6 Alan Cox 1999-06-12 13:25:59 EDT
The single unix spec is actually quite explicit about what should
be happening:

STDOUT

     When the -o option is used, the standard output is an archive
file formatted as specified by pax with the -x cpio
     option. Otherwise, the standard output contains commentary in an
unspecified format concerning the progress of
     the execution.

STDERR

     When the -o option is not used, the standard error contains
commentary in an unspecified format concerning the
     progress of the execution. Otherwise, the standard error is used
only for diagnostic messages.
Comment 7 Jeff Johnson 1999-08-31 15:16:59 EDT
Fixed in cpio-2.4.2-13. Thanks for the patch.
Comment 8 Jeff Johnson 1999-12-17 13:54:59 EST
This patch has been reverted because GNU cpio appears to be conformant to
the Single Unix Specification without the patch, and the patch caused other
breakage (see #6376, #7538).
Comment 9 openshift-github-bot 2015-07-02 11:11:43 EDT
Commit pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/73fa36753957122e9af7dd034c99af2cb4ef7d62
Merge pull request #3522 from gabemontero/issue3358

Merged by openshift-bot

Note You need to log in before you can comment on or make changes to this bug.