From: Qian Hong <fracting@gmail.com>
To: cygwin <cygwin@cygwin.com>, John Hood <cgull@glup.org>
Subject: Re: mktemp() fails on Wine 1.9.3 + Cygwin 2.5.0-0.2
Date: Tue, 16 Feb 2016 09:36:00 -0000 [thread overview]
Message-ID: <CALd+sZT614-VPBh4cOaBraDtGMEdu3jiDQB184bkeFJyA2vQ5Q@mail.gmail.com> (raw)
In-Reply-To: <56BF9370.80303@glup.org>
Hi John,
This looks like a bug in wineserver.
Cygwin strace log show an access error soon after fhandler_base::open()
[main] mktemp 111 fhandler_base::open:
(\??\C:\cygwin\tmp\tmp.kAEScb0yvo, 0x108A02)
[main] mktemp 111 __set_errno: int aclsort32(int, int,
aclent_t*):1403 setting errno 22
[main] mktemp 111 __set_errno: void* set_posix_access(mode_t, uid_t,
gid_t, aclent_t*, int, security_descriptor&, bool):269 setting errno
13
fhandler_base::open() is forwarded to NtCreateFile, but Wine
+relay,+server log show that NtCreateFile seems fine (please ignore
the difference of random file name):
0009:Call ntdll.NtCreateFile(0060c7d4,c0100000,0060c7e8,0060c7e0,00000000,00000080,00000007,00000002,00004020,00000000,00000000)
ret=6103a45d
0009:trace:ntdll:FILE_CreateFile handle=0x60c7d4 access=c0100000
name=L"\\??\\C:\\cygwin\\tmp\\tmp.BM21HIw0vU" objattr=00000042
root=(nil) sec=(nil) io=0x60c7e0 alloc_size=(nil) attr=00000080
sharing=00000007 disp=2 options=00004020 ea=(nil).0x00000000
0009:trace:file:wine_nt_to_unix_file_name
L"\\??\\C:\\cygwin\\tmp\\tmp.BM21HIw0vU" ->
"/media/workspace/wine-cygwin-1028/dosdevices/c:/cygwin/tmp/tmp.BM21HIw0vU"
0009: create_file( access=c0100000, sharing=00000007, create=2,
options=00004020, attrs=00000080,
objattr={rootdir=0000,attributes=00000042,sd={},name=L""},
filename="/media/workspace/wine-cygwin-1028/dosdevices/c:/cygwin/tmp/tmp.BM21HIw0vU"
)
0009: create_file() = 0 { handle=00f4 }
0009:Ret ntdll.NtCreateFile() retval=00000000 ret=6103a45d
(looks identity to the good version of log, so I won't paste the good
version here)
In this case, comparing +relay,+server log between good case and bad
case doesn't expose enough information, so we might need to compare
Linux strace log from good case and bad case:
[pid 11724] write(2, 0xb7584000, 2440009: create_file(
access=c0100000, sharing=00000007, create=2, options=00004020,
attrs=00000080,
objattr={rootdir=0000,attributes=00000042,sd={},name=L""},
filename="/media/workspace/wine-cygwin-1028/dosdevices/c:/cygwin/tmp/tmp.2kmv323jLu"
)
<unfinished ...>
[pid 11732] close(9 <unfinished ...>
[pid 11724] <... write resumed> ) = 244
[pid 11732] <... close resumed> ) = 0
[pid 11724] open(0xa3a0e90, O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 107
[pid 11724] fstat64(107, {...}) = 0
[pid 11724] fgetxattr(107, 0x80a30e8, 0xbfe5dcec, 65536) = 314
[pid 11724] close(107) = 0
[pid 11724] open(0xa3a0e40,
O_RDWR|O_CREAT|O_EXCL|O_NONBLOCK|O_LARGEFILE, 0555 <unfinished ...>
By comparing to the good case, i found the above open syscall should
open the file as 0666 mode.
Related code below:
https://github.com/wine-compholio/wine-patched/blob/master/server/file.c#L408
226 if (sd)
227 {
228 const SID *owner = sd_get_owner( sd );
229 if (!owner)
230 owner = token_get_user( current->process->token );
231 mode = sd_to_mode( sd, owner );
232 }
233 else if (options & FILE_DIRECTORY_FILE)
234 mode = (attrs & FILE_ATTRIBUTE_READONLY) ? 0555 : 0777;
235 else
236 mode = (attrs & FILE_ATTRIBUTE_READONLY) ? 0444 : 0666;
I need to do more research in order to write test and figure out the
right way to fix this bug, my current guess is Wine's sd/token
emulation is not completed yet, which cause unexpected behavior.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2016-02-16 9:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-13 20:35 John Hood
2016-02-13 20:46 ` John Hood
2016-02-13 21:11 ` Qian Hong
2016-02-13 21:39 ` Qian Hong
2016-02-14 16:35 ` Andrey Repin
2016-02-15 11:46 ` Corinna Vinschen
2016-02-16 9:36 ` Qian Hong [this message]
2016-02-19 2:48 ` Qian Hong
2016-02-19 9:39 ` Qian Hong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALd+sZT614-VPBh4cOaBraDtGMEdu3jiDQB184bkeFJyA2vQ5Q@mail.gmail.com \
--to=fracting@gmail.com \
--cc=cgull@glup.org \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).