Bug 14692 - operations on closed connections produce errors
operations on closed connections produce errors
Status: CLOSED INVALID
Product: R
Classification: Unclassified
Component: I/O
R-devel (trunk)
x86_64/x64/amd64 (64-bit) Linux
: P5 enhancement
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-30 17:58 UTC by Martin Morgan
Modified: 2011-10-03 18:03 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Morgan 2011-09-30 17:58:17 UTC
This

  > con=file(tempfile()); close(con); isOpen(con)
  Error in isOpen(con) : invalid connection

in particular is awkward, leading to constructs such as

  tryCatch(if (isOpen(con)) close(con), error=function(...) {})

The enhancement request is that isOpen reports correctly on closed connections. An extended request would also address isIncomplete and close(con); open(con).

> sessionInfo()
R Under development (unstable) (2011-09-30 r57118)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
Comment 1 Brian Ripley 2011-10-03 12:21:24 UTC
In what sense is that not correct?  The connection has been closed 
*and destroyed*.

See the R News article on connections: this seems to be a fundamental
misunderstanding of how they work.
Comment 2 Martin Morgan 2011-10-03 18:03:34 UTC
a closed connection is not open; there is no test for 'invalid'.

On 10/03/2011 04:21 AM, r-bugs@r-project.org wrote:
> https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14692
>
> Brian Ripley<ripley@stats.ox.ac.uk>  changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>               Status|NEW                         |CLOSED
>           Resolution|                            |INVALID
>
> --- Comment #1 from Brian Ripley<ripley@stats.ox.ac.uk>  2011-10-03 07:21:24 EDT ---
> In what sense is that not correct?  The connection has been closed
> *and destroyed*.
>
> See the R News article on connections: this seems to be a fundamental
> misunderstanding of how they work.
>



-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793