#329: add md5sums for spkgs
---------------------------+------------------------------------------------
Reporter: was | Owner: pdenapo
Type: enhancement | Status: needs_review
Priority: minor | Milestone: sage-4.3.3
Component: packages | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
---------------------------+------------------------------------------------
Comment(by drkirkby):
Hi,
I'm really tied up today, so don't have chance to start applying patches
and testing this. But I looked at the source quickly and made a few
comments.
'''b/sage-add-integrity-check-to-spkg'''
* Line 1: I thought all scripts were supposed to start with
#!/usr/bin/env bash
* Line 8 if [ "$1" = "$SPKGNAME" ] . A more portable test is if [ "x$1" =
"xPKGNAME" ]. It's not essential in modern versions of bash, but is a good
habit to get into.
* Line 16-25. It would appear to me that the assumption is made that if
bzip2 returns with a non-zero exit code, then it must be a tar file. It
could be a corrupted .spkg file, where the .spkg is a tar file.
* It does not appear to me that the exit code of tar is checked.
* Line 27, would 'cp' be faster/more appropriate than cat? It is on my
system, but perhaps not on more modern systems.
* Is there a need for line 27 at all? Could line 29 not have $1 rather
than $SPKGNAME.tar? 'tar' does not require that the file have the
extension .tar.
* You might want to investigate if the 'file' command would save a lot of
work, as that will tell you if the file is a tar file or a bzip2
compressed file.
''' b/sage-spkg-integrity-check'''
* Lines 13 and 19. A minor point, but a more portable test for if [
"$foobar" = "" ] is if [ -z "$foobar" ]. I personlly try to use things
that are as portable of possible, so I don't get caught out if I use a
system which does not conform to the way most shells work.
* Line 63. I think it would be better to say "$0 appears to be corrupted,
as the checksum is not what is expected. Expected <what you expect> got
<what you got>
'''General'''
I think you might speed this up by avoiding some of the 'cat' commands.
For example,
{{{
file.tar < tar xf -
}}}
can be faster than
{{{
cat file.tar | tar xf
}}}
as you don't need to invoke cat at all. Do a Google on "useless use of
cat".
Since you mention speed as a possible issue, any attempt that could be
made to avoid copying files, or cat'ing files unnecessarily should help
speed things up a lot. Other points are more minor
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/329#comment:11>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.