Code

Opened 7 years ago

Last modified 4 weeks ago

#4282 assigned New feature

startproject should honor umask

Reported by: talex5+django@… Owned by: merb
Component: Core (Management commands) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Ticket #1651 fixed the problem of manage.py not being made executable by copying *all* the permission bits (not just the executable flags). This means that the user's umask doesn't work, e.g.:

$ umask 077
$ touch foo
$ ls -l foo
-rw------- 1 talex talex 0 2007-05-12 13:27 foo

$ PYTHONPATH=trunk ./trunk/django/bin/django-admin.py startproject mysite
$ ls -l mysite/settings.py 
-rw-r--r-- 1 talex talex 2804 2007-05-12 13:28 mysite/settings.py

I discovered this whilst trying to make a Zero Install package for Django. Everything in the Zero Install cache is read-only, so startproject fails with:

  File "/var/cache/0install.net/implementations/sha1new=262c95b5a7cc34f525408b675106e4e4ae3494cc/django/core/management.py", line 799, in startproject
    fp = open(main_settings_file, 'w')
IOError: [Errno 13] Permission denied: '.../site/settings.py'

Thanks,

Attachments (3)

permissions.patch (1.4 KB) - added by talex5+django@… 7 years ago.
Fix.
django-4282.diff (1.5 KB) - added by Fredrik Lundh <fredrik@…> 7 years ago.
Updated patch, against revision 6281.
4282_against_16741.diff (1.6 KB) - added by baumer1122 3 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 7 years ago by Simon G. <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from startproject doesn't honour umask to startproject should honour umask
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 7 years ago by adrian

  • Summary changed from startproject should honour umask to startproject should honor umask

Seems like a good improvement to me. A patch would be great.

Changed 7 years ago by talex5+django@…

Fix.

comment:3 Changed 7 years ago by anonymous

  • Has patch set

comment:4 Changed 7 years ago by anonymous

Any comments on this patch? Is it OK?

comment:5 Changed 7 years ago by Fredrik Lundh <fredrik@…>

The patch doesn't apply any more (the relevant code is now in django/core/management/base.py). I've adapted the patch, but I'm not sure how this should interact with the _make_writeable call. I'll upload the updated patch anyway, just in case.

Changed 7 years ago by Fredrik Lundh <fredrik@…>

Updated patch, against revision 6281.

comment:6 Changed 4 years ago by adamnelson

  • Patch needs improvement set

Patch needs to be updated again.

comment:7 Changed 3 years ago by lrekucki

  • Severity set to Normal
  • Type set to New feature

Changed 3 years ago by baumer1122

comment:8 Changed 3 years ago by baumer1122

  • Easy pickings unset
  • UI/UX unset

Confirmed issue still exists in r16741. This patch applies cleanly and fixes the issue.

comment:9 Changed 7 months ago by merb

  • Owner changed from nobody to merb
  • Status changed from new to assigned

comment:10 Changed 7 months ago by merb

I uploaded & updated the pull request. https://github.com/django/django/pull/2061
would be great if somebody will making suggestions.

comment:11 Changed 4 weeks ago by claudep

Comment added on the pull request.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as assigned
The owner will be changed from merb to anonymous. Next status will be 'assigned'
The ticket will be disowned. Next status will be 'new'
as The resolution will be set. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.