Subject: bug#79372: bug report: cannot `sdiff -o` using temporary streams as input

From: Byron Hawkins <[email-masked]>
Date: Tue, 2 Sep 2025 19:20:40 +0200

---- general info

> sdiff --version
sdiff (GNU diffutils) 3.12
Copyright (C) 2025 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <
https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Thomas Lord.

> uname -a
Linux prism 6.15.5-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Jul  6
09:16:17 UTC 2025 x86_64 GNU/Linux

----- bug report

It is not possible to use the `-o` option of sdiff with a temporary input
stream. While sdiff does walk through the merge process correctly under
the following command, if the user ever selects "2" for a chunk having
lines not appearing in "1",sdiff fails to copy those lines into the `-o`
file.

    sdiff -o merge.txt local.txt <(ssh $remote "cat remote.txt")

Input file contents:

local.txt:
line 1
line 2
line 4

remote.txt:
line 1
line 2
line 3
line 4

Merge sequence: sdiff proposes a merge on line 3, with blank on the left
and "line 3" on the right. User chooses "2".

Expected content of merge.txt:
line 1
line 2
line 3
line 4

Actual content

of merge.txt:
line 1
line 2
line 4

Perhaps sdiff is going back to the file a second time when applying the
user's merge choice? In that case, it would seem the input stream is not
available for repeated access. If this is not supported, could that fact
please be documented?