darcs

Issue 2704 darcs diff: no newline at end of output

Title darcs diff: no newline at end of output
Priority Status resolved
Milestone Resolved in 2.18.1
Superseder Nosy List bfrk
Assigned To
Topics

Created on 2023-06-01.10:07:02 by bfrk, last changed 2023-06-02.10:07:44 by noreply.

Messages
msg23303 (view) Author: bfrk Date: 2023-06-01.10:07:01
darcs diff --last=1 > PATCH
patch -p1 <PATCH

The patch command complains that "patch unexpectedly ends in middle 
of line".

2. What behaviour were you expecting instead?

3. What darcs version are you using? (Try: darcs --exact-version)

4. What operating system are you running?
msg23309 (view) Author: bfrk Date: 2023-06-02.09:21:36
If the output is redirected to a file, the output order is messed up: diff comes first, then the patch infos. Without redirection, it works 
as expected: first the patch infos, then the diff output.

How is that possible?
msg23310 (view) Author: bfrk Date: 2023-06-02.09:27:17
Ah, this is buffering: when we redirect to a file, stdout is block 
buffered. So the data is not written out (if small enough) and then we 
invoke the external diff program. Whereas terminal output is line 
buffered, so it works. The fix is simple: add a hFlush stdout after 
writing the patch infos.
msg23312 (view) Author: noreply Date: 2023-06-02.10:07:44
The following patch sent by Ben Franksen <ben.franksen@online.de> updated issue issue2704 with
status=resolved;resolvedin=2.18.1

Hash: 7448eb013527a57354b07d9ab1075b255fd13172
Author: Ben Franksen <ben.franksen@online.de>
* resolve issue2704: flush stdout before invoking external diff
History
Date User Action Args
2023-06-01 10:07:03bfrkcreate
2023-06-02 09:21:37bfrksetmessages: + msg23309
2023-06-02 09:27:17bfrksetmessages: + msg23310
2023-06-02 10:07:44noreplysetstatus: unknown -> resolved
messages: + msg23312
resolvedin: 2.18.1