Re: [R] Bug with writeClipboard in {utils}

2024-06-21 Thread Ivan Krylov via R-help
В Thu, 20 Jun 2024 18:39:34 +0300
Ivan Krylov via R-help  пишет:

> > Is there a way to test this patch or will there soon be a published
> > patched R version available for download?  
> 
> Not directly.

Now that the bug is fixed in R-devel (thanks Tomas!), a Windows build
of the development version of R with the fix is available:
https://cran.r-project.org/bin/windows/base/rdevel.html

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bug with writeClipboard in {utils}

2024-06-21 Thread Barthelemy Tanguy via R-help
Hello,

Thank you for your research and your bug report.
At the end of your bug report 
(https://bugs.r-project.org/show_bug.cgi?id=18747) you mentioned that "the 
problem doesn't reappear with the attached patch".

Is there a way to test this patch or will there soon be a published patched R 
version available for download?

Thank you again

Tanguy BARTHELEMY




De : Ivan Krylov 
Envoyé : mercredi 19 juin 2024 16:07
À : r-help@r-project.org
Cc : Barthelemy Tanguy
Objet : Re: [R] Bug with writeClipboard in {utils}

« Ce courriel provient d’un expéditeur extérieur à l’Insee. Compte tenu du 
contexte de menace cyber actuel il convient d’être extrêmement vigilant sur 
l’émetteur et son contenu avant d’ouvrir une pièce jointe, de cliquer sur un 
lien internet présent dans ce message ou d'y répondre. »


В Tue, 18 Jun 2024 10:12:04 +
Barthelemy Tanguy via R-help  пишет:

> #> [1] "plot(AirPassengers)" "⤀攀"
> #> [1] "plot(AirPassengers)" "\u0a00"
> #> [1] "plot(AirPassengers)" "\xed\xb0\x80ư"

Thanks for showing an example!

I was able to reproduce it both with R-4.3.1 on Windows 7 and with a
fresh R-devel build on Windows 10. Bug reported at
<https://bugs.r-project.org/show_bug.cgi?id=18747>.

--
Best regards,
Ivan

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bug with writeClipboard in {utils}

2024-06-21 Thread Barthelemy Tanguy via R-help
Hello,

Thank you for your different tests.

You have that you didn't find any errors with Rscript or with R but I have the 
impression that your test with R (second test) showed additional and unwanted 
characters (second line of the output)?

Thank you again

Tanguy BARTHELEMY



De : Rui Barradas 
Envoyé : mercredi 19 juin 2024 19:26
À : Barthelemy Tanguy; r-help@r-project.org
Objet : Re: [R] Bug with writeClipboard in {utils}

« Ce courriel provient d’un expéditeur extérieur à l’Insee. Compte tenu du 
contexte de menace cyber actuel il convient d’être extrêmement vigilant sur 
l’émetteur et son contenu avant d’ouvrir une pièce jointe, de cliquer sur un 
lien internet présent dans ce message ou d'y répondre. »


Às 11:12 de 18/06/2024, Barthelemy Tanguy via R-help escreveu:
> Hello,
>
> I'm encountering what seems to be a bug when using the `writeClipboard()` 
> function in the R {utils} package.
> When I try to copy text to the clipboard, I notice that I get extra 
> characters when I try to paste it (by hand with CTRL+V or with the 
> `readClipboard()` function from R packages {utils}).
>
> Here's my example:
>
> ``` r
> utils::writeClipboard("plot(AirPassengers)")
> for (k in 1:10) {
>  print(utils::readClipboard())
> }
> #> [1] "plot(AirPassengers)" "⤀攀"
> #> [1] "plot(AirPassengers)" "\u0a00"
> #> [1] "plot(AirPassengers)" "\xed\xb0\x80ư"
> #> [1] "plot(AirPassengers)"
> #> [1] "plot(AirPassengers)"
> #> [1] "plot(AirPassengers)"
> #> [1] "plot(AirPassengers)"
> #> [1] "plot(AirPassengers)"
> #> [1] "plot(AirPassengers)" "⤀"
> #> [1] "plot(AirPassengers)"
> Message d'avis :
> Dans utils::readClipboard() : unpaired surrogate Unicode point dc00
> ```
>
> So I don't always get the same result.
> I opened a problem in the {clipr} GitHub repository before realizing it's a 
> {tools} problem: https://github.com/mdlincoln/clipr/issues/68
>
> Is this a bug or something I haven't configured properly?
>
>
> Thank you very much
>
>
> Tanguy BARTHELEMY
>
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Hello,

I have reproduced part of the behavior in the OP but it will depend on
the GUI or command line used.

With Rscript or with R I haven't found any errors.
With Rgui or with RStudio, yes, the output was not the expected output.

All code run in R 4.4.0 on Windows 11.

The script rscript.R is


utils::capture.output({
utils::writeClipboard("plot(AirPassengers)")
for (k in 1:10) {
   print(utils::readClipboard())
}
sessionInfo()
}, file = "rhelp.txt")


---

Here are the results I got.

1) Command:

