Opened 14 years ago

Closed 14 years ago

Last modified 14 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: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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 14 years ago.

Download all attachments as: .zip

Change History (5)

by marbu, 14 years ago

Attachment: minor-django-bug.diff added

comment:1 by Paul McMillan, 14 years ago

Has patch: set
Owner: changed from nobody to Paul McMillan
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 by Paul McMillan, 14 years ago

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 by Luke Plant, 14 years ago

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 by Luke Plant, 14 years ago

(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