[Django] #32180: FileBasedCache accepts relative directorires as a LOCATION documentation say should be absolute

10 views
Skip to first unread message

Django

unread,
Nov 8, 2020, 9:56:41 AM11/8/20
to django-...@googlegroups.com
#32180: FileBasedCache accepts relative directorires as a LOCATION documentation
say should be absolute
-------------------------------------+-------------------------------------
Reporter: Carles | Owner: Carles Pina Estany
Pina Estany |
Type: | Status: assigned
Cleanup/optimization |
Component: Core | Version: master
(Cache system) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
FileBasedCache LOCATION: the documentation says that the path should be
absolute, Django accepts absolute or relative.

In https://docs.djangoproject.com/en/3.1/topics/cache/#filesystem-caching

It says:
"The directory path should be absolute – that is, it should start at the
root of your filesystem."

The code makes them absolute:
https://github.com/django/django/blob/master/django/core/cache/backends/filebased.py#L22

Enforcing the LOCATION to be specified only in absolute way might have no
gain and would have backwards compatibility problems for deployments that
are passing the directory using a relative path.

A possible way to improve the situation without or minimal backwards
incompatibility changes would be to add a new check (thanks Carlton for
the idea).

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

Django

unread,
Nov 8, 2020, 10:00:08 AM11/8/20
to django-...@googlegroups.com
#32180: FileBasedCache accepts relative directorires as a LOCATION documentation
say should be absolute
-------------------------------------+-------------------------------------
Reporter: Carles Pina Estany | Owner: Carles
Type: | Pina Estany
Cleanup/optimization | Status: assigned
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

Old description:

> FileBasedCache LOCATION: the documentation says that the path should be
> absolute, Django accepts absolute or relative.
>
> In https://docs.djangoproject.com/en/3.1/topics/cache/#filesystem-caching
>
> It says:
> "The directory path should be absolute – that is, it should start at the
> root of your filesystem."
>
> The code makes them absolute:
> https://github.com/django/django/blob/master/django/core/cache/backends/filebased.py#L22
>
> Enforcing the LOCATION to be specified only in absolute way might have no
> gain and would have backwards compatibility problems for deployments that
> are passing the directory using a relative path.
>
> A possible way to improve the situation without or minimal backwards
> incompatibility changes would be to add a new check (thanks Carlton for
> the idea).

New description:

FileBasedCache LOCATION: the documentation says that the path should be
absolute, Django accepts absolute or relative.

In https://docs.djangoproject.com/en/3.1/topics/cache/#filesystem-caching

It says:
"The directory path should be absolute – that is, it should start at the
root of your filesystem."

Enforcing the LOCATION to be specified only in absolute way might have no
gain and would have backwards compatibility problems for deployments that
are passing the directory using a relative path.

A possible way to improve the situation without or minimal backwards
incompatibility changes would be to add a new check (thanks Carlton for
the idea).

I'm happy to make any changes:
https://github.com/django/django/pull/13655

--

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

Django

unread,
Nov 9, 2020, 12:58:06 AM11/9/20
to django-...@googlegroups.com
#32180: Add a warning if the file system cache location is relative.

-------------------------------------+-------------------------------------
Reporter: Carles Pina Estany | Owner: Carles
Type: | Pina Estany
Cleanup/optimization | Status: assigned
Component: Core (System | Version: master
checks) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1
* component: Core (Cache system) => Core (System checks)
* stage: Unreviewed => Accepted


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

Django

unread,
Nov 11, 2020, 4:38:05 AM11/11/20
to django-...@googlegroups.com
#32180: Add a warning if the file system cache location is relative.
-------------------------------------+-------------------------------------
Reporter: Carles Pina Estany | Owner: Carles
Type: | Pina Estany
Cleanup/optimization | Status: assigned
Component: Core (System | Version: master
checks) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


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

Django

unread,
Nov 11, 2020, 5:32:48 AM11/11/20
to django-...@googlegroups.com
#32180: Add a warning if the file system cache location is relative.
-------------------------------------+-------------------------------------
Reporter: Carles Pina Estany | Owner: Carles
Type: | Pina Estany
Cleanup/optimization | Status: closed

Component: Core (System | Version: master
checks) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

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


Comment:

In [changeset:"721c95ba0b67eb46422dcf05a4274960e49c8894" 721c95ba]:
{{{
#!CommitTicketReference repository=""
revision="721c95ba0b67eb46422dcf05a4274960e49c8894"
Fixed #32180 -- Added system check for file system caches absolute
location.
}}}

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

Reply all
Reply to author
Forward
0 new messages