Rscript rscript.R

Output:

[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=Portuguese_Portugal.utf8
LC_CTYPE=Portuguese_Portugal.utf8
[3] LC_MONETARY=Portuguese_Portugal.utf8 LC_NUMERIC=C

[5] LC_TIME=Portuguese_Portugal.utf8

time zone: Europe/Lisbon
tzcode source: internal

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.4.0

---

2) Command:
R -q -f rscript.R

Output:

 > utils::writeClipboard("plot(AirPassengers)")
 > for (k in 1:10) {
+ print(utils::readClipboard())
+ }
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)" "㨀Ǐ\005"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
 > sessionInfo()
R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=Portuguese_Portugal.utf8
LC_CTYPE=Portuguese_Portugal.utf8
[3] LC_MONETA

Re: [R] Bug with writeClipboard in {utils}

2024-06-20 Thread Ivan Krylov via R-help
В Thu, 20 Jun 2024 13:21:38 +
Barthelemy Tanguy  пишет:

> Is there a way to test this patch or will there soon be a published
> patched R version available for download?

Not directly. If you're willing to follow the partially manual process
yourself, the instructions at [1] describe how to download R-devel and
compile the program. It's not spelled out anywhere how to apply patches
(some work is in progress at [2]), so feel free to ask additional
questions about `svn patch` if you would like to go this way.

Alternatively, taking a patch and submitting it as a pull request to
https://github.com/r-devel/r-svn will result in several checks being
run on it, one of which builds an R installer (e.g. see the artifacts
at [3]).

The remaining option is to wait for the bug to be fixed. Allocating
enough space for the terminator is probably necessary, but the R
developers may also decide to make readClipboard() more robust against
missing terminators.

Some fixes can be backported to R-patched; snapshots of R-patched
compiled for Windows are available from CRAN. R-patched may eventually
become R-4.4.2. If not backported, the fix will appear in the next
version of R.

-- 
Best regards,
Ivan

[1]
https://cran.r-project.org/bin/windows/base/howto-R-devel.html#building-r-from-source-using-rtools44

[2]
https://github.com/r-devel/rdevguide/issues/170

[3]
https://github.com/r-devel/r-svn/actions/runs/8749727418

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bug with writeClipboard in {utils}

2024-06-20 Thread Rui Barradas

Hello,

Inline.

Às 14:15 de 20/06/2024, Barthelemy Tanguy escreveu:

Hello,

Thank you for your different tests.

You have that you didn't find any errors with Rscript or with R but I have the 
impression that your test with R (second test) showed additional and unwanted 
characters (second line of the output)?


You are right, in the case I posted there were unwanted characters.
Most of the tests I ran there were no additional, unwanted charcters, 
though.

This is definitely unstable, that's all I can say.

Hope this helps,

Rui Barradas


Thank you again

Tanguy BARTHELEMY



De : Rui Barradas 
Envoyé : mercredi 19 juin 2024 19:26
À : Barthelemy Tanguy; r-help@r-project.org
Objet : Re: [R] Bug with writeClipboard in {utils}

« Ce courriel provient d’un expéditeur extérieur à l’Insee. Compte tenu du 
contexte de menace cyber actuel il convient d’être extrêmement vigilant sur 
l’émetteur et son contenu avant d’ouvrir une pièce jointe, de cliquer sur un 
lien internet présent dans ce message ou d'y répondre. »


Às 11:12 de 18/06/2024, Barthelemy Tanguy via R-help escreveu:

Hello,

I'm encountering what seems to be a bug when using the `writeClipboard()` 
function in the R {utils} package.
When I try to copy text to the clipboard, I notice that I get extra characters 
when I try to paste it (by hand with CTRL+V or with the `readClipboard()` 
function from R packages {utils}).

Here's my example:

``` r
utils::writeClipboard("plot(AirPassengers)")
for (k in 1:10) {
  print(utils::readClipboard())
}
#> [1] "plot(AirPassengers)" "⤀攀"
#> [1] "plot(AirPassengers)" "\u0a00"
#> [1] "plot(AirPassengers)" "\xed\xb0\x80ư"
#> [1] "plot(AirPassengers)"
#> [1] "plot(AirPassengers)"
#> [1] "plot(AirPassengers)"
#> [1] "plot(AirPassengers)"
#> [1] "plot(AirPassengers)"
#> [1] "plot(AirPassengers)" "⤀"
#> [1] "plot(AirPassengers)"
Message d'avis :
Dans utils::readClipboard() : unpaired surrogate Unicode point dc00
```

So I don't always get the same result.
I opened a problem in the {clipr} GitHub repository before realizing it's a 
{tools} problem: https://github.com/mdlincoln/clipr/issues/68

Is this a bug or something I haven't configured properly?


Thank you very much


Tanguy BARTHELEMY


   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Hello,

I have reproduced part of the behavior in the OP but it will depend on
the GUI or command line used.

With Rscript or with R I haven't found any errors.
With Rgui or with RStudio, yes, the output was not the expected output.

All code run in R 4.4.0 on Windows 11.

The script rscript.R is


utils::capture.output({
utils::writeClipboard("plot(AirPassengers)")
for (k in 1:10) {
print(utils::readClipboard())
}
sessionInfo()
}, file = "rhelp.txt")


---

Here are the results I got.

1) Command:

Rscript rscript.R

Output:

[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=Portuguese_Portugal.utf8
LC_CTYPE=Portuguese_Portugal.utf8
[3] LC_MONETARY=Portuguese_Portugal.utf8 LC_NUMERIC=C

[5] LC_TIME=Portuguese_Portugal.utf8

time zone: Europe/Lisbon
tzcode source: internal

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.4.0

---

2) Command:
R -q -f rscript.R

Output:

  > utils::writeClipboard("plot(AirPassengers)")
  > for (k in 1:10) {
+ print(utils::readClipboard())
+ }
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)" "㨀Ǐ\005"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
  > sessionInfo()
R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:

Re: [R] Bug with writeClipboard in {utils}

2024-06-19 Thread Rui Barradas

Às 11:12 de 18/06/2024, Barthelemy Tanguy via R-help escreveu:

Hello,

I'm encountering what seems to be a bug when using the `writeClipboard()` 
function in the R {utils} package.
When I try to copy text to the clipboard, I notice that I get extra characters 
when I try to paste it (by hand with CTRL+V or with the `readClipboard()` 
function from R packages {utils}).

Here's my example:

``` r
utils::writeClipboard("plot(AirPassengers)")
for (k in 1:10) {
 print(utils::readClipboard())
}
#> [1] "plot(AirPassengers)" "⤀攀"
#> [1] "plot(AirPassengers)" "\u0a00"
#> [1] "plot(AirPassengers)" "\xed\xb0\x80ư"
#> [1] "plot(AirPassengers)"
#> [1] "plot(AirPassengers)"
#> [1] "plot(AirPassengers)"
#> [1] "plot(AirPassengers)"
#> [1] "plot(AirPassengers)"
#> [1] "plot(AirPassengers)" "⤀"
#> [1] "plot(AirPassengers)"
Message d'avis :
Dans utils::readClipboard() : unpaired surrogate Unicode point dc00
```

So I don't always get the same result.
I opened a problem in the {clipr} GitHub repository before realizing it's a 
{tools} problem: https://github.com/mdlincoln/clipr/issues/68

Is this a bug or something I haven't configured properly?


Thank you very much


Tanguy BARTHELEMY


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Hello,

I have reproduced part of the behavior in the OP but it will depend on 
the GUI or command line used.


With Rscript or with R I haven't found any errors.
With Rgui or with RStudio, yes, the output was not the expected output.

All code run in R 4.4.0 on Windows 11.

The script rscript.R is


utils::capture.output({
utils::writeClipboard("plot(AirPassengers)")
for (k in 1:10) {
  print(utils::readClipboard())
}
sessionInfo()
}, file = "rhelp.txt")


---

Here are the results I got.

1) Command:

Rscript rscript.R

Output:

[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=Portuguese_Portugal.utf8 
LC_CTYPE=Portuguese_Portugal.utf8
[3] LC_MONETARY=Portuguese_Portugal.utf8 LC_NUMERIC=C 


[5] LC_TIME=Portuguese_Portugal.utf8

time zone: Europe/Lisbon
tzcode source: internal

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.4.0

---

2) Command:
R -q -f rscript.R

Output:

> utils::writeClipboard("plot(AirPassengers)")
> for (k in 1:10) {
+ print(utils::readClipboard())
+ }
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)" "㨀Ǐ\005"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
> sessionInfo()
R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=Portuguese_Portugal.utf8 
LC_CTYPE=Portuguese_Portugal.utf8
[3] LC_MONETARY=Portuguese_Portugal.utf8 LC_NUMERIC=C 


[5] LC_TIME=Portuguese_Portugal.utf8

time zone: Europe/Lisbon
tzcode source: internal

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.4.0
>

---

3) GUI: RStudio
Output:

[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)" "礀摟瑡扡獡e"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)" "봀翿"
[1] "plot(AirPassengers)" "礀摟瑡扡獡e"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
[2] "礀摟瑡扡獡eX泙瑢ᄀ耀㜰戲扡捤㔭挷ⴱ㘴㍦戭㜱ⴰ慣㈶㜸㍥捣攳Ȁ"
[1] "plot(AirPassengers)" "촀˖"
[1] "plot(AirPassengers)"
[1] "plot(AirPassengers)"
R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=Portuguese_Portugal.utf8 
LC_CTYPE=Portuguese_Portugal.utf8
[3] LC_MONETARY=Portuguese_Portugal.utf8 LC_NUMERIC=C 


[5] LC_TIME=Portuguese_Portugal.utf8

time zone: Europe/Lisbon
tzcode source: internal

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
 [1] gtable_0.3.4 tensorA_0.36.2.1 ggplot2_3.5.0
 [4] QuickJSR_1.1.3   processx_3.8.3   inline_0.3.19
 [7] lattice_0.22-5   tzdb_0.4.0   callr_3.7.5
[10] vctrs_0.6.5  tools_4.4.0  ps_1.7.6
[13] generics_0.1.3   stats4_4.4.0 curl_5.2.1
[16] parallel_4.4

Re: [R] Bug with writeClipboard in {utils}

2024-06-19 Thread Ivan Krylov via R-help
В Tue, 18 Jun 2024 10:12:04 +
Barthelemy Tanguy via R-help  пишет:

> #> [1] "plot(AirPassengers)" "⤀攀"
> #> [1] "plot(AirPassengers)" "\u0a00"
> #> [1] "plot(AirPassengers)" "\xed\xb0\x80ư"

Thanks for showing an example!

I was able to reproduce it both with R-4.3.1 on Windows 7 and with a
fresh R-devel build on Windows 10. Bug reported at
.

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.