[Django] #22681: TarArchive has_leading_dir usage bug

4 views
Skip to first unread message

Django

unread,
May 22, 2014, 8:28:57 AM5/22/14
to django-...@googlegroups.com
#22681: TarArchive has_leading_dir usage bug
-------------------------------------+-------------------------------------
Reporter: phpdude | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: master
commands) | Keywords: startproject, tar,
Severity: Normal | template, allversions
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
I found small bug in django.utils.archive.TarArchive.extract function.

https://github.com/django/django/blob/master/django/utils/archive.py#L147

There members is a list of TarInfo objects (tarfile.TarInfo), not just a
list of path strings.

Because of this bug django cannot recognize leading_dir in tar archives.

Take a look for example startproject with tar and zip archive.


{{{
(env)@dude /WWW# django-admin.py startproject -v 3 --template
http://git.floraconcierge.com/flora-concierge/django-
skeleton/repository/archive test14
Rendering project template files with extensions: .py
Rendering project template files with filenames:
Downloading http://git.floraconcierge.com/flora-concierge/django-
skeleton/repository/archive
Extracting
/var/folders/7h/k___h29d15n7n5zxqk5l8ktw0000gn/T/django_project_template_FAMd_4_download
/django-skeleton-f85cd58a98dd98bd22b56a82a35b3947ad7c7d79.tar.gz

Creating /WWW/test14/django-skeleton.git/manage.py
Creating /WWW/test14/django-skeleton.git/README
Creating /WWW/test14/django-skeleton.git/test14/__init__.py
Creating /WWW/test14/django-skeleton.git/test14/urls.py
Creating /WWW/test14/django-skeleton.git/test14/wsgi.py
...
}}}

And example with zip archive

{{{
(env)@dude /WWW# django-admin.py startproject -v 3 --template
https://github.com/rdegges/django-skel/zipball/master test15
Rendering project template files with extensions: .py
Rendering project template files with filenames:
Downloading https://github.com/rdegges/django-skel/zipball/master
Extracting
/var/folders/7h/k___h29d15n7n5zxqk5l8ktw0000gn/T/django_project_template_DLsbG8_download
/rdegges-django-skel-d4631bb.zip

Creating /WWW/test15/.gitignore
Creating /WWW/test15/fabfile.py
Creating /WWW/test15/gunicorn.py.ini
Creating /WWW/test15/manage.py
Creating /WWW/test15/Procfile
Creating /WWW/test15/README.md
Creating /WWW/test15/requirements.txt
Creating /WWW/test15/runtime.txt
Creating /WWW/test15/wsgi.py
}}}

I fixed this and created pull request in github. Please aply it soon.

https://github.com/django/django/pull/2701

Thank you, alex

--
Ticket URL: <https://code.djangoproject.com/ticket/22681>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 24, 2014, 11:46:34 AM5/24/14
to django-...@googlegroups.com
#22681: TarArchive has_leading_dir usage bug
-------------------------------------+-------------------------------------
Reporter: phpdude | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: master
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: startproject, tar, | Needs documentation: 0
template, allversions | Patch needs improvement: 0
Has patch: 1 | UI/UX: 0
Needs tests: 1 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by claudep):

* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 1
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/22681#comment:1>

Django

unread,
May 25, 2014, 3:43:47 AM5/25/14
to django-...@googlegroups.com
#22681: TarArchive has_leading_dir usage bug
-------------------------------------+-------------------------------------
Reporter: phpdude | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: master
commands) | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: startproject, tar, | checkin
template, allversions | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by phpdude):

* stage: Accepted => Ready for checkin


Comment:

Tests added.

https://github.com/django/django/pull/2701

--
Ticket URL: <https://code.djangoproject.com/ticket/22681#comment:2>

Django

unread,
Jun 3, 2014, 11:58:18 AM6/3/14
to django-...@googlegroups.com
#22681: TarArchive has_leading_dir usage bug
-------------------------------------+-------------------------------------
Reporter: phpdude | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: master
commands) | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: startproject, tar, | checkin
template, allversions | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 1 |
-------------------------------------+-------------------------------------

Comment (by phpdude):

Tests fixed. Branch rebased and commit message changed to right one.
Please check again.

--
Ticket URL: <https://code.djangoproject.com/ticket/22681#comment:3>

Django

unread,
Jun 3, 2014, 12:02:50 PM6/3/14
to django-...@googlegroups.com
#22681: TarArchive has_leading_dir usage bug
-------------------------------------+-------------------------------------
Reporter: phpdude | Owner: nobody
Type: Bug | Status: closed

Component: Core (Management | Version: master
commands) | Resolution: fixed

Severity: Normal | Triage Stage: Ready for
Keywords: startproject, tar, | checkin
template, allversions | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"083d285b82832f95b57c64144020cc2ce8895a22"]:
{{{
#!CommitTicketReference repository=""
revision="083d285b82832f95b57c64144020cc2ce8895a22"
Fixed #22681 -- Made TarArchive recognize leading directories properly.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22681#comment:4>

Reply all
Reply to author
Forward
0 new messages