#32223: Path.resolve(strict=True) can raise a PermissionError in autoreloader.
-------------------------------------+-------------------------------------
     Reporter:  Mariusz Felisiak     |                    Owner:  Mariusz
                                     |  Felisiak
         Type:  Bug                  |                   Status:  assigned
    Component:  Core (Management     |                  Version:  3.1
  commands)                          |
     Severity:  Normal               |               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 Nick Pope):

 With the following folder structure and permissions:

 {{{
 drwxr-x--x root root  /broken
 drwxr-x--x root root  /broken/home
 drwx------ user users /broken/home/user
 drwx------ user users /broken/home/user/package
 drwx------ user users /broken/home/user/package/thing
 }}}

 Running the following works fine:

 {{{#!python
 >>> import os
 >>> import pathlib
 >>> os.chdir('/broken/home/user')
 >>> pathlib.Path('package/thing')
 PosixPath('package/thing')
 >>> pathlib.Path('package/thing').resolve(strict=True)
 PosixPath('/broken/home/user/package/thing')
 }}}

 If I then do `sudo chmod o-x /broken` and run the following in my open
 REPL:

 {{{#!python
 >>> pathlib.Path('package/thing').resolve(strict=True)
 ...
 PermissionError: [Errno 13] Permission denied: '/broken/home/user/package'
 }}}

 But then the following would also be a problem because without the
 executable bit the directory cannot be traversed:

 {{{#!python
 >>> os.chdir('/broken/home/user')
 ...
 PermissionError: [Errno 13] Permission denied: '/broken/home/user'
 }}}

 So to summarise:

 - As far as I can tell, the issue must be with `ugidfw` -- mentioned in
 the original report -- which looks to be FreeBSD-specific.
 - There is implication that it is difficult to configure with few
 examples, e.g.
 [https://twitter.com/thedarktangent/status/1179976664018632704 here].
 - We don't explicitly test Django on FreeBSD. Is it considered supported?
 (I know this is a contentious point, but it should be asked.)
 - It won't stop here. We'll have to remove all uses of
 `.resolve(strict=True)` which may mean removing all use of `pathlib`.

 Some other quick fire questions:

 - What hosting platform is the original bug reporter using?
 - Do they work for that company?
 - If so, have they configured `ugidfw` properly? (Not trying to be
 obnoxious, but this is a serious point. Many more things will be broken if
 `readlink` doesn't work.)

 I believe this is a wontfix.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.219f652fcea7bfce8907c397850c8dd6%40djangoproject.com.

Reply via email to