Tesorio / django-anon

:shipit: Anonymize production data so it can be safely used in not-so-safe environments

Home Page:https://django-anon.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

anon.utils.fake_username may enter an infinite loop during short username generation

opened this issue · comments

Checklist

  • I have verified that that issue exists against the master branch of django-anon
  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate
  • I have reduced the issue to the simplest possible case
  • I have included a failing test as a pull request (If you are unable to do so we can still accept the issue)

Steps to reproduce

There's a slight random element to this bug, but it does occur relatively frequently. Attempt to generate a short fake username a few times and the issue will usually appear (the method enters an infinite loop).

>>> from anon import utils
>>> utils.fake_username(max_size=6)
'a26631'
>>> utils.fake_username(max_size=6)
# ... infinite loop

Expected behavior

A short fake username should be generated promptly.

Actual behavior

The method enters an infinite loop.