[Patches] [ python-Patches-492105 ] Import from Zip archive

noreply@sourceforge.net noreply@sourceforge.net
Thu, 28 Nov 2002 02:01:35 -0800


Patches item #492105, was opened at 2001-12-12 17:21
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=492105&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: Out of Date
Priority: 5
Submitted By: James C. Ahlstrom (ahlstromjc)
Assigned to: Neal Norwitz (nnorwitz)
Summary: Import from Zip archive

Initial Comment:
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.

----------------------------------------------------------------------

Comment By: Paul Moore (pmoore)
Date: 2002-11-28 10:01

Message:
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?

----------------------------------------------------------------------

Comment By: James C. Ahlstrom (ahlstromjc)
Date: 2002-08-15 19:47

Message:
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.

----------------------------------------------------------------------

Comment By: James C. Ahlstrom (ahlstromjc)
Date: 2002-08-15 16:18

Message:
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.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-08-15 16:00

Message:
Logged In: YES 
user_id=6380

Alas, the 2.2.1 diff doesn't help much. Current CVS is what
we need. :-(

----------------------------------------------------------------------

Comment By: James C. Ahlstrom (ahlstromjc)
Date: 2002-08-15 15:44

Message:
Logged In: YES 
user_id=64929

Here is the import.c diff -c against Python-2.2.1.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-08-15 15:20

Message:
Logged In: YES 
user_id=6380

I think a new patch just for import.c would be helpful.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-08-15 15:09

Message:
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.

----------------------------------------------------------------------

Comment By: James C. Ahlstrom (ahlstromjc)
Date: 2002-08-15 14:37

Message:
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.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-08-15 03:40

Message:
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. :-)

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-08-15 02:38

Message:
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?

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-08-15 02:32

Message:
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!

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-08-15 00:30

Message:
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.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-08-14 21:50

Message:
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.

----------------------------------------------------------------------

Comment By: Martin v. L÷wis (loewis)
Date: 2002-07-28 11:54

Message:
Logged In: YES 
user_id=21627

Is this patch ready to be applied?

----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2002-06-12 16:05

Message:
Logged In: YES 
user_id=31392

Deleteing the old diffs that Jim couldn't delete.


----------------------------------------------------------------------

Comment By: James C. Ahlstrom (ahlstromjc)
Date: 2002-03-15 17:27

Message:
Logged In: YES 
user_id=64929

I added a diff -c version of the patch.

----------------------------------------------------------------------

Comment By: James C. Ahlstrom (ahlstromjc)
Date: 2002-03-15 17:03

Message:
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).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=492105&group_id=5470