Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open_excl : open_flag doesn't work #3450

Closed
vicuna opened this issue Jan 27, 2005 · 3 comments
Closed

Open_excl : open_flag doesn't work #3450

vicuna opened this issue Jan 27, 2005 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jan 27, 2005

Original bug ID: 3450
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Josef Svenningsson
Version: 3.08.1
OS: Windows/Cygwin
Submission from: dhcp-246-17.nomad.chalmers.se (129.16.246.17)

I want my program to fail when trying to open an already existing file. So I use
the following command:
open_out_gen [Open_wronly;Open_excl;Open_text] 0o666 filename

(This is a variation on open_out with Open_excl added instead of Open_trunc.)
However, opening an already existing file works perfectly fine! The program
doesn't fail.

Thanks,

/Josef

@vicuna
Copy link
Author

vicuna commented Jan 27, 2005

Comment author: administrator

Full_Name: Josef Svenningsson
Version: 3.08.1
OS: Windows/Cygwin
Submission from: dhcp-246-17.nomad.chalmers.se (129.16.246.17)

I want my program to fail when trying to open an already existing file. So I
use
the following command:
open_out_gen [Open_wronly;Open_excl;Open_text] 0o666 filename

(This is a variation on open_out with Open_excl added instead of Open_trunc.)
However, opening an already existing file works perfectly fine! The program
doesn't fail.

Thanks for your bug report.

From the man page for the open() system call:
O_EXCL error if create and file exists

The semantics of Unix system calls is that you have to add Open_creat for
Open_excl to have any effect. I will fix our documentation to make this
explicit.

-- Damien

@vicuna
Copy link
Author

vicuna commented Jan 27, 2005

Comment author: administrator

fixed by better documentation DD 2005-01-27

@vicuna vicuna closed this as completed Jan 27, 2005
@vicuna
Copy link
Author

vicuna commented Jan 27, 2005

Comment author: administrator

On Thu, 27 Jan 2005 18:02:07 +0100 (MET), Damien Doligez
caml-bugs@pauillac.inria.fr wrote:

Full_Name: Josef Svenningsson
Version: 3.08.1
OS: Windows/Cygwin
Submission from: dhcp-246-17.nomad.chalmers.se (129.16.246.17)

I want my program to fail when trying to open an already existing file. So I
use
the following command:
open_out_gen [Open_wronly;Open_excl;Open_text] 0o666 filename

(This is a variation on open_out with Open_excl added instead of Open_trunc.)
However, opening an already existing file works perfectly fine! The program
doesn't fail.

Thanks for your bug report.

From the man page for the open() system call:
O_EXCL error if create and file exists

The semantics of Unix system calls is that you have to add Open_creat for
Open_excl to have any effect. I will fix our documentation to make this
explicit.

Thanks! I had to add Open_creat anyway (as I noticed) so it is not a
show stopper for me.

Cheers,

/Josef

@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant