#20802: Restore Python 2.6+ compatibility
-------------------------------------+-------------------------------------
Reporter: vbraun | Owner:
Type: defect | Status: needs_review
Priority: blocker | Milestone: sage-7.3
Component: build | Resolution:
Keywords: argparse sage- | Merged in:
uncompress-spkg |
Authors: Volker Braun | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vbraun/restore_python_2_6__compatibility|
775a3d3e160388b6d5b21b0a38e0ec2b3d247ef0
Dependencies: #19984, #20871 | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by leif):
FWIW, I intentionally did ''not'' import the whole `sage_bootstrap`
package just because `sage-uncompress-spkg` in case of Python 2.6 needs
the `argparse` module (and only that) from `.../compat/` in my patch.
----
Could you add a `.contains_garbage()` property in order to not pass the
whole list of all files in a tarball to `.extractall()` if it returns
`False` (which is the normal case -- it should IMHO error out unless given
some option to override that otherwise, or ''at least'' give a warning).
As is, it essentially does
{{{
#!sh
tar xf $TARBALL $( tar tf $TARBALL | cat )
}}}
or, worse (and more explicit),
{{{
#!sh
gunzip -c $TARBALL | tar xf - $( gunzip -c $TARBALL | tar tf - | cat )
}}}
in the normal (non-error) case, where `gunzip` will be `bunzip2` if
`$TARBALL` ends with `.bz2` instead of `.gz`; since you're also building a
dictionary, `cat` here doesn't even properly reflect the no-op processing
of all filenames in the archive (it would have to be some more complex
identity function).
\\
You could in addition rename `.names()` to `.valid_names()` say, and add
another function `.invalid_names()` (or `.names()` returning ''all''
names) or whatever (such that it is possible to obtain the ones filtered
out, or at least see whether any files got filtered out, but if we give an
error or warning message, that should contain ''which'' files are
considered garbage).
--
Ticket URL: <https://trac.sagemath.org/ticket/20802#comment:32>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.