classification
Title: Import from Zip archive
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: ahlstromjc, gvanrossum, jhylton, loewis, nnorwitz, paul.moore
Priority: normal Keywords: patch

Created on 2001-12-12 17:21 by ahlstromjc, last changed 2002-11-29 11:38 by paul.moore. This issue is now closed.

Files
File name Uploaded Description Edit
dashc.diff ahlstromjc, 2002-03-15 17:27 diff -c version of the patch (Mar15, 2002)
dashc-2.diff gvanrossum, 2002-08-14 20:50 Partially fixed diff
import.c.diff ahlstromjc, 2002-08-15 14:44 diff -c import.c versus Python-2.2.1
import.c.diff ahlstromjc, 2002-08-15 18:47 diff -c import.c versus CVS 8-15-2002
Messages (26)
msg38433 - (view) Author: James C. Ahlstrom (ahlstromjc) Date: 2001-12-12 17:21
This is the "final" patch to support imports from zip 
archives, and directory caching using os.listdir(). It 
replaces patch 483466 and 476047.  It is a separate 
patch since I can't delete file attachments.  It adds 
support for importing from "" and from relative paths.
msg38434 - (view) Author: James C. Ahlstrom (ahlstromjc) Date: 2002-03-15 17:03
Logged In: YES 
user_id=64929

I still can't delete files, but I added a new file which
contains all diffs as a single file, and is made from the
current CVS tree (Mar 15, 2002).
msg38435 - (view) Author: James C. Ahlstrom (ahlstromjc) Date: 2002-03-15 17:27
Logged In: YES 
user_id=64929

I added a diff -c version of the patch.
msg38436 - (view) Author: Jeremy Hylton (jhylton) Date: 2002-06-12 15:05
Logged In: YES 
user_id=31392

Deleteing the old diffs that Jim couldn't delete.
msg38437 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-07-28 10:54
Logged In: YES 
user_id=21627

Is this patch ready to be applied?
msg38438 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-08-14 20:50
Logged In: YES 
user_id=6380

Sigh.  We waited too long for this one, and now the patch is
hopelessly out of date.  I managed to fix most of the
failing hunks, but the remaining hunk that fails (#11 in
import.c) is a whopper: the saved import.c.rej is 270 lines
long.

I'm going to sleep on that, but I could use some help.

In the mean time, I'm uploading an edited version of
dashc.diff to help the next person.
msg38439 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-08-14 23:30
Logged In: YES 
user_id=33168

I'm reviewed most of the updated version.  Quick summary:
 * strncpy() doesn't null terminate strings, this needs to
be added
 * seems to be many leaked references

Here are more details:
 * strncpy(dest, str, size) doesn't guarantee the result to
be null terminated,
    need dest[size] = '\0'; after all strncpy()s (I see a
bunch in getpath.c)
 * getpath.c:get_sys_path_0(), I think some compilers warn
when you do char[i] = 0; (use '\0' instead)
    (there may be other places of this)
 * import.c:PyImport_InitZip(), have_zlib is an alias to
zlib and isn't really helpful/necessary
 * import.c:get_path_type() can leak a reference to pyobj if
it's an int
 * import.c:add_directory_names() pylist reference is leaked
 * import.c:add_zip_names(), memcmp(path+i, ".zip", 4) is
clearer to me than path[i] == '.' ....
 * import.c:add_zip_names, there's a lot of magic #s in this
function
 *     "        " : leak refs when doing PyTuple_SetItem
 
I think there were other leaked references.  I'll try to
spend some more time later.
msg38440 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-08-15 01:32
Logged In: YES 
user_id=6380

Whoa...  That's a lot. Neal, do you think you could come up
with a reworked version of this? That would be great!
msg38441 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-08-15 01:38
Logged In: YES 
user_id=33168

Reassigning to me.  I'll give it a shot.  It will take a
while.  Do I understand you correctly that your updated
patch (dashc-2) has all the necessary pieces, except for the
import hunk 11 that was rejected?  And I need to get that
failed hunk from the original patch?
msg38442 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-08-15 02:40
Logged In: YES 
user_id=6380

No, the failing hunk is included in dashc-2.  I actually
*edited* the patch file until all but that one hunk succeeded.

Thanks for looking into this! If you need help don't fail to
ask on python-dev, I read it daily. :-)
msg38443 - (view) Author: James C. Ahlstrom (ahlstromjc) Date: 2002-08-15 13:37
Logged In: YES 
user_id=64929

