mach clang-formant -c HEAD fails with TypeError: a bytes-like object is required, not 'str'
Categories
(Developer Infrastructure :: Source Code Analysis, defect)
Tracking
(firefox-esr68 unaffected, firefox-esr78 unaffected, firefox78 unaffected, firefox79 unaffected, firefox80 fixed)
Tracking | Status | |
---|---|---|
firefox-esr68 | --- | unaffected |
firefox-esr78 | --- | unaffected |
firefox78 | --- | unaffected |
firefox79 | --- | unaffected |
firefox80 | --- | fixed |
People
(Reporter: emilio, Assigned: emilio)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: regression)
Attachments
(1 file)
$ ./mach clang-format -c HEAD
Error running mach:
['clang-format', '-c', 'HEAD']
The error occurred in the implementation of the invoked mach command.
This should never occur and is likely a bug in the implementation of that
command.
You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file clang-format| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.
If filing a bug, please include the full output of mach, including this error
message.
The details of the failure are as follows:
TypeError: a bytes-like object is required, not 'str'
File "/home/emilio/src/moz/gecko-5/python/mozbuild/mozbuild/code-analysis/mach_commands.py", line 1723, in clang_format
return self._run_clang_format_diff(self._clang_format_diff,
File "/home/emilio/src/moz/gecko-5/python/mozbuild/mozbuild/code-analysis/mach_commands.py", line 2150, in _run_clang_format_diff
diff_process = Popen(self._get_clang_format_diff_command(commit), stdout=PIPE)
File "/home/emilio/src/moz/gecko-5/python/mozbuild/mozbuild/code-analysis/mach_commands.py", line 2092, in _get_clang_format_diff_command
pattern = pattern.replace('.*', '**')
I bet it's a regression from bug 1606475
Assignee | ||
Comment 1•5 years ago
|
||
Updated•5 years ago
|
Comment 2•5 years ago
|
||
Using six.ensure_str will be a better approach here because in py3 using just str will convert a bytes string into str string while keeping the the b letter in it while ensure_str will decode pattern if it is of type bytes to a proper str.
I couldn't comment on phabricator as I didn't have permission.
Assignee | ||
Comment 3•5 years ago
|
||
Huh, how didn't you have permission? Anyhow thanks for the suggestion! I'm far from a Python2 / 3 expert and it makes sense to me, so I applied it :)
Comment 5•5 years ago
|
||
I'm just a contributor maybe thats why I didn't have the permission to comment
Assignee | ||
Comment 6•5 years ago
|
||
Hmm, I think as long as you have an account you should be able to comment, were you logged in?
Comment 7•5 years ago
|
||
Yeah, I was logged in.
Comment 8•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Comment 9•5 years ago
|
||
Set release status flags based on info from the regressing bug 1606475
Updated•5 years ago
|
Updated•2 years ago
|
Description
•