Code

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#14145 closed (fixed)

undeterministic behavior when project or app template contains dotdir

Reported by: marbu Owned by: PaulM
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 4 years ago.

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by marbu

comment:1 Changed 4 years ago by PaulM

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to PaulM
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Ready 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 4 years ago by PaulM

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 4 years ago by lukeplant

  • Resolution set to fixed
  • Status changed from assigned to closed

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

Thanks to marbu for report and patch.

comment:4 Changed 4 years ago by lukeplant

(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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.