Subject: bug#12621: Win32 (Ver:24.2); Crashes when files from shared folders are accessed

From: Arvind Devarajan <[email-masked]>
Date: Tue, 23 Oct 2012 17:46:54 +0530

Here’s the call stack (and also see below the callstack for the result of C-h v w32-get-true-file-attributes):

#0  0x77e82fed in RPCRT4!I_RpcNegotiateTransferSyntax ()
   from C:\WINNT\system32\rpcrt4.dll
#1  0x77e7a741 in RPCRT4!NdrAllocate () from C:\WINNT\system32\rpcrt4.dll
#2  0x77e7f64c in RPCRT4!NdrConformantStructBufferSize ()
   from C:\WINNT\system32\rpcrt4.dll
#3  0x77e7ae23 in RPCRT4!NdrpMemoryIncrement ()
   from C:\WINNT\system32\rpcrt4.dll
#4  0x77e89a57 in RpcBindingSetAuthInfoExW ()
   from C:\WINNT\system32\rpcrt4.dll
#5  0x77e899d2 in RpcBindingSetAuthInfoExW ()
   from C:\WINNT\system32\rpcrt4.dll
#6  0x77e89c5c in RpcBindingSetAuthInfoExW ()
   from C:\WINNT\system32\rpcrt4.dll
#7  0x77e7cc59 in RPCRT4!NdrConformantArrayBufferSize ()
   from C:\WINNT\system32\rpcrt4.dll
#8  0x77e7ae23 in RPCRT4!NdrpMemoryIncrement ()
   from C:\WINNT\system32\rpcrt4.dll
#9  0x77e86d08 in RPCRT4!NdrComplexStructFree ()
   from C:\WINNT\system32\rpcrt4.dll
#10 0x77e718cc in SimpleTypeMemorySize () from C:\WINNT\system32\rpcrt4.dll
#11 0x00819518 in ?? ()
#12 0x77ef55cc in RPCRT4!CStdStubBuffer_CountRefs ()
   from C:\WINNT\system32\rpcrt4.dll
#13 0x77de5ab8 in LsaICLookupSids () from C:\WINNT\system32\advapi32.dll
#14 0x77ddf4b0 in GetSidLengthRequired () from C:\WINNT\system32\advapi32.dll
#15 0x77de5a67 in LsaICLookupSids () from C:\WINNT\system32\advapi32.dll
#16 0x0086d7a8 in ?? ()
#17 0x77de58f6 in LsaLookupSids () from C:\WINNT\system32\advapi32.dll
#18 0x77de57a7 in LookupAccountSidW () from C:\WINNT\system32\advapi32.dll
#19 0x77e0d99b in LookupAccountSidA () from C:\WINNT\system32\advapi32.dll
#20 0x01029dfb in lookup_account_sid@28 ()
#21 0x0102a10d in get_name_and_id ()
#22 0x0102a284 in get_file_owner_and_group ()
#23 0x0102c2a7 in stat ()
#24 0x0103bdf7 in Finsert_file_contents ()
#25 0x0100ee96 in Ffuncall ()
#26 0x0107139d in exec_byte_code ()
#27 0x01071f9a in Fbyte_code ()
#28 0x0100e48d in eval_sub ()
#29 0x0101111b in internal_lisp_condition_case ()
#30 0x01070ae5 in exec_byte_code ()
#31 0x0100e9ec in funcall_lambda ()
#32 0x0100ed43 in Ffuncall ()
#33 0x0107139d in exec_byte_code ()
#34 0x0100e9ec in funcall_lambda ()
#35 0x0100ed43 in Ffuncall ()
#36 0x0107139d in exec_byte_code ()
#37 0x0100e9ec in funcall_lambda ()
#38 0x0100ed43 in Ffuncall ()
#39 0x0107139d in exec_byte_code ()
#40 0x0100e9ec in funcall_lambda ()
#41 0x0100ed43 in Ffuncall ()
#42 0x0107139d in exec_byte_code ()
#43 0x0100e9ec in funcall_lambda ()
#44 0x0100ed43 in Ffuncall ()
#45 0x0107139d in exec_byte_code ()
#46 0x01071f9a in Fbyte_code ()
#47 0x0100e48d in eval_sub ()
#48 0x0100d4fb in internal_catch ()
#49 0x01070b2b in exec_byte_code ()
#50 0x0100e9ec in funcall_lambda ()
#51 0x0100ed43 in Ffuncall ()
#52 0x0107139d in exec_byte_code ()
#53 0x0100e9ec in funcall_lambda ()
#54 0x0100ed43 in Ffuncall ()
#55 0x0100f1fe in call1 ()
#56 0x0104c4cd in mapcar1 ()
#57 0x0104f6db in Fmapc ()
#58 0x0100eef0 in Ffuncall ()
#59 0x0107139d in exec_byte_code ()
#60 0x0100e9ec in funcall_lambda ()
#61 0x0100ed43 in Ffuncall ()
#62 0x010728ec in Fcall_interactively ()
#63 0x0100eed9 in Ffuncall ()
#64 0x0100f1a0 in call3 ()
#65 0x010259e5 in command_loop_1 ()
#66 0x0100d5b1 in internal_condition_case ()
#67 0x0101cf14 in command_loop_2 ()
#68 0x0100d4fb in internal_catch ()
#69 0x0101dc8c in recursive_edit_1 ()
#70 0x0101df14 in Frecursive_edit ()
#71 0x011a1c47 in main ()
A debugging session is active.

        Inferior 1 [process 5440] will be killed.

Quit anyway? (y or n)

---
Result of C-h v w32-get-true-file-attributes
---
w32-get-true-file-attributes is a variable defined in `C source code'.
Its value is nil

Documentation:
Non-nil means determine accurate file attributes in `file-attributes'.
This option controls whether to issue additional system calls to determine
accurate link counts, file type, and ownership information.  It is more
useful for files on NTFS volumes, where hard links and file security are
supported, than on volumes of the FAT family.

Without these system calls, link count will always be reported as 1 and file
ownership will be attributed to the current user.
The default value `local' means only issue these system calls for files
on local fixed drives.  A value of nil means never issue them.
Any other non-nil value means do this even on remote and removable drives
where the performance impact may be noticeable even on modern hardware.
________________________________
From: Eli Zaretskii
Sent: 22-10-2012 22:44
To: Arvind Devarajan
Cc: [email-masked]
Subject: Re: bug#12621: Win32 (Ver:24.2); Crashes when files from shared folders are accessed

> From: Arvind Devarajan <[email-masked]>
> Date: Mon, 22 Oct 2012 15:49:36 +0530
> CC: "[email-masked]" <[email-masked]>
>
> Sorry for the late reply...

No problem.

> Secondly, I see that emacs crashes even with w32-get-true-file-attributes is set to nil.

That's strange.  Can you show a GDB backtrace in this case, please?
When w32-get-true-file-attributes is nil, Emacs is not supposed to
call the LookupAccountSid API, which was the one that led to the crash
in your previous backtrace.