<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Allegro 4.2.1 and Vista issues with temp file creation</title>
		<link>http://www.allegro.cc/forums/view/588910</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 13 Dec 2006 08:02:32 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve been doing some Vista testing, and found that I think Vista&#39;s UAC is preventing the creation of a tempfile obtained via tempnam.  The platform SDK&#39;s c runtime library header stdio.h defines the temp file prefix as &#39;\\&#39;, which would place temp files at the root of the drive.  I think this is causing problems with Vista&#39;s UAC (user access control).</p><p>I suppose one can turn off UAC, but a better solution would be to just create a temp file in the current directory.</p><p>I noticed that the platform SDK&#39;s c runtime library does have mktemp (it doesn&#39;t have mkstemp, but we already know that).  This would suit our purposes just fine, though obviously it doesn&#39;t have the atomicity advantage of mkstemp (but neither does tmpnam, so we&#39;re no worse off).</p><p>Has anyone else run into this?</p><p>Would a patch be appreciated, so this gets fixed in the next version?  I&#39;ve already generated a patch...please reply if it&#39;s wanted.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (okashistudios)</author>
		<pubDate>Tue, 05 Dec 2006 16:37:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
a better solution would be to just create a temp file in the current directory.
</p></div></div><p>
Actually, no, it wouldn&#39;t be. It used to be like that, which caused crashes in Windows (the famous &quot;grabber crashes when saving a datafile in XP&quot; bug) and UNIX (though no one apparently spotted it there until we found the cause and tried it) if the user doesn&#39;t have write permission in the current directory.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I think
</p></div></div><p>
I dont mean to be pedantic, but could you make sure? Just to check, are you actually experiencing a problem, or is this something you found that could be a problem (in which case it would need to be confirmed)?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
The platform SDK&#39;s c runtime library header stdio.h defines the temp file prefix as &#39;\\&#39;, which would place temp files at the root of the drive.
</p></div></div><p>
Is it just me or does that sound like Vista is really badly broken?</p><p>Anyway, yes, we will accept patches that fix this properly if it really is a problem (but not a patch that places temporary files in the CWD). Please post it here, or on the AD mailing list.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Tue, 05 Dec 2006 16:50:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The platform SDK sounds more broken than the UAC stuff. Restricting access to areas of the disk is usually a good idea. Making the &quot;temp&quot; prefix &quot;\\&quot; (ala platform sdk) is astonishingly bad. At least make it use TEMP/TMP or something.</p><p>Off topic:<br />For my 4.3 (vfs-work-4.3 branch) code, I&#39;ve taken care of this little issue with a custom mktemp function, and a proper way to grab the platform&#39;s TEMP directory. Feel free to rip any of it for 4.2.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 05 Dec 2006 17:26:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This is actually a problem, and not speculation.</p><p>Yeah, the temp file in the app&#39;s current directory wouldn&#39;t be so good.  What I&#39;m doing is creating the temp file in the directory where you&#39;re trying to save your datafile.  Either you&#39;re going to have write permissions in that directory, or the operation wouldn&#39;t have worked anyway.  Sorry for the confusion.</p><p>A catchall solution to this would also be to have the various apps just take an optional temp directory as a parameter, to get around this problem.</p><p>And no, I don&#39;t think Vista&#39;s really badly broken because of this behavior.  I agree with Thomas.  The platform SDK shouldn&#39;t be defining the temp directory as &quot;\\&quot;.  As far as I&#39;m concerned, platform SDK&#39;s tmpnam implementation is broken on Vista because of this behavior.</p><p>It sounds like Thomas has a good fix, in either case (though we&#39;d want to get it tested on Vista anyway, just to make sure).  Can we just make sure that fix gets backported to the 4.2.x line?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (okashistudios)</author>
		<pubDate>Thu, 07 Dec 2006 11:06:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>We can add a allegro version of mkstemp, which I basically wrote for 4.3. I don&#39;t <u>think</u> that&#39;ll break binary compatability. Its really up to the main devs like Evert and Peter though.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 07 Dec 2006 11:16:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
What I&#39;m doing is creating the temp file in the directory where you&#39;re trying to save your datafile.
</p></div></div><p>
Better, though I don&#39;t like ignoring the location for temporary files like that. Seems like TF&#39;s solution would be good.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
As far as I&#39;m concerned, platform SDK&#39;s tmpnam implementation is broken on Vista because of this behavior.
</p></div></div><p>
That&#39;s more or less what I meant, sorry for being unclear.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Can we just make sure that fix gets backported to the 4.2.x line?
</p></div></div><p>
Any bugfix that doesn&#39;t break ABI compatibility can be included in the next 4.2 update.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Thu, 07 Dec 2006 12:46:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Neat.  When this does get backported, feel free to give me a shout if you want me to do some testing on Vista.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (okashistudios)</author>
		<pubDate>Fri, 08 Dec 2006 04:34:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Currently the latest version of allegro does get the proper &quot;temp&quot; directory in the pack_fopen_chunk functions (related to datafiles).</p><p>Where exactly is the error yore seeing?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 08 Dec 2006 20:26:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In the tools.  The particular example I ran into was in datedit.c.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (okashistudios)</author>
		<pubDate>Wed, 13 Dec 2006 08:02:32 +0000</pubDate>
	</item>
</rss>
