[m-rev.] [PATCH] Improve Mercury's temporary files and directories predicates.
Julien Fischer
jfischer at opturion.com
Fri Apr 15 16:25:44 AEST 2016
On Fri, 15 Apr 2016, Paul Bone wrote:
> On Fri, Apr 15, 2016 at 03:36:30PM +1000, Julien Fischer wrote:
>>
>> Hi Paul,
>>
>> This change breaks backwards compatibility in the Java grade.
>>
>> On Wed, 13 Apr 2016, Paul Bone wrote:
>>
>>> + Add support for retriving the system/user's temporary directory.
>>> + Add support for creating temporary directories.
>>>
>>> library/io.m:
>>> Add temp_directory/3
>>>
>>> Add make_temp_directory/3 and make_temp_directory/5.
>>>
>>> make_temp_file/3 and make_temp_file/5 now return the full pathname on
>>> the Java backends.
>>>
>>> +import java.io.File;
>>> +import java.nio.file.Files;
>>> +import java.nio.file.Path;
>>> +import java.nio.file.Paths;
>>> +import java.nio.file.attribute.PosixFilePermissions;
>>> ").
>>
>> The java.nio.file package is only available since Java 1.7. The
>> documentation in README.Java currently says Java 1.5 or later are
>> supported. Furthermore, we (i.e. Opturion) still need to support Java
>> 1.6.
>
> Okay, I think what we may loose in that case is the security that temporary
> files and directories will be created with mode 600.
Directories will be mode 700 (at least if you're after the mkdtemp
behaviour).
> I'll fix it up. All we (YesLogic) really need is get_temp_directory. So
> that's easy to support without the other stuff, I simply got distracted :-/
I suggest shifting the secure version into a new library in extras (e.g.
java_util or java_extra or somthing)>
Obviously, for the C and C# backends we'd just use conditional
compilation to deal with this, but that's not an option for Java ...
I was intending to bump the minimum verison of Java required by Mercury
after the next release. Unfortunately, the verison I was planning to
bump it to was 1.6!
Julien.
More information about the reviews
mailing list