This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: OPEN, STATUS='NEW' of a symbolic link to a non-existing file.


On Sep 16 2009, Toon Moene wrote:
Steve Kargl wrote:

As you know, the unix philosophy is that everything is a file.
symlinks (and directories and devices and ...) may by special
files, but nonetheless they are files.

Well, we can agree to disagree then.


To me a symlink is an alias (another name) for a file.

The file either exists or it doesn't. The fact that the existence of the symlink leads to a failure in OPEN(..., STATUS='NEW',...) is just a consequence of us using open(..., O_CREAT | O_EXCL, ...).

Right. That's the second meaning of file that I described; it's at least as widespread in Unix as the first.

And to Steve:  PLEASE note that I am not denying that the word 'file' is
used in the way you described.  What I said is that it is not the ONLY
meaning in Unix.

The documentation of open is quite explicit: links are not followed when deciding on O_EXCL.

I think we're better off following the crowd here (although I've only tested xlf (IBM) and ifort (Intel)).

OK, here are some more.


Sun ONE Studio
INQUIRE => T
OPEN(OLD) => "status is 'OLD' and the file is a dangling symbolic link"
OPEN(NEW) => "status is 'NEW' and the file is a symbolic link"

Pathscale
INQUIRE => F
OPEN(OLD) => "No such file or directory"
OPEN(NEW) => "The file must not exist prior to OPEN if STATUS is 'NEW'"

NAG
INQUIRE => F
OPEN(OLD) => "Cannot find OLD file"
OPEN(NEW) => works

Having done my usual - i.e. turn confusion into chaos - I stand by my
position that you can do pretty well anything half-sane and be no worse
than any other compiler.

Regards,
Nick Maclaren.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]