Using patch.3.0.0~alpha2, opam 2.4.0~alpha2 generates and prints the following malformed diff:
--- default/packages/b0/b0.0.0.5/opam
+++ default.new/packages/b0/b0.0.0.5/opam
@@ -45,0 +45,1 @@
\ No newline at end of file
+x-maintenance-intent: ["(latest)"]
\ No newline at end of file
Parsing that file (understandably) raises the following error:
Failure {|"no newline at the end of file" is not at the end of the file|}
For reference, this is what GNU diff outputs for such change:
$ printf "%s" a > a
$ printf "%s\nb" a > b
$ diff -u a b
--- a 2025-05-27 17:27:01.410580904 +0100
+++ b 2025-05-27 17:27:10.235615949 +0100
@@ -1 +1,2 @@
-a
\ No newline at end of file
+a
+b
\ No newline at end of file