From nsosnov at microsoft.com  Tue Jul  4 15:44:48 2017
From: nsosnov at microsoft.com (Nathan Sosnovske)
Date: Tue, 4 Jul 2017 13:44:48 +0000
Subject: [Rd] write.csv
In-Reply-To: <db38cf87-82f7-835c-2cac-412d6db8c5a1@gmail.com>
References: <FEF25E56AFC7064784FA97C576467E0AC7ACBE68@pdexchbalwst01.ad.insee.intra>
 <bc3fc4f2-a7ab-d061-3ef3-999479643a46@gmail.com>
 <FEF25E56AFC7064784FA97C576467E0AC7ACBEE5@pdexchbalwst01.ad.insee.intra>
 <SN1PR21MB00610583F90D1F99EE62E7CFB7D70@SN1PR21MB0061.namprd21.prod.outlook.com>
 <db38cf87-82f7-835c-2cac-412d6db8c5a1@gmail.com>
Message-ID: <SN1PR21MB00617B4EDC5B0AE24A070966B7D70@SN1PR21MB0061.namprd21.prod.outlook.com>

Ah, I misread the example code (went straight to the line where the error was raised for fwrite). Apologies Jean-Luc.

-----Original Message-----
From: Duncan Murdoch [mailto:murdoch.duncan at gmail.com] 
Sent: Tuesday, July 4, 2017 6:39 AM
To: Nathan Sosnovske <nsosnov at microsoft.com>; Lipatz Jean-Luc <jean-luc.lipatz at insee.fr>
Cc: r-devel at r-project.org
Subject: Re: [Rd] write.csv

On 04/07/2017 8:46 AM, Nathan Sosnovske wrote:
> This doesn't really strike me as a bug. Lots of (most?) programming languages expect you to handle this as an error condition. If you tried the same thing in C you would get the same error.

The bug is that there is no error signalled.  It looks as though the write succeeded, when it didn't.

Duncan Murdoch

> -----Original Message-----
> From: R-devel [mailto:r-devel-bounces at r-project.org] On Behalf Of 
> Lipatz Jean-Luc
> Sent: Tuesday, July 4, 2017 5:40 AM
> To: Duncan Murdoch <murdoch.duncan at gmail.com>
> Cc: r-devel at r-project.org
> Subject: Re: [Rd] write.csv
>
> I would really like the bug fixed. At least this one, because I know people in my institute using this function.
> I understand your arguments about open source, but I also saw in this mail list a proposal for a fix for this bug for which there were no answer from the people who are able to include it in the distribution. It looks like if there were interesting bugs and the other ones.
> I don't understand the other arguments : the example was reproduced with a simple USB key and you cannot state that a disk will eternally be empty enough, specially when it has several users.
>
> JLL
>
>
> -----Message d'origine-----
> De : Duncan Murdoch [mailto:murdoch.duncan at gmail.com] Envoy? : mardi 4 
> juillet 2017 14:24 ? : Lipatz Jean-Luc; r-devel at r-project.org Objet : 
> Re: [Rd] write.csv
>
> On 04/07/2017 5:40 AM, Lipatz Jean-Luc wrote:
>> Hi all,
>>
>> I am currently studying how to generalize the usage of R in my statistical institute and I encountered a problem that I cannot declare on bugzilla (cannot understand why).
>
> Bugzilla was badly abused by spammers last year, so you need to have 
> your account created manually by one of the admins to post there.  
> Write to me privately if you'd like me to create an account for you.  
> (If you want it attached to a different email address, that's fine.)
>
> Sorry for trying this mailing list but I am really worried about the problem itself and the possible implications in using R in a professionnal data production context.
>> The issue about 'write.csv' is that it just doesn't check if there is enough space on disk and doesn't report failure to write data.
>>
>> Example (R 3.4.0 windows 32 bits, but I reproduced the problem with 
>> older versions and under Mac OS/X)
>>
>>> fwrite(as.list(1:1000000),"G:/Test")
>> Error in fwrite(as.list(1:1e+06), "G:/Test") :
>>   No space left on device: 'G:/Test'
>>> write.csv(1:1000000,"G:/Test")
>>>
>>
>> I have a big concern here, because it means that you could save some important data at one point of time and discover a long time after that you actually lost them.
>  > I suppose that the fix is relatively straightforward, but how can we be sure that there is no another function with the same bad properties?
>
> R is open source.  You could work out the patch for this bug, and in the process see the pattern of coding that leads to it.  Then you'll know if other functions use the same buggy pattern.
>
>> Is the lesson that you should not use a R function, even from the core, without having personnally tested it against extreme conditions?
>
> I think the answer to that is yes.  Most people never write such big files that they fill their disk:  if they did, all sorts of things would go wrong on their systems.  So this kind of extreme condition isn't often tested.  It's not easy to test in a platform independent way:  R would need to be able to create a volume with a small capacity.  That's a very system-dependent thing to do.
>
>> And wouldn't it be the work of the developpers to do such elementary tests?
>
> Again, R is open source.  You can and should contribute code (and therefore become one of the developers) if you are working in unusual conditions.
>
> R states quite clearly in the welcome message every time it starts: "R is free software and comes with ABSOLUTELY NO WARRANTY."  This is essentially the same lack of warranty that you get with commercial software, though it's stated a lot more clearly.
>
> Duncan Murdoch
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.
> ethz.ch%2Fmailman%2Flistinfo%2Fr-devel&data=02%7C01%7Cnsosnov%40micros
> oft.com%7C92c3e87c4ca1482e32f908d4c2d9dd57%7C72f988bf86f141af91ab2d7cd
> 011db47%7C1%7C0%7C636347688364867350&sdata=7z5OJqLZDZ1zIvx8pP7KhQzNaQ%
> 2FBrhZFKdUHeiFfke4%3D&reserved=0
>



[Rd] write.csv
Nathan Sosnovske