Message ID | 20190415133654.5744-1-i.maximets@samsung.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] checkpatch: Fix handling of line endings. | expand |
On Mon, Apr 15, 2019 at 04:36:54PM +0300, Ilya Maximets wrote: > Unlike manual splitting, 'splitlines' correctly handles different > line endings. Without this change script fails to check files with > '\r\n' endings treating the whole patch as a header. > > Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Thanks, I applied this to master. I don't think OVS legitimately has any text files that contain carriage returns, so it might be worth warning about them.
On 15.04.2019 22:35, Ben Pfaff wrote: > On Mon, Apr 15, 2019 at 04:36:54PM +0300, Ilya Maximets wrote: >> Unlike manual splitting, 'splitlines' correctly handles different >> line endings. Without this change script fails to check files with >> '\r\n' endings treating the whole patch as a header. >> >> Signed-off-by: Ilya Maximets <i.maximets@samsung.com> > > Thanks, I applied this to master. > > I don't think OVS legitimately has any text files that contain carriage > returns, so it might be worth warning about them. 'git am' by default strips '\r' symbols. OTOH, some mail clients adds them. There might be a lot of false positives if we'll add this kind of check to checkpatch.
On Tue, Apr 16, 2019 at 10:31:20AM +0300, Ilya Maximets wrote: > On 15.04.2019 22:35, Ben Pfaff wrote: > > On Mon, Apr 15, 2019 at 04:36:54PM +0300, Ilya Maximets wrote: > >> Unlike manual splitting, 'splitlines' correctly handles different > >> line endings. Without this change script fails to check files with > >> '\r\n' endings treating the whole patch as a header. > >> > >> Signed-off-by: Ilya Maximets <i.maximets@samsung.com> > > > > Thanks, I applied this to master. > > > > I don't think OVS legitimately has any text files that contain carriage > > returns, so it might be worth warning about them. > > 'git am' by default strips '\r' symbols. OTOH, some mail clients adds them. > There might be a lot of false positives if we'll add this kind of check > to checkpatch. OK, never mind then.
diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 369911960..441eaa807 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -725,7 +725,7 @@ def ovs_checkpatch_parse(text, filename, author=None, committer=None): reset_counters() - for line in text.split('\n'): + for line in text.splitlines(): if current_file != previous_file: previous_file = current_file
Unlike manual splitting, 'splitlines' correctly handles different line endings. Without this change script fails to check files with '\r\n' endings treating the whole patch as a header. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> --- utilities/checkpatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)