Bug 24701

Summary: tempnam() possibly used unsafely by libg2c.so during FORTRAN compilation
Product: Base System Reporter: c_sudan <c_sudan>
Component: i386Assignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description c_sudan 2001-01-28 19:10:01 UTC
Compiling/executing a FORTRAN program fails, with the following message displayed: "/usr/lib/libg2c.so: warning: tempnam() possibly used unsafely; consider using mkstemp()".  I'm pretty sure that it is not a problem with my Fortran program (I started with one that is ridiculously simple and tried others) or OS or library modifications (see "how to repeat the problem").

p.s. sorry if this is not the right forum for this problem (I'm a newbie)-- please point me in the right direction if it is the wrong forum.

Fix: 

I wish I knew!
How-To-Repeat: Start with a fresh PC, nothing on the hard drive (i.e. no partitions).  Install FreeBSD from the CD ROM using the X User distribution.  Reboot from the hardrive, login, create the simplest FORTRAN program you can think of with the .f extension (I tried other extensions, and they producted the same problem), use f77 to compile/execute the program, and before you get any output from the program, the above error message appears.  In short, the most vanilla version of FreeBSD will not let you use the Fortran compiler! (it is the single reason I purchased FreeBSD, for a Fortran compiler and UNIX based OS)

For example, I created nick.f with the following contents:
       PROGRAM NICK
       PRINT *, 'HELLO'
       END
Then, from the command line I typed "f77 nick.f".  Bingo, error message, and no "HELLO" on my screen.
Comment 1 tmoestl 2001-01-28 20:22:40 UTC
> Compiling/executing a FORTRAN program fails, with the following 
> message displayed: "/usr/lib/libg2c.so: warning: tempnam() possibly 
> used unsafely; consider using mkstemp()".  I'm pretty sure that it is 
> not a problem with my Fortran program (I started with one that is 
> ridiculously simple and tried others) or OS or library modifications 
> (see "how to repeat the problem").
As the message says, this is a warning, not an error.

> For example, I created nick.f with the following contents:
>            PROGRAM NICK
>            PRINT *, 'HELLO'
>            END
>     Then, from the command line I typed "f77 nick.f".  Bingo, error 
> message, and no "HELLO" on my screen.
f77 compiles your program, but will not execute it. You should find
the executable a.out in your working directory that was compiled
from your program source code. "./a.out" in a shell should print
the HELLO ;-)
"man f77" should give further details.

	- thomas
Comment 2 ashp freebsd_committer freebsd_triage 2002-01-16 22:53:25 UTC
State Changed
From-To: open->closed

As per the followup by Thomas Moestl, you have to type ./a.out to run 
the program.  The reported error was also simply a warning.  No problem 
here.