Hello everyone!

I'm using django 1.9.10. (It is the same on 1.10.x)

After two day tracking an obscure bug I found it in the behavior of 
FileSystemStorage.exists.

I was using django compressor and it store compressed files in the django 
CACHE folder with a random name. It seems that the first random number is 
always the same, so if the file does exists the logic of the Storage class 
generates a second and different number.

In my CACHE folder there was a file named e8c59b724a2d.css, the number is 
the first generated, so I was expecting a generation of a new 
number/filename but it doesn't happened because the file was a link to 
itself (this strange situation was generated during deploy on another 
machine).

The method FileSystemStorage._save try to open file e8c59b724a2d.css and it 
gets the EEXISTS error, it ask for another name with the method 
(Storage).get_available_filename this method in its turn check for the 
existence of the file with (FileSystemStorage).exists, the last method uses 
the os.path.exists that for file e8c59b724a2d.css  (link on itself) returns 
False, in this way (Storage).get_available_filename return the same name 
causing an infinite loop.

Could be FileSystemStorage.exists changed to use os.path.lexists to make it 
more robust?

Thank you.

Alfredo Branco


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/9425d34d-06f6-48c1-bc7c-bb083005d063%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to