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

Fix: Generate valid tar archives #276

Merged
merged 2 commits into from
Aug 1, 2023

Conversation

johnhany97
Copy link
Contributor

Before this change

Archives produced from rattler-build, which under the hood use functionalities in this crate, couldn't be un-archived.

I manually proved this by persisting outputs of the write_tar_bz2 function in one of the tests, and then manually running

tar -xzvf pytweening-1.0.4-pyhd8ed1ab_0.tar-new.tar.bz2

which would before this change yield the following error:

tar: Error opening archive: Unrecognized archive format

This error would also appear if I were to try and install that package using mamba:

InvalidArchiveError('Error with archive /path/to/pytweening-1.0.4-pyhd8ed1ab_0.tar-new.tar.bz2.  You probably need to delete and re-download or re-create this file.  Message was:\n\nfailed with error: invalid header')

After this change

I can successfully un-archive the file

$ tar -xzvf pytweening-1.0.4-pyhd8ed1ab_0.tar-new.tar.bz2
x info/about.json
x info/files
x info/git
x info/hash_input.json
x info/index.json
x info/licenses/LICENSE.txt
x info/link.json
x info/paths.json
x info/recipe/conda_build_config.yaml
x info/recipe/meta.yaml
x info/recipe/meta.yaml.template
x info/recipe/recipe-scripts-license.txt
x info/test/run_test.bat
x info/test/run_test.py
x info/test/run_test.sh
x info/test/test_time_dependencies.json
x site-packages/pytweening/__init__.py
x site-packages/pytweening-1.0.4.dist-info/AUTHORS.txt
x site-packages/pytweening-1.0.4.dist-info/INSTALLER
x site-packages/pytweening-1.0.4.dist-info/LICENSE.txt
x site-packages/pytweening-1.0.4.dist-info/METADATA
x site-packages/pytweening-1.0.4.dist-info/RECORD
x site-packages/pytweening-1.0.4.dist-info/REQUESTED
x site-packages/pytweening-1.0.4.dist-info/WHEEL
x site-packages/pytweening-1.0.4.dist-info/direct_url.json
x site-packages/pytweening-1.0.4.dist-info/top_level.txt

and also install it directly using mamba.

header.set_mtime(timestamp.timestamp() as u64);
header.set_mtime(timestamp.timestamp().unsigned_abs());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a drive-by change. It's the other lines below that actually make the difference

@baszalmstra baszalmstra merged commit 2b59f44 into conda-incubator:main Aug 1, 2023
2 checks passed
@baszalmstra
Copy link
Collaborator

thanks! this looks great!

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

Successfully merging this pull request may close these issues.

None yet

2 participants