Opened 9 years ago

Closed 4 years ago

#25022 closed Bug (needsinfo)

collectstatic create self-referential symlink

Reported by: Aymeric Augustin Owned by: nobody
Component: contrib.staticfiles Version: 1.7
Severity: Normal Keywords:
Cc: emorley@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This has happened twice on our CI server, but I'm not sure how.

Relevant settings:

STATICFILES_DIRS = ('/var/lib/jenkins/jobs/project-pr-endtoend/workspace/frontend/dist',)
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
STATIC_ROOT = '/var/lib/jenkins/jobs/project-pr-endtoend/workspace/project/static'
STATIC_URL = '/static/'

Collectstatic command:

django-admin collectstatic --noinput --clear --link

(Possibly run several times in a row, with the same or different static files.)

We ended up with '/var/lib/jenkins/jobs/project-pr-endtoend/workspace/project/static/img/icon-sd3b7ad043d.png' which was a symlink to itself.

This prevented gunicorn from starting because we use whitenoise to serve static files, whitenoise scans the entire static directory on startup, and it couldn't stat a self-referential symlink.

This is quite surprising because:

  • If I clear the directory and re-run collectstatic, I cannot reproduce the issue
  • I expect --clear to wipe the directory first
  • I don't expect --link to create a self-referential symlink

(This may end up as needsinfo if I don't dig into the details and we can't figure out the bug from the code. But even then it may help someone who stumbles upon the same problem.)

Change History (3)

comment:1 by Tim Graham, 9 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Ed Morley, 9 years ago

Cc: emorley@… added

comment:3 by Carlton Gibson, 4 years ago

Resolution: needsinfo
Status: newclosed

This may end up as needsinfo...

Reviewing this, I can't reproduce with the details, so I think 6 years later we can say that a test case or project showing the issue to be Django's is probably needed.

Note: See TracTickets for help on using tickets.
Back to Top