#27628: startproject with template as a github zipball fails with
PermissionError
-------------------------------------------+------------------------
Reporter: Karen Tracey | Owner: nobody
Type: Bug | Status: new
Component: Utilities | Version: master
Severity: Release blocker | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
Using current master, on Ubuntu 16.04 with Python 3.5, a startproject
command of the form:
`django-admin.py startproject --template=https://github.com/caktus/django-
project-template/zipball/master --extension=py,rst,yml
--name=Makefile,gulpfile.js,package.json newproject`
is failing with PermissionError:
{{{
--> ~/software/django/django/bin/django-admin.py startproject
--template=https://github.com/caktus/django-project-
template/zipball/master --extension=py,rst,yml
--name=Makefile,gulpfile.js,package.json newproject
Traceback (most recent call last):
File "/home/kmtracey/software/django/django/bin/django-admin.py", line
5, in <module>
management.execute_from_command_line()
File
"/home/kmtracey/software/django/django/core/management/__init__.py", line
357, in execute_from_command_line
utility.execute()
File
"/home/kmtracey/software/django/django/core/management/__init__.py", line
349, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/kmtracey/software/django/django/core/management/base.py",
line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/kmtracey/software/django/django/core/management/base.py",
line 330, in execute
output = self.handle(*args, **options)
File
"/home/kmtracey/software/django/django/core/management/commands/startproject.py",
line 34, in handle
super(Command, self).handle('project', project_name, target,
**options)
File
"/home/kmtracey/software/django/django/core/management/templates.py", line
163, in handle
with io.open(old_path, 'r', encoding='utf-8') as template_file:
PermissionError: [Errno 13] Permission denied:
'/tmp/django_project_template_0llqnt13_extract/fabfile.py'
}}}
Inspecting the leftover extracted "archive" all files extracted have mode
000. Unzipping the leftover zipfile using the os unzip command results in
files that are "-rw-rw-r--".
This appears to be due to new code added for #26494 which is setting the
file mode based on the value of a zipinfo external_attr value...however in
my case this external_attr value is 0 and none of the extracted file can
subsequently be opened by the remainder of the startproject command code.
{{{
--> ~/software/django/django/bin/django-admin.py startproject
--template=https://github.com/caktus/django-project-
template/zipball/master --extension=py,rst,yml
--name=Makefile,gulpfile.js,package.json newproject
> /home/kmtracey/software/django/django/utils/archive.py(205)extract()
-> mode = info.external_attr >> 16
(Pdb) info
<ZipInfo filename='caktus-django-project-template-e83e136/.babelrc'
compress_type=deflate file_size=162 compress_size=96>
(Pdb) info.external_attr
0
(Pdb)
}}}
Setting as a release blocker since this is a regression from 1.10, where
the same command works fine. I think the fix for #26494 needs revisiting
since apparently external_attr isn't always usefully set (doc seems
nonexistent in Python for this attribute??).
--
Ticket URL: <https://code.djangoproject.com/ticket/27628>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.898f4f1a2e61b57acaef3b7c7e537f4f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.