﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28154	Infinite loop in collectstatic with broken symlinks	Matthew Somerville	Jacob Walls	"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."	Bug	closed	File uploads/storage	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
