{"thread":{"id":"64391","subject":"Broken WS_BLANK_AT_EOF highlighting with 0-length diff hunks","startedAt":"2025-10-27T13:20:43Z","lastAt":"2025-10-27T13:20:43Z","messageCount":1,"participants":["Alice Carlotti"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"529728","messageId":"5447f4f0-68be-b554-9fde-579a8dac69ff@e124511.cambridge.arm.com","threadId":"64391","inReplyTo":null,"subject":"Broken WS_BLANK_AT_EOF highlighting with 0-length diff hunks","fromName":"Alice Carlotti","fromEmail":"alice.carlotti@arm.com","sentAt":"2025-10-27T13:20:03Z","receivedAt":"2025-10-27T13:20:43Z","isPatch":false,"sender":{"key":"alice.carlotti@arm.com","avatar":null},"body":"Whitespace error highlighting is missing for blank lines at end of file when\nthe final hunk contains either zero old lines or zero new lines.  This most\ncommonly occurs with new files (which happens to be when WS_BLANK_AT_EOF errors\nare most likely to be introduced), but can also occur with -U0.\n\nThe reason for this is that the initial line number in a hunk header is reduced\nby one for zero length ranges.  In particular, an empty file uses 0,0 whereas a\nfull nonempty file uses 1,N.  This discrepancy is deliberate, and was agreed in\nhttps://lore.kernel.org/git/7vbqvictsc.fsf@assigned-by-dhcp.cox.net/.\n\nWe currently parse the hunk headers in diff.c:find_lno().  We could therefore\nfix the bug here by incrementing lno_in_{pre|post}image whenever the\ncorresponding length is zero.  Parsing the full ranges is complicated, but I\nnotice that there is code to do this in apply.c:parse_range() - perhaps this\ncode could be copied or reused?\nIMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.\n"}]}