Opened 11 years ago

Closed 11 years ago

#19292 closed Bug (invalid)

syncdb ignores umask when creating a sqlite database

Reported by: pitrou@… Owned by: nobody
Component: Core (Management commands) Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

My settings.py is using the django.db.backends.sqlite3 backend, and the user running manage.py has umask value 0002. However, when running manage.py syncdb for the first time, the sqlite database file is created with access rights 0644, ignoring the user's umask value.

Change History (2)

comment:1 by Aymeric Augustin, 11 years ago

Component: Database layer (models, ORM)Core (Management commands)
Triage Stage: UnreviewedAccepted

comment:2 by Aymeric Augustin, 11 years ago

Resolution: invalid
Status: newclosed

A quick search brings up this thread: http://www.mail-archive.com/sqlite-users@sqlite.org/msg59080.html

Apparently it's a bug in SQLite.

The same bug was reported against PHP and rejected for the same reason: https://bugs.php.net/bug.php?id=31573

It also exists in Python itself:

aaugustin@aaugustin ~ % python
Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.umask(0o002)
18
>>> import sqlite3
>>> sqlite3.connect('example.db').close()
>>> ^D
aaugustin@aaugustin ~ % ls -l example.db
-rw-r--r--  1 aaugustin  staff  0 14 nov 14:00 example.db
Note: See TracTickets for help on using tickets.
Back to Top