Opened 4 years ago

Closed 4 years ago

#24830 closed defect (fixed)

port uncompress/tar_file.py to python3

Reported by: dimpase Owned by: embray
Priority: blocker Milestone: sage-8.2
Component: python3 Keywords:
Cc: vbraun, embray, chapoton Merged in:
Authors: Erik Bray Reviewers: Dima Pasechnik
Report Upstream: N/A Work issues:
Branch: d6e32e2 (Commits, GitHub, GitLab) Commit: d6e32e2e89e301e2fcf741eaa2c141c4170cffa3
Dependencies: Stopgaps:

Status badges

Description

the internals of python's tarfile.py have changed, and the override of _extract_member in uncompress/tar_file.py misses parameters. Namely, if your system python is python3, you will get

Setting up build directory for patch-2.7.5
Traceback (most recent call last):
  File "/mnt/opt/Sage/sage-clang/build/bin/sage-uncompress-spkg", line 23, in <module>
    run()
  File "/mnt/opt/Sage/sage-clang/build/bin/../sage_bootstrap/uncompress/cmdline.py", line 72, in run
    unpack_archive(archive, dirname)
  File "/mnt/opt/Sage/sage-clang/build/bin/../sage_bootstrap/uncompress/action.py", line 68, in unpack_archive
    archive.extractall(members=archive.names)
  File "/mnt/opt/Sage/sage-clang/build/bin/../sage_bootstrap/uncompress/tar_file.py", line 90, in extractall
    members=members)
  File "/usr/lib64/python3.5/tarfile.py", line 1998, in extractall
    numeric_owner=numeric_owner)
  File "/usr/lib64/python3.5/tarfile.py", line 2040, in extract
    numeric_owner=numeric_owner)
TypeError: _extract_member() got an unexpected keyword argument 'set_attrs'

as soon as you start a clean build of Sage.

Change History (14)

comment:1 Changed 4 years ago by dimpase

while I am at it:

$ pylint tar_file.py 
No config file found, using default configuration
************* Module sage_bootstrap.uncompress.tar_file
W: 67, 4: Parameters differ from overridden 'chmod' method (arguments-differ)
W: 74, 4: Parameters differ from overridden 'utime' method (arguments-differ)
W: 79, 4: Parameters differ from overridden 'extractall' method (arguments-differ)
W:103, 4: Parameters differ from overridden '_extract_member' method (arguments-differ)
W:153,15: Catching too general exception Exception (broad-except)

------------------------------------------------------------------
Your code has been rated at 9.09/10 (previous run: 9.09/10, +0.00)

comment:2 Changed 4 years ago by embray

I don't think I've tried building Sage with Python 3 as the default "bootstrap" Python, but indeed that should definitely work, especially as more distros are finally defaulting to Python 3.

Is this the only issue you've encountered so far?

comment:3 Changed 4 years ago by embray

  • Owner changed from (none) to embray

comment:4 Changed 4 years ago by dimpase

This is the first bug one hits, I didn't go further. I suppose that merely adding the extra (Python3-only) key arguments to the functions overriding the ones in the library will do here (as key args are optional, and so more is OK for Python2 as well).

comment:5 Changed 4 years ago by embray

  • Priority changed from major to blocker

From the sound of things this is a regression too, since it used to work on Python 3 but now it doesn't.

comment:6 Changed 4 years ago by embray

  • Type changed from enhancement to defect

comment:7 Changed 4 years ago by embray

  • Authors set to Erik Bray
  • Branch set to u/embray/python3/ticket-24830
  • Commit set to d6e32e2e89e301e2fcf741eaa2c141c4170cffa3
  • Status changed from new to needs_review

New commits:

d6e32e2Fix compatibility with newer versions of the tarfile module in Python 3

comment:8 Changed 4 years ago by chapoton

missing blank lines after .. note:: twice

comment:9 Changed 4 years ago by gh-embray

Okay, but that isn't strictly needed by RST I don't think.

comment:10 Changed 4 years ago by chapoton

sorry for the bikesheding. I would be happy to give a positive review, but I would prefer if Dima tests if it works.

This seems to have hurt somebody : https://groups.google.com/forum/#!topic/sage-support/UmGFtjcnm6Y

comment:11 Changed 4 years ago by gh-embray

Yeah, I've already talked to Viviane about it.

comment:12 Changed 4 years ago by chapoton

Did she try the branch here ?

comment:13 Changed 4 years ago by dimpase

  • Reviewers set to Dima Pasechnik
  • Status changed from needs_review to positive_review

works, and docs build

comment:14 Changed 4 years ago by vbraun

  • Branch changed from u/embray/python3/ticket-24830 to d6e32e2e89e301e2fcf741eaa2c141c4170cffa3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.