Opened 8 years ago
Closed 8 years ago
#27628 closed Bug (fixed)
startproject with template as a github zipball fails with PermissionError
Reported by: | Karen Tracey | Owned by: | nobody |
---|---|---|---|
Component: | Utilities | Version: | dev |
Severity: | Release blocker | Keywords: | |
Cc: | desecho@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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??).
Change History (4)
comment:1 by , 8 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 8 years ago
Cc: | added |
---|---|
Has patch: | set |
comment:3 by , 8 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Added PR