Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#14145 closed (fixed)

undeterministic behavior when project or app template contains dotdir

Reported by: marbu Owned by: Paul McMillan
Component: Core (Management commands) Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

This bug is minor and is not causing any problems in current release, but if you are interested:

I found a bug in function copy_helper() from django/core/management/base. This functions manages the copy process of project or app template and tries to avoid copying certain files and directories. But the method used to skip directories starting with dot character is wrong - it deletes from the array it is iterating on, thus behaving in a non deterministic way.

Attachments (1)

minor-django-bug.diff (735 bytes) - added by marbu 6 years ago.

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by marbu

Attachment: minor-django-bug.diff added

comment:1 Changed 6 years ago by Paul McMillan

Has patch: set
Needs documentation: unset
Needs tests: unset
Owner: changed from nobody to Paul McMillan
Patch needs improvement: unset
Status: newassigned
Triage Stage: UnreviewedReady for checkin

Good catch here. It is a minor point, but as you said, it's non-deterministic and could be a problem for some python implementations. Modifying iterators while in use is always a bad idea.

comment:2 Changed 6 years ago by Paul McMillan

Just a further note: It looks like the existing code tried to solve this problem by using enumerate. Since enumerate is lazy, it behaves like a generator rather than creating the tuples immediately, and so the error remains.

comment:3 Changed 6 years ago by Luke Plant

Resolution: fixed
Status: assignedclosed

(In [13668]) Fixed #14145 - undeterministic behavior when project or app template contains dotdir

Thanks to marbu for report and patch.

comment:4 Changed 6 years ago by Luke Plant

(In [13681]) [1.2.X] Fixed #14145 - undeterministic behavior when project or app template contains dotdir

Thanks to marbu for report and patch.

Backport of [13668] from trunk.

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