Subject: RE: 1.3.2 Catch-22 in tmpnam/tmpfile with gcc -mno-cygwin
From: "Fleischer, Karsten (K.)" <[email-masked]>
To: [email-masked]
Cc: Cygwin Users <[email-masked]>
Date: Thu, 31 May 2001 09:43:29 -0400

Charles is right.
John, the behavior you're describing is exactly how it's documented in the MSDN.
However, you can set the TMP environment variable to your preferred location to override this behavior.
TMP is unset in /etc/profile so maybe you can comment out the corresponding line there. But doing so might eventually affect other programs.

Karsten

> -----Original Message-----
> From: Charles Wilson [mailto:[email-masked]]
> Sent: Donnerstag, 31. Mai 2001 14:32
> To: [email-masked]
> Cc: Cygwin Users
> Subject: Re: 1.3.2 Catch-22 in tmpnam/tmpfile with gcc -mno-cygwin
> 
> 
> But programs compiled with -mno-cygwin don't use cygwin1.dll 
> (which contains
> newlib, which contains the stdio functions).  -mno-cygwin 
> programs will use the
> msvcrt.dll runtime -- which has its own implementations of 
> the stdio functions. 
> Are you saying that msvcrt's version of tmpnam/tmpfile are 
> broken?  If so,
> that's not really our problem...
> 
> --Chuck
> 
> 
> "John W. Kennedy" wrote:
> > 
> > Earnie Boyd wrote:
> > >
> > > Christopher Faylor wrote:
> > > >
> > > > On Wed, May 30, 2001 at 11:25:41AM -0400, John W. Kennedy wrote:
> > > > >At present, gcc option -mno-cygwin is incompatible 
> with tmpfile and
> > > > >tmpnam.  When -mno-cygwin is used, at runtime all 
> temporary files are
> > > > >put into directory "/tmp", which is incompatible with no-cygwin
> > > > >operation unless a writable "x:\tmp" directory happens 
> to exist, where
> > > > >x: is the current drive.
> > > > >
> > > > >The obvious fix would make -mno-cygwin executables 
> sensitive to a
> > > > >standard Windows environment variable such as TMP, or 
> at least to an
> > > > >ad-hoc environment variable.
> > > >
> > > > -mno-cygwin produced Microsoft native binaries.  It 
> uses some libraries
> > > > from the mingw project, but they are not supported 
> here.  You probably want
> > > > to send email to a mailing list mentioned at www.mingw.org.
> > > >
> > >
> > > I'm not understanding this.  What is it that isn't working?  Give
> > > examples of your environment, command line and results.
> > 
> > Any C program using the tmpnam/tmpfile functions (in stdio), and
> > compiled with the -mno-cygwin flag, places the temporary file in
> > directory "/tmp".  Using this directory name works fine 
> with cygwin.dll,
> > because it is mapped to (for example) "C:\Cygwin\tmp", but in
> > -mno-cygwin mode, it is interpreted as "x:\tmp" where x: is 
> the current
> > drive.  This directory normally won't exist, and may not be 
> writable; in
> > either case, the program will fail.  With cygwin.dll, an environment
> > variable at run time can override the "/tmp", but there 
> appears to be no
> > way to do it with -mno-cygwin.
> > 
> > In essence, all C programs compiled with -mno-cygwin and 
> using tmpnam or
> > tmpfile can be expected to fail.
> > 
> > --
> > John W. Kennedy
> > (Working from my laptop)
> > 
> > --
> > Want to unsubscribe from this list?
> > Check out: http://cygwin.com/ml/#unsubscribe-simple
> 
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple
> 

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple