Skip to content
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

New cph extracts directory permissions differently #184

Open
2 tasks done
wolfv opened this issue Dec 27, 2022 · 7 comments
Open
2 tasks done

New cph extracts directory permissions differently #184

wolfv opened this issue Dec 27, 2022 · 7 comments
Labels
pending::feedback indicates we are waiting on feedback from the user type::bug describes erroneous operation, use severity::* to classify the type

Comments

@wolfv
Copy link

wolfv commented Dec 27, 2022

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

The new conda package handling extracts directory permissions differently (sets writable bit) compared to how libarchive handled them.

The directories are actually implicitly created (on the fly).
Not sure if this is serious, but might be interesting to fix (also makes the directories appear "less weird" in the terminal :)

Here is a screenshot with the new cph on top, and using the cph_test_data... package from the this repo.

Screenshot 2022-12-27 at 19 16 00

Conda Info

No response

Conda Config

No response

Conda list

No response

Additional Context

No response

@wolfv wolfv added the type::bug describes erroneous operation, use severity::* to classify the type label Dec 27, 2022
@dholth
Copy link
Contributor

dholth commented Jan 4, 2023

conda-package-handling 2.0 assumes Python tarfile would be acceptable, since conda used it until a few years ago (2018?)

This tarfile subclass helps to control permissions https://github.com/conda/conda-package-streaming/blob/main/conda_package_streaming/package_streaming.py#L32 but it should only affect chown, not chmod. Intended only to prevent https://github.com/conda/conda/blob/main/conda/gateways/disk/create.py#L217 from being necessary.

https://github.com/python/cpython/blob/3.11/Lib/tarfile.py#L2281 is the overridden method.

We also added anonymize_tarinfo to clear all uid, gid, uname, gname as 0, "" https://github.com/conda/conda-package-handling/blob/main/src/conda_package_handling/utils.py#L486 which also should not affect perms.

Do I see two shots of the new behavior in the screenshot?

@dholth
Copy link
Contributor

dholth commented Jan 4, 2023

On my OSX laptop, umask is 022, cph_test_data.tar.bz2 does not include explicit directory entries (that would otherwise be used to set directory permissions after tarfile.py extractall was finished), and

% cph -V
conda-package-handling 2.0.2

cph x cph_test_data-0.0.1-0.tar.bz2

% ls -lh cph_test_data-0.0.1-0
total 0
drwxr-xr-x   4 dholth  staff   128B Jan  4 17:41 bin
drwxr-xr-x  10 dholth  staff   320B Jan  4 17:41 info
drwxr-xr-x   8 dholth  staff   256B Jan  4 17:41 lib
drwxr-xr-x   3 dholth  staff    96B Jan  4 17:41 libexec
drwxr-xr-x   4 dholth  staff   128B Jan  4 17:41 share
% tar -xf ../cph_test_data-0.0.1-0.tar.bz2 
% ls -lh
drwxr-xr-x   4 dholth  staff   128B Jan  4 17:46 bin
drwxr-xr-x  10 dholth  staff   320B Jan  4 17:46 info
drwxr-xr-x   8 dholth  staff   256B Jan  4 17:46 lib
drwxr-xr-x   3 dholth  staff    96B Jan  4 17:46 libexec
drwxr-xr-x   4 dholth  staff   128B Jan  4 17:46 share

python -m tarfile -e ../cph_test_data-0.0.1-0.tar.bz2

% ls -lh t3
total 0
drwxr-xr-x   4 dholth  staff   128B Jan  4 17:45 bin
drwxr-xr-x  10 dholth  staff   320B Jan  4 17:45 info
drwxr-xr-x   8 dholth  staff   256B Jan  4 17:45 lib
drwxr-xr-x   3 dholth  staff    96B Jan  4 17:45 libexec
drwxr-xr-x   4 dholth  staff   128B Jan  4 17:45 share

@wolfv
Copy link
Author

wolfv commented Jan 5, 2023

hey, sorry for little explanation on the screenshots. the first one is the new one (on Linux) that shows that the permissions are extracted differently. I tested it in a Github Codespace.
The lowest one is the old conda package handling, and the center one is micromamba.

@dholth
Copy link
Contributor

dholth commented Jan 5, 2023

In Linux, in conda's own dockerfile container, I get permissions like

drwxr-sr-x 5 test_user test_user 4.0K Jan  5 16:32 info
drwxr-sr-x 3 test_user test_user 4.0K Jan  5 16:32 lib

@dholth
Copy link
Contributor

dholth commented Jan 5, 2023

I see a number of vscode remote issues related to umask? Could this be related?

@dholth
Copy link
Contributor

dholth commented Jan 5, 2023

Relevant libarchive flags for conda-package-handling 1.x series? https://github.com/conda/conda-package-handling/blob/1.9.0/src/conda_package_handling/archive_utils_c.c#L144

@dholth
Copy link
Contributor

dholth commented Jul 28, 2023

We updated conda-package-streaming (which conda-package-handling uses) to respect umask. Does conda/conda-package-streaming#65 fix this issue?

@dholth dholth added the pending::feedback indicates we are waiting on feedback from the user label Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending::feedback indicates we are waiting on feedback from the user type::bug describes erroneous operation, use severity::* to classify the type
Projects
Status: No status
Development

No branches or pull requests

2 participants