Skip to content

bpo-41728: Debug logging when adding TarInfo object #22116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

llamafilm
Copy link

@llamafilm llamafilm commented Sep 5, 2020

bpo-41728: Debug logging when adding TarInfo

Log attributes of the TarInfo object including name, size mtime, mode, uname, and gname when using addfile()
Only when debug=3. This level appears to be unused although it is already documented.
The add() method already logs the name, but this logs the arcname instead so it's not redundant.

https://bugs.python.org/issue41728

Use debug level 3 which is currently unused although it is documented.
@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@llamafilm

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@llamafilm llamafilm changed the title Debug logging when adding TarInfo object bpo-41728: Debug logging when adding TarInfo object Sep 6, 2020
Lib/tarfile.py Outdated
@@ -2009,6 +2009,8 @@ def addfile(self, tarinfo, fileobj=None):
blocks += 1
self.offset += blocks * BLOCKSIZE

self._dbg(3, "%s, size: %i, mtime: %.0f, mode: %i, uname: %s, gname: %s" % (tarinfo.name, tarinfo.size, tarinfo.mtime, tarinfo.mode, tarinfo.uname, tarinfo.gname))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use an f-string and wrap lines at 79 characters.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every other log message in this code uses % interpolation so I just tried to match the style.

@ZackerySpytz
Copy link
Contributor

Unfortunately, this PR might not be accepted.

@python-cla-bot
Copy link

The following commit authors need to sign the Contributor License Agreement:

CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants