[Rd] Output pipes to TTY hang

Zafer Barutcuoglu z@|er@b@rutcuog|u @end|ng |rom gm@||@com
Mon May 20 07:36:59 CEST 2024


Hi,

I am seeing this on Linux as well as MacOS: Opening any output pipe from R 4.4.0 to TTY programs like "less"/"more" hangs, SIGINT-proof:
> $ R/4.4.0/bin/Rscript -e 'pipe("less", "w")'
> $ R/4.4.0/bin/Rscript -e 'cat("test", file="|less")
> $ R/4.4.0/bin/Rscript -e 'cat("test", file="|more")

R 4.3.3 and earlier have been working fine:
> $ R/4.3.3/bin/Rscript -e 'pipe("less", "w")'
> $ R/4.3.3/bin/Rscript -e 'cat("test", file="|less")
> $ R/4.3.3/bin/Rscript -e 'cat("test", file="|more")


R 4.4.0 also works fine with non-TTY output pipes:
> $ R/4.4.0/bin/Rscript -e 'pipe("cat", "w")'

> $ R/4.4.0/bin/Rscript -e 'cat("test", file="|cat")
> $ R/4.4.0/bin/Rscript -e 'cat("Hi!\n", file="|tr i o")'
> $ R/4.4.0/bin/Rscript -e 'cat("Hi!\n", file="|sed -e s/i/o/")'

For what it's worth, input pipes from less/more to R 4.4.0 do not hang, but are not always the same as before either. These are the same:
> $ R/4.3.3/bin/Rscript -e 'con <- pipe("less --version", "r"); readLines(con); close(con)'
> [1] "less (GNU regular expressions)" "Copyright (C) Mark Nudelman" ...
> $ R/4.4.0/bin/Rscript -e 'con <- pipe("less --version", "r"); readLines(con); close(con)'
> [1] "less (GNU regular expressions)" "Copyright (C) Mark Nudelman" ...
But these are not (again, on both Linux and MacOS):
> $ R/4.3.3/bin/Rscript -e 'con <- pipe("less", "r"); readLines(con); close(con)'
> [1] "Missing filename (\"less --help\" for help)"

> $ R/4.4.0/bin/Rscript -e 'con <- pipe("less", "r"); readLines(con); close(con)'
> character(0)


I did not see anything related here or in release notes or bugzilla. Is this a bug or something else?

Best,
--
Zafer


	[[alternative HTML version deleted]]



More information about the R-devel mailing list