﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27628	startproject with template as a github zipball fails with PermissionError	Karen Tracey	nobody	"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??)."	Bug	closed	Utilities	dev	Release blocker	fixed		desecho@…	Ready for checkin	1	0	0	0	0	0
