accessing home directory via ~
Tobias Schlüter
Tobias.Schlueter@physik.uni-muenchen.de
Mon Feb 4 17:18:00 GMT 2008
Hi Janus,
Janus Weil wrote:
> Dear gfortraners,
> I just noticed that it is not possible with gfortran to access the
> user's home directory via the '~' character, as done in the following
> short program:
>
> program home
>
> implicit none
>
> open(99,file='~/test.dat')
>
> write(99,*) 'hello world!'
>
> close(99)
>
> end program
>
> When I compile this program with a recent 4.3 trunk build, I get the
> following error at runtime:
>
> At line 5 of file home.f90 (unit = 99, file = '')
> Fortran runtime error: File '~/test.dat' does not exist
>
> I have no idea if the Fortran standard says anything about this, and I
> guess it's not really platform independent, but at least under
> unix/linux using the '~' for the home directory is a common
> convention. And when compiled with ifort this program works as
> expected.
>
> So, should I consider this behaviour a bug or a feature of gfortran?
I think we should call wordexp() on filename arguments (i.e. consider
the current behavior a bug). I assume that you're seeing the same
discrepancy with shell variables, as in '$SOMEDIR/test.dat'?
I don't think we can fix that in the current 'regression fixes only'
state of development, so even if you prepare a patch, we won't be able
to include it before 4.4 :-(
Cheers,
- Tobi
More information about the Fortran
mailing list