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 20780,collectstatic --link causes IOError when dangling symlink exists,Diederik van der Boor,John Giannelos,"When a symlink file already exists, but it's source was moved/renamed, `collectstatic` ends with an `IOError`. Here is a trackback example: {{{ Linking '/srv/www/virtualenvs/demo.example.org/src/django-filebrowser-no-grappelli-django14/filebrowser/static/filebrowser/js/FB_TinyMCE.js' Traceback (most recent call last): File ""manage.py"", line 10, in execute_from_command_line(sys.argv) File ""/srv/www/virtualenvs/demo.example.org/lib/python2.6/site-packages/django/core/management/__init__.py"", line 443, in execute_from_command_line utility.execute() File ""/srv/www/virtualenvs/demo.example.org/lib/python2.6/site-packages/django/core/management/__init__.py"", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File ""/srv/www/virtualenvs/demo.example.org/lib/python2.6/site-packages/django/core/management/base.py"", line 196, in run_from_argv self.execute(*args, **options.__dict__) File ""/srv/www/virtualenvs/demo.example.org/lib/python2.6/site-packages/django/core/management/base.py"", line 232, in execute output = self.handle(*args, **options) File ""/srv/www/virtualenvs/demo.example.org/lib/python2.6/site-packages/django/core/management/base.py"", line 371, in handle return self.handle_noargs(**options) File ""/srv/www/virtualenvs/demo.example.org/lib/python2.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py"", line 163, in handle_noargs collected = self.collect() File ""/srv/www/virtualenvs/demo.example.org/lib/python2.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py"", line 113, in collect handler(path, prefixed_path, storage) File ""/srv/www/virtualenvs/demo.example.org/lib/python2.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py"", line 275, in link_file os.symlink(source_path, full_path) OSError: [Errno 17] File exists }}} I switched moduled here, hence the symlinks of the previous ""filebrowser"" were still there, but no longer pointed to an existing file. The same also happens when one reorganized the project layout, while. How to reproduce: * Have a project with 1 app. * run `./manage.py collectstatic --link` * Rename that app, or move it to a sub package. * run `./manage.py collectstatic --link` again. ",Bug,closed,contrib.staticfiles,1.5,Normal,fixed,,John Giannelos,Accepted,1,0,0,0,0,0