Eric Blake wrote:
On 10/17/2016 01:32 AM, Thorsten Kampe wrote:
* Thorsten Kampe (Mon, 17 Oct 2016 08:25:13 +0200)

the following bash script results in a different output when redirected to a file.

printf "FIRST LINE\n" > /dev/stderr
shopt -os xtrace
printf "SECOMD LINE\n" > /dev/stderr

Cygwin treats '> /dev/stderr' as a request to truncate /dev/stderr (or,
for that matter, any opening of a file under /proc/self/fd).  Other
platforms treat that as a special file that can never be truncated, but
is instead reopened at the same offset.

Maybe cygwin can be taught that opening a file through /proc/self/fd
should preserve rather than reset offsets, but it will be a tricky
patch, and someone has to write it.
Is /dev/stderr a POSIX special name that one should expect that rewinding
is disallowed or ignored?

Good analysis, BTW, that sure would have puzzled me.

Problem reports:
Unsubscribe info:

Reply via email to