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

Use GNU_FORMAT for tarfiles for dpkg compatibility. #201

Closed
wants to merge 2 commits into from

Conversation

itdaniher
Copy link

Add the format=tarfile.GNU_FORMAT to tarfile.open arguments to address Py3.8 change "The default format for new archives was changed to PAX_FORMAT from GNU_FORMAT."

and resulting

unsupported PAX tar header type 'x'

on dpkg --install

Google CLA signed today.

…s Py3.8 change "The default format for new archives was changed to PAX_FORMAT from GNU_FORMAT."

and resulting

> unsupported PAX tar header type 'x'

on `dpkg --install`
@itdaniher itdaniher requested a review from aiuto as a code owner July 13, 2020 20:36
@itdaniher
Copy link
Author

I've verified this fixes the "unsupported PAX tar header" issue when building debs containing tarballs via the following patch:

-http_archive(
+git_repository(
     name = "rules_pkg",
-    sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a",
-    url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
+    remote = "https://github.com/itdaniher/rules_pkg.git",
+    commit = "b16882f7d5f15201dd3d49b5aadd67cabca57b9f",
+    patch_cmds = ["mv pkg/* ."]
 )

Copy link
Collaborator

@aiuto aiuto left a comment

Choose a reason for hiding this comment

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

3 things first:

  • Please create an issue for new features before sending a PR
  • This needs integration tests. You are probably better off waiting until my PR changing the tar tests goes in
  • you are changing the format, this needs to be behind a flag.

@itdaniher
Copy link
Author

@aiuto Thanks for the timely response.

This is not a new feature, but a bugfix for a behavior change introduced in Python 3.8 causing rules_pkg creates invalid deb files if they contained tarballs. dpkg is not capable of parsing the created PAX-type headers, resulting in

corrupted filesystem tarfile in package archive: unsupported PAX tar header type 'x'"

upon install attempt.

I'll open an issue for this bugfix, which merely ensures rules_pkg produces the same format of archive on Ubuntu 20.04 as it does in your 14.04 CI.

Can you elaborate the use case for a flag (enabling PAX_FORMAT) which creates invalid deb files?

@andrewalker
Copy link

@itdaniher oh, you hit basically the same issue as I did! Maybe the tests here are helpful: #204

@andrewalker
Copy link

@aiuto it's worth noting that this patch is a no-op in Python < 3.8, since the default was GNU_FORMAT up until that point. This avoids a breaking change by keeping the default the same, so I also don't see the point in a flag.

@aiuto
Copy link
Collaborator

aiuto commented Jul 14, 2020

I see your point, but I want to look into this deeper. That probably won't be until next week.

@aiuto
Copy link
Collaborator

aiuto commented Aug 7, 2020

Sorry I took so long. I wanted to fix the testing of debian packages first. One #211 goes in, I will look at this and #204 and see which to apply.

@aiuto
Copy link
Collaborator

aiuto commented Aug 7, 2020

Let's go with #204, since that has test cases for long file names.

@aiuto aiuto closed this Aug 7, 2020
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.

3 participants