#28154: Infinite loop in collectstatic -----------------------------------------------+------------------------ Reporter: Matthew Somerville | Owner: nobody Type: Bug | Status: new Component: contrib.staticfiles | Version: 1.11 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -----------------------------------------------+------------------------ If the static directory contains a broken symlink in place of a file that collectstatic wishes to copy*, then the code gets stuck in an infinite loop, because the os.open fails (O_CREAT | O_EXCL will fail if a symlink exists, even if it's to a non-existent file), but then get_available_name returns the same name (as it calls self.exists, which returns False for a broken symlink).
I guess two possibilities are: 1. don't care about broken symlinks. Change the flags setting in django/core/files/storage.py to not include O_EXCL if `os.path.islink(full_path) and not os.path.exists(full_path)`. 2. do care, change os.path.exists in the `exists` function to use os.path.lexists instead. I'm not sure which would be preferable to prevent this infinite loop. *I came across this issue because collectstatic had been run both inside and outside a Vagrant box, so symlinks created inside the box did not exist when collectstatic was then run outside. -- Ticket URL: <https://code.djangoproject.com/ticket/28154> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/049.164d892cdeaa67f99c99d73e5bcfb0e1%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.