-
Notifications
You must be signed in to change notification settings - Fork 92
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
tarfile add method bombs because lstat returns a uid of None #449
Comments
Currently we do not support I agree that this is inconvenient - the case just never came up before. Recently, we added the possibility to set the current user ID (via |
- allow to set current group ID - see #449
@ut-adamc - I made the above-mentioned changes. |
Thanks. It does get past that error. There is still another error, which I think is due to tarfile saving the prior value of the open function as "bltn_open" and then using that to open the tarfile. I think for the tarfile module to work, you would also need to hook bltn_open. |
This is the kind of thing that is difficult to hook generically. Using the |
I just looked at the tarfile source code, and the line you have been mentioning is: from builtins import open as bltn_open This is not as tricky as I thought - maybe we can handle this generically. |
@ut-adamc - I added code to patch this kind of import automatically. Can you please check if the code in master works for you? |
This shall now be fixed in the released version - closing. Please reopen if this is not sufficient for you. |
When you call tarfile's .add method, it calls lstat underneath the scenes. When using fake_filesystem_unittest, the lstat call returns an st_uid value of None. This causes tarfile to raise an exception.
The following example demonstrates the problem. I tested with version 3.5.
The text was updated successfully, but these errors were encountered: