[Django] #27420: Oracle DB test user password error

7 views
Skip to first unread message

Django

unread,
Nov 2, 2016, 8:28:21 AM11/2/16
to django-...@googlegroups.com
#27420: Oracle DB test user password error
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Oracle DB test user password can not start with digits because quotation
marks are missing in SQL. For example:

{{{#!sql
CREATE USER foo
IDENTIFIED BY 2fXHVnA9KRH4uTSSvV3fVDel4kyVum
DEFAULT TABLESPACE foo_tbls_test
TEMPORARY TABLESPACE foo_tbls_temp_test
QUOTA UNLIMITED ON foo_tbls_test;
}}}

is incorrect (`ORA-00922: missing or invalid option`) it should be:

{{{#!sql
CREATE USER foo
IDENTIFIED BY "2fXHVnA9KRH4uTSSvV3fVDel4kyVum"
DEFAULT TABLESPACE foo_tbls_test
TEMPORARY TABLESPACE foo_tbls_temp_test
QUOTA UNLIMITED ON foo_tbls_test;
}}}

All versions are vulnerable ie 1.8.16, 1.9.11, 1.10.3 and master.

--
Ticket URL: <https://code.djangoproject.com/ticket/27420>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 2, 2016, 10:23:31 AM11/2/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number

-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* severity: Normal => Release blocker
* version: master => 1.8
* needs_docs: 0 => 1
* has_patch: 0 => 1
* stage: Unreviewed => Accepted


Comment:

[https://github.com/django/django/pull/7463 PR]. This might explain some
of the failures that have popped up on Jenkins. Release notes for 1.10.4,
1.9.12, and 1.8.17 are also needed.

--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:1>

Django

unread,
Nov 2, 2016, 11:01:06 AM11/2/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* needs_docs: 1 => 0


Comment:

I added release notes for 1.8.17/1.9.12/1.10.4.

--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:2>

Django

unread,
Nov 2, 2016, 11:23:57 AM11/2/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by felixxm:

Old description:

> Oracle DB test user password can not start with digits because quotation
> marks are missing in SQL. For example:
>
> {{{#!sql
> CREATE USER foo
> IDENTIFIED BY 2fXHVnA9KRH4uTSSvV3fVDel4kyVum
> DEFAULT TABLESPACE foo_tbls_test
> TEMPORARY TABLESPACE foo_tbls_temp_test
> QUOTA UNLIMITED ON foo_tbls_test;
> }}}
>
> is incorrect (`ORA-00922: missing or invalid option`) it should be:
>
> {{{#!sql
> CREATE USER foo
> IDENTIFIED BY "2fXHVnA9KRH4uTSSvV3fVDel4kyVum"
> DEFAULT TABLESPACE foo_tbls_test
> TEMPORARY TABLESPACE foo_tbls_temp_test
> QUOTA UNLIMITED ON foo_tbls_test;
> }}}
>
> All versions are vulnerable ie 1.8.16, 1.9.11, 1.10.3 and master.

New description:

Oracle DB test user password cannot start with digits because quotation


marks are missing in SQL. For example:

{{{#!sql
CREATE USER foo
IDENTIFIED BY 2fXHVnA9KRH4uTSSvV3fVDel4kyVum
DEFAULT TABLESPACE foo_tbls_test
TEMPORARY TABLESPACE foo_tbls_temp_test
QUOTA UNLIMITED ON foo_tbls_test;
}}}

is incorrect (`ORA-00922: missing or invalid option`) it should be:

{{{#!sql
CREATE USER foo
IDENTIFIED BY "2fXHVnA9KRH4uTSSvV3fVDel4kyVum"
DEFAULT TABLESPACE foo_tbls_test
TEMPORARY TABLESPACE foo_tbls_temp_test
QUOTA UNLIMITED ON foo_tbls_test;
}}}

All versions are vulnerable ie 1.8.16, 1.9.11, 1.10.3 and master.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:3>

Django

unread,
Nov 2, 2016, 11:26:12 AM11/2/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Shai Berger):

Replying to [comment:1 Tim Graham]:


> This might explain some of the failures that have popped up on Jenkins.

I believe they are actually unrelated, the error was about password
expiry.

--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:4>

Django

unread,
Nov 3, 2016, 5:39:09 AM11/3/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Marti):

* cc: marti@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:5>

Django

unread,
Nov 3, 2016, 6:00:07 AM11/3/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Marti):

I was really puzzled about this bug because it should have a 10/62 chance
of occurring, but I had ran dozens of tests using patched Django and never
seen such a failure.

I investigated this further and the consequences are uglier than I
expected. :(

If the test user creation fails -- with whatever exception -- and
`--keepdb` is specified, then `_create_test_db` simply returns out of the
function without switching to the test user. This means that tests are
executed using the main connection parameters instead of the test user.

{{{#!python
def _create_test_db(self, verbosity=1, autoclobber=False,
keepdb=False):
...
try:
self._create_test_user(cursor, parameters, verbosity,
keepdb)
except Exception as e:
# If we want to keep the db, then we want to also keep the
user.
if keepdb:
return
...
self._maindb_connection.close() # done with main user -- test
user and tablespaces created
self._switch_to_test_user(parameters)
return self.connection.settings_dict['NAME']
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:6>

Django

unread,
Nov 3, 2016, 6:08:47 AM11/3/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by felixxm):

I had bad luck and my tests failed just few hours after Django upgrade.
The simplest (and quickest) solution for now is to set `PASSWORD`
parameter for `TEST` database (without number or special character at the
beginning).

--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:7>

Django

unread,
Nov 5, 2016, 1:19:50 PM11/5/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by felixxm):

I agree that this little hack is currently unnecessary and can cause
unexpected behavior. It should be removed.

{{{#!python
--- a/django/db/backends/oracle/creation.py
+++ b/django/db/backends/oracle/creation.py
@@ -77,9 +77,6 @@ class DatabaseCreation(BaseDatabaseCreation):


try:
self._create_test_user(cursor, parameters, verbosity,
keepdb)
except Exception as e:

- # If we want to keep the db, then we want to also keep
the user.
- if keepdb:
- return
sys.stderr.write("Got an error creating the test user:
%s\n" % e)
if not autoclobber:
confirm = input(
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:8>

Django

unread,
Nov 8, 2016, 4:31:29 PM11/8/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed

Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"c4b04e1598c4325454c808183dce17b284ed9e28" c4b04e15]:
{{{
#!CommitTicketReference repository=""
revision="c4b04e1598c4325454c808183dce17b284ed9e28"
Fixed #27420 -- Quoted the Oracle test user password in queries.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:9>

Django

unread,
Nov 8, 2016, 4:54:03 PM11/8/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"dacef9137f43fff88b527d1c02f6fe6a81e975aa" dacef913]:
{{{
#!CommitTicketReference repository=""
revision="dacef9137f43fff88b527d1c02f6fe6a81e975aa"
Refs #27420 -- Removed exception hiding in Oracle test user creation
during --keepdb.

If the test user creation fails here, _create_test_db() would return
without
switching to the test user which caused the tests to run using the main
connection instead of the test user.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:10>

Django

unread,
Nov 8, 2016, 5:17:20 PM11/8/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"a3fa2c463122974460adcab91defb479841de745" a3fa2c4]:
{{{
#!CommitTicketReference repository=""
revision="a3fa2c463122974460adcab91defb479841de745"
[1.9.x] Fixed #27420 -- Quoted the Oracle test user password in queries.

Backport of c4b04e1598c4325454c808183dce17b284ed9e28 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:11>

Django

unread,
Nov 8, 2016, 5:17:21 PM11/8/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"32f50999cd4ccf4e5667f20df3d89421c599a9af" 32f50999]:
{{{
#!CommitTicketReference repository=""
revision="32f50999cd4ccf4e5667f20df3d89421c599a9af"
[1.8.x] Fixed #27420 -- Quoted the Oracle test user password in queries.

Backport of c4b04e1598c4325454c808183dce17b284ed9e28 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:13>

Django

unread,
Nov 8, 2016, 5:17:22 PM11/8/16
to django-...@googlegroups.com
#27420: Oracle DB test user password must be quoted if it starts with a number
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"bc74bc1f35e33b0f37cea76aae81840e067d7802" bc74bc1f]:
{{{
#!CommitTicketReference repository=""
revision="bc74bc1f35e33b0f37cea76aae81840e067d7802"
[1.10.x] Fixed #27420 -- Quoted the Oracle test user password in queries.

Backport of c4b04e1598c4325454c808183dce17b284ed9e28 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27420#comment:12>

Reply all
Reply to author
Forward
0 new messages