http://bugs.winehq.org/show_bug.cgi?id=17875
Summary: GetTempFileName with unique != 0 broken Product: Wine Version: 1.1.18 Platform: PC-x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: major Priority: P1 Component: kernel32 AssignedTo: wine-bugs@winehq.org ReportedBy: dev_oskar@hotmail.com
GetTempFileName called with a non-zero value for unique will not check if a file could be actually written in the provided path.
Paint Shop Pro 9 (and it seems 8 too) uses the return code to test if it should create several temp directories. So under wine it will always fail if unique is non-zero, GetTempFileName will currently not test anything and won't return zero, so creation of the undo files later will fail because the directory doesn't exists.
As the documentation tells the file isn't created my first patch isn't correct:
... if (unique) { sprintfW( p, formatW, unique ); /* need to check if we can create the file so applications can detect if they can write */ HANDLE handle; handle = CreateFileW( buffer, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0 ); if (handle != INVALID_HANDLE_VALUE) { /* We created it */ CloseHandle( handle ); TRACE("created %s\n", debugstr_w(buffer) ); return unique; } /* Failure */ return 0; } else { /* get a "random" unique number and try to create the file */ ...
It should check the directory if it exists.
http://bugs.winehq.org/show_bug.cgi?id=17875
--- Comment #1 from Oskar Eisemuth dev_oskar@hotmail.com 2009-03-29 11:28:44 --- (In reply to comment #0) After further tests it should always check if the directory is valid regardless of unique.
http://bugs.winehq.org/show_bug.cgi?id=17875
--- Comment #2 from Oskar Eisemuth dev_oskar@hotmail.com 2009-04-09 03:12:33 --- Created an attachment (id=20345) --> (http://bugs.winehq.org/attachment.cgi?id=20345) Patch for GetTempFileName to return 0 if the path doesn't exists.
Includes GetTempFileName patch and a test-case
http://bugs.winehq.org/show_bug.cgi?id=17875
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
http://bugs.winehq.org/show_bug.cgi?id=17875
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |testcase
--- Comment #3 from Austin English austinenglish@gmail.com 2009-04-09 17:48:08 --- Please send patches to wine-patches@winehq.org
http://bugs.winehq.org/show_bug.cgi?id=17875
Oskar Eisemuth dev_oskar@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |WONTFIX
--- Comment #4 from Oskar Eisemuth dev_oskar@hotmail.com 2009-04-11 12:25:07 --- The patch (including tests as requested) was send last month:
http://www.winehq.org/pipermail/wine-patches/2009-March/071328.html
A notice for the new version of the patch was send on devel too, so I consider the current status as "WONTFIX" and attached the patch here only for reference.
http://bugs.winehq.org/show_bug.cgi?id=17875
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|WONTFIX |
--- Comment #5 from Vitaliy Margolen vitaliy@kievinfo.com 2009-04-11 12:41:45 --- It's still a valid bug.
http://bugs.winehq.org/show_bug.cgi?id=17875
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
--- Comment #6 from Austin English austinenglish@gmail.com 2009-10-12 14:48:00 --- Still present.
http://bugs.winehq.org/show_bug.cgi?id=17875
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nerv@dawncrow.de
--- Comment #7 from André H. nerv@dawncrow.de 2010-06-01 12:56:11 --- try again with that patch?
http://bugs.winehq.org/show_bug.cgi?id=17875
jussi.kivilinna@mbnet.fi changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jussi.kivilinna@mbnet.fi
--- Comment #8 from jussi.kivilinna@mbnet.fi 2010-07-19 15:45:50 --- Still same problem with 1.2 stable.
http://bugs.winehq.org/show_bug.cgi?id=17875
Louis Lenders xerox_xerox2000@yahoo.co.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |xerox_xerox2000@yahoo.co.uk Ever Confirmed|0 |1 Severity|major |normal
--- Comment #9 from Louis Lenders xerox_xerox2000@yahoo.co.uk 2010-10-16 18:02:26 CDT --- The tests starting from line : /* And when the path is actually a file */ don't make really sense There is no way AFAICT how GetTempFileName can decide whether tmpfile is a file or a directory.
I created some new tests, i'll see if i can get them into the tree. Once the tests are accepted, the fix is rather trivial i guess
http://bugs.winehq.org/show_bug.cgi?id=17875
--- Comment #10 from Louis Lenders xerox_xerox2000@yahoo.co.uk 2010-10-16 18:05:06 CDT --- Created an attachment (id=31319) --> (http://bugs.winehq.org/attachment.cgi?id=31319) tests
additional tests for GetTempFileName
http://bugs.winehq.org/show_bug.cgi?id=17875
--- Comment #11 from Austin English austinenglish@gmail.com 2010-10-22 13:37:02 CDT --- Probably fixed by http://source.winehq.org/git/wine.git/?a=commitdiff;h=8819ae1e66fb0d41815945...
http://bugs.winehq.org/show_bug.cgi?id=17875
Louis Lenders xerox_xerox2000@yahoo.co.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #12 from Louis Lenders xerox_xerox2000@yahoo.co.uk 2010-10-22 15:14:08 CDT --- (In reply to comment #11)
Probably fixed by http://source.winehq.org/git/wine.git/?a=commitdiff;h=8819ae1e66fb0d41815945...
yes ,don't have Photoshop, but this should be fixed according to Oskar's description + tests.
http://bugs.winehq.org/show_bug.cgi?id=17875
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #13 from Alexandre Julliard julliard@winehq.org 2010-10-29 12:59:14 CDT --- Closing bugs fixed in 1.3.6.
http://bugs.winehq.org/show_bug.cgi?id=17875
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |1.2.x
http://bugs.winehq.org/show_bug.cgi?id=17875
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|1.2.x |---
--- Comment #14 from Alexandre Julliard julliard@winehq.org 2010-12-03 12:51:57 CST --- Removing 1.2.x milestone from bugs included in 1.2.2.