This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: debug info file descriptor of tarfile is inconsistent
Type: Stage:
Components: Documentation Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, georg.brandl, lars.gustaebel, quiver, rhettinger
Priority: normal Keywords:

Created on 2005-07-09 16:24 by quiver, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tarfile-stderr.diff georg.brandl, 2005-07-11 06:19
zipfile-stderr.diff georg.brandl, 2005-07-11 06:19
Messages (7)
msg25775 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2005-07-09 16:24
"7.19.1 TarFile Objects" says
  The messages are written to sys.stdout.
but they are actually written to sys.stderr ::

  def _dbg(self, level, msg):
      """Write debugging output to sys.stderr.
      """
      if level <= self.debug:
          print >> sys.stderr, msg

There are 2 options:
(a) change document from stdout to stderr.
(b) rewrite the code to use stdout.

Given this is debug messages and most other modules 
use stdout for debug printing(gc is one of the few 
exceptions?), I'm +1 on (b).

[*] http://docs.python.org/lib/tarfile-objects.html
msg25776 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-07-09 17:04
Logged In: YES 
user_id=1188172

The documentation seems to be borrowed from zipfile, where
the statement is true: debug info is written to stdout.

I'm in favour of changing the docs to stderr for tarfile.
What about zipfile? Should we print debug info to stderr
there, too?
msg25777 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2005-07-10 08:00
Logged In: YES 
user_id=642936

This is a documentation error. Debug messages must go to
stderr because that's what stderr is for. Think of a script
that writes a tar archive to stdout for use in a unix shell
pipeline. If debug messages went to stdout, too, it would
produce unusable output, because archive data and debug
messages would be mixed.
msg25778 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2005-07-10 16:26
Logged In: YES 
user_id=671362

OK. I tested some GNU compression/decompression tools 
and comfirmed that they write debugging messages
(displayed in verbose mode(-v)) to stderr.

Now I'm leaning toward Reinhold's idea.

> What about zipfile? 
> Should we print debug info to stderr there, too?

Maybe yes.  I'd be happy to volunteer for that patch.
msg25779 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-07-11 06:19
Logged In: YES 
user_id=1188172

Attaching patches for both tarfile and zipfile. For tarfile,
the docs are changed to stderr, for zipfile, both docs and
implementation are changed to stderr.

Since I don't assume that someone actually uses the debug
info in some automated way, I think we can correct this in 2.5.

Raymond, please review.
msg25780 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-07-12 03:06
Logged In: YES 
user_id=80475

Just change the docs to match the actual behavior.  Let's
leave the implementation alone.

There is no great need to have tarfile's implementation
match zipfile.  Someday, all of the modules will generate
messages via the logging module and you'll trivially be able
to mask them or redirect them in a consistent manner.
msg25781 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-07-12 07:29
Logged In: YES 
user_id=1188172

Okay. Checked in Doc/lib/libtarfile.tex r1.10, r1.7.2.1.

And when will be some day?
History
Date User Action Args
2022-04-11 14:56:12adminsetgithub: 42178
2005-07-09 16:24:33quivercreate