Buildbot crashes on non-ascii characters in Git branch names
- Dominant language
- Python
- Stars
- 5.5k
- Forks
- 1.7k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 6
Description
Had a developer send a PR that had the branch name `feature/🦆` which caused buildbot to crash when attempting to clone it.
Got this error:
```
buildbot.process.remotecommand.RemoteException: b'builtins.UnicodeEncodeError': 'ascii' codec can't encode character '\U0001f986' in position 4: ordinal not in range(128)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/twisted/spread/pb.py", line 1054, in _recvMessage netResult = object.remoteMessageReceived(self, message, netArgs, netKw)
File "/usr/local/lib/python3.6/dist-packages/twisted/spread/flavors.py", line 125, in remoteMessageReceived state = method(*args, **kw)
File "/usr/local/lib/python3.6/dist-packages/buildbot_worker/base.py", line 153, in remote_startCommand d = self.command.doStart() File "/usr/local/lib/python3.6/dist-packages/buildbot_worker/commands/base.py", line 160, in doStart d = defer.maybeDeferred(self.start) --- ---
File "/usr/local/lib/python3.6/dist-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw)
File "/usr/local/lib/python3.6/dist-packages/buildbot_worker/commands/shell.py", line 47, in start logEnviron=args.get('logEnviron', True),
File "/usr/local/lib/python3.6/dist-packages/buildbot_worker/runprocess.py", line 334, in __init__ self.command = to_bytes(util.Obfuscated.get_real(command))
File "/usr/local/lib/python3.6/dist-packages/buildbot_worker/runprocess.py", line 329, in to_bytes cmd[i] = a.encode(self.builder.unicode_encoding)
builtins.UnicodeEncodeError: 'ascii' codec can't encode character '\U0001f986' in position 4: ordinal not in range(128)
```
Contributor guide
Research direction
The traceback points to buildbot_worker/runprocess.py, especially to_bytes, after shell.py starts the command; begin there and reproduce the clone with a non-ASCII branch name. Done means the worker no longer crashes for that branch name and a regression test covers it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100