This patch is old.  I can provide a new patch against Python
2.2.1 if that would help.  Or a new patch just for import.c
against 2.2.1.
msg38444 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-08-15 14:09
Logged In: YES 
user_id=33168

James, could you look at what Guido reworked?  If that is
fine, I can push it forward.  Otherwise, feel free to update
the patch.  If I do any work on it, I'll make comments here
so we don't duplicate work.  Thanks.
msg38445 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-08-15 14:20
Logged In: YES 
user_id=6380

I think a new patch just for import.c would be helpful.
msg38446 - (view) Author: James C. Ahlstrom (ahlstromjc) Date: 2002-08-15 14:44
Logged In: YES 
user_id=64929

Here is the import.c diff -c against Python-2.2.1.
msg38447 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-08-15 15:00
Logged In: YES 
user_id=6380

Alas, the 2.2.1 diff doesn't help much. Current CVS is what
we need. :-(
msg38448 - (view) Author: James C. Ahlstrom (ahlstromjc) Date: 2002-08-15 15:18
Logged In: YES 
user_id=64929

I just grabbed the CVS import.c (only).  I will edit this to
add my changes and submit it as a new import.c patch.  This
should help, although I can't test it unless I download the
whole tree.
msg38449 - (view) Author: James C. Ahlstrom (ahlstromjc) Date: 2002-08-15 18:47
Logged In: YES 
user_id=64929

Here is a diff -c against today's import.c.  It is untested
because I didn't get the whole tree, but it is way closer
than the old patch.  I moved the find_module() loop over
file suffixes into search_using_fopen(), a trivial change
which produces a large diff.  To make the change obvious, I
didn't correct the indenting, so please do that after
looking at the patch.

Next I will download the whole tree and check the other
changes once I get a little time.
msg38450 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2002-11-28 10:01
Logged In: YES 
user_id=113328

Sorry to poke my nose in on this, but I note that Guido is 
hoping for a 2.3a1 release by Christmas, and this patch has 
been making very slow progress.

I have an interest in seeing it go in - is there anything I can do 
to help?
msg38451 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-11-28 10:41
Logged In: YES 
user_id=21627

Try it out, report whether it works; if it doesn't work, fix
it. Verify that documentation and test cases are up-to-date.
msg38452 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2002-11-28 21:51
Logged In: YES 
user_id=113328

I've uploaded a revised patch (zip-cvs.diff). This is against 
current Python CVS. It's basically just the existing import.c 
patch, plus the rest of the dashc-2 patch. Everything applied 
OK (with fuzz and offsets, but otherwise OK).

The resulting code builds, but when I try importing from a zip 
file, I get a crash. However, this happens when I use the zlib 
module directly, so appears to be because I haven't built zlib 
correctly :-(

I will investigate further, but thought I'd upload the new patch 
in case anyone else wants to take a look.
msg38453 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2002-11-28 21:58
Logged In: YES 
user_id=113328

How the *&^!%%$ do I upload files to SF?

For now, the patch is at 
http://www.morpheus.demon.co.uk/zip-cvs.diff.
msg38454 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2002-11-28 22:28
Logged In: YES 
user_id=113328

Sigh. If I'd read the README file properly, I wouldn't have 
screwed up the zlib build.

I am now happy to report that the patch seems to work fine. 
I've only done some simple tests, but have no problems.
msg38455 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-11-29 07:59
Logged In: YES 
user_id=21627

Paul,
Can you propose documentation changes for this patch? I'd
expect to see modifications to NEWS, whatsnew23.tex, api,
and ref, perhaps other places as well. Feel free to use
material from PEP 273 as appropriate.

Also, having test cases for the feature would be good.

As you cannot attach to this report (you are not the
submitter), feel free to create a new patch. To create a
diff for a cvs tree, using the "cvs diff" command is best -
no need to have two copies of the tree.
msg38456 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2002-11-29 09:36
Logged In: YES 
user_id=113328

I'll see what I can do. I've never looked at documentation or 
test patches before, so I'll have to get my brain around things 
first...

I'll also have a look at the issues Neal raised.

Is the diff format I used a problem? I have dial-up internet 
access, so having 2 copies of the tree is faster for me than 
doing cvs diff, as well as being possible while offline :-(
msg38457 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-11-29 10:02
Logged In: YES 
user_id=21627

The diff format is fine; I was just not certain you know about 
cvs diff.
msg38458 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2002-11-29 11:38
Logged In: YES 
user_id=113328

Opened a new patch (645650) with an updated diff.
History
Date User Action Args
2001-12-12 17:21:07ahlstromjccreate