Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 3358

Summary: cpio verbose output is on stderr instead of (SVR4) stdout
Product: [Retired] Red Hat Linux Reporter: eczema
Component: cpioAssignee: bero
Status: CLOSED WONTFIX QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 6.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-12-17 18:54:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description eczema 1999-06-09 10:11:53 UTC
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 10:45:59 UTC
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 13:05:59 UTC
OK, I understand now. I'm changing the summary to clarify ...

Comment 3 eczema 1999-06-09 17:53:59 UTC
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 18:05:59 UTC
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 18:39:59 UTC
sorry reload cause this double sending...

oops :-)

Alain

Comment 6 Alan Cox 1999-06-12 17:25:59 UTC
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 19:16:59 UTC
Fixed in cpio-2.4.2-13. Thanks for the patch.

Comment 8 Jeff Johnson 1999-12-17 18:54:59 UTC
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 15:11:43 UTC
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