New submission from Jesse Kinkead <jesse.kink...@gmail.com>:

tarfile.open has a "name" parameter that can be used to open a file for reading 
or writing in the local filesystem. The documentation is unclear what the 
purpose is if providing a "fileobj" parameter as well, but it has very 
surprising behavior when the name matches an existing directory.

Specifically, when you provide a "fileobj" for writing and provide a "name" 
that matches an existing directory, calling .add() on that directory will have 
it (and any child files) to be silently skipped.

The desired behavior is either to have the files be added (consistent with 
"name" being totally ignored), or to have it be an error to provide such a 
"name" value (either one that matches an existing directory, or to provide one 
at all when using "fileobj").

----------
components: Library (Lib)
files: repro.py
messages: 404217
nosy: jkinkead
priority: normal
severity: normal
status: open
title: TarFile.add skips files when tarfile name matches a directory
versions: Python 3.8
Added file: https://bugs.python.org/file50367/repro.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45517>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to