GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — diff - `-p`/`-F` function line is cut at 40 characters, not bytes, and keeps a trailing `\v` · Issue #359 · uutils/diffutils Open Labels bugSomething isn't workingSomething isn't workinggnu-compatBehaviour differs from GNUBehaviour differs from GNUgood first issueGood for newcomersGood for newcomersoss-scannerFound by Anthropic's OSS ScannerFound by Anthropic's OSS Scanner DescriptionGNU diff shows at most 40 bytes of the matching function line after the Reproductionpython3 -c "open('fn1','w').write('func_' + 'é'*40 + '()\n1\n2\n3\n4\n5\n6\n')" sed 's/^5$/X/' fn1 > fn2 printf 'fg()\v\n1\n2\n3\n4\n5\n6\n' > fv1; sed 's/^5$/X/' fv1 > fv2 Rust (incorrect) $ LC_ALL=C ./target/release/diffutils diff -u -p fn1 fn2 | grep '^@@' | cat -v @@ -3,5 +3,5 @@ func_M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-) $ ./target/release/diffutils diff -u -F '^f' fv1 fv2 | grep '^@@' | cat -A @@ -3,5 +3,5 @@ fg()^K$ # Exit code (diff): 1 in both cases GNU (correct) $ LC_ALL=C diff -u -p fn1 fn2 | grep '^@@' | cat -v @@ -3,5 +3,5 @@ func_M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-CM-)M-C $ LC_ALL=C diff -u -F '^f' fv1 fv2 | grep '^@@' | cat -A @@ -3,5 +3,5 @@ fg()$ # Exit code (diff): 1 in both cases GNU cuts at exactly 40 bytes, even in the middle of a UTF-8 sequence (same result with Root cause
let line = self.last_match?.trim_ascii_start(); let end = match std::str::from_utf8(line) { Ok(text) => text .char_indices() .nth(Self::MAX_WIDTH) .map_or(line.len(), |(end, _)| end), Err(_) => line.len().min(Self::MAX_WIDTH), }; Some(line[..end].trim_ascii_end().to_vec()) TestAdd to #[test] fn function_line_trailing_vertical_tab_is_trimmed() -> Result<(), Box<dyn std::error::Error>> { let mut old = NamedTempFile::new()?; old.write_all(b"fg()\x0b\n1\n2\n3\n4\n5\n6\n")?; let mut new = NamedTempFile::new()?; new.write_all(b"fg()\x0b\n1\n2\n3\n4\nX\n6\n")?; let mut cmd = cargo_bin_cmd!("diffutils"); cmd.arg("diff").arg("-u").arg("-F").arg("^f").arg(old.path()).arg(new.path()); cmd.assert() .code(predicate::eq(1)) .stdout(predicate::str::contains("@@ -3,5 +3,5 @@ fg()\n")); Ok(()) } plus a case with a 40+-byte UTF-8 function line asserting the header suffix is exactly Reported by Anthropic's OSS Scanner (ANT-2026-Y18VUFCM). Activity
MetadataMetadataAssigneesLabelsbugSomething isn't workingSomething isn't workinggnu-compatBehaviour differs from GNUBehaviour differs from GNUgood first issueGood for newcomersGood for newcomersoss-scannerFound by Anthropic's OSS ScannerFound by Anthropic's OSS Scanner TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |