unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Crash at startup in Cygwin w32 build on emacs-25 branch
@ 2015-11-27  0:13 Andy Moreton
  2015-11-27  8:03 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Moreton @ 2015-11-27  0:13 UTC (permalink / raw)
  To: emacs-devel; +Cc: Eli Zaretskii


The changes in commit d696d62fea48 cause an instant crash at startup for
the cygwin w32 build, as the main Windows thread ID is not initialized.
The following patch fixes it.

diff --git a/src/emacs.c b/src/emacs.c
index c411da6a5da8..48ff20a11ce4 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -760,11 +760,11 @@ main (int argc, char **argv)
      to have non-stub implementations of APIs we need to convert file
      names between UTF-8 and the system's ANSI codepage.  */
   maybe_load_unicows_dll ();
+#endif
   /* This has to be done before module_init is called below, so that
      the latter could use the thread ID of the main thread.  */
   w32_init_main_thread ();
 #endif
-#endif

 #ifdef RUN_TIME_REMAP
   if (initialized)




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Crash at startup in Cygwin w32 build on emacs-25 branch
  2015-11-27  0:13 Crash at startup in Cygwin w32 build on emacs-25 branch Andy Moreton
@ 2015-11-27  8:03 ` Eli Zaretskii
  2015-11-27 23:44   ` Andy Moreton
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2015-11-27  8:03 UTC (permalink / raw)
  To: Andy Moreton; +Cc: emacs-devel

> From: Andy Moreton <andrewjmoreton@gmail.com>
> Date: Fri, 27 Nov 2015 00:13:16 +0000
> Cc: Eli Zaretskii <eliz@gnu.org>
> 
> The changes in commit d696d62fea48 cause an instant crash at startup for
> the cygwin w32 build, as the main Windows thread ID is not initialized.

Thanks, fixed.  (I couldn't imagine Cygwin needs the thread
information.)

Btw, it's high time you got write access to the repository.  Would you
like that?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Crash at startup in Cygwin w32 build on emacs-25 branch
  2015-11-27  8:03 ` Eli Zaretskii
@ 2015-11-27 23:44   ` Andy Moreton
  2015-11-28  8:18     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Moreton @ 2015-11-27 23:44 UTC (permalink / raw)
  To: emacs-devel

On Fri 27 Nov 2015, Eli Zaretskii wrote:

>> From: Andy Moreton <andrewjmoreton@gmail.com>
>> Date: Fri, 27 Nov 2015 00:13:16 +0000
>> Cc: Eli Zaretskii <eliz@gnu.org>
>> 
>> The changes in commit d696d62fea48 cause an instant crash at startup for
>> the cygwin w32 build, as the main Windows thread ID is not initialized.
>
> Thanks, fixed.  (I couldn't imagine Cygwin needs the thread
> information.)

Only the Cygwin w32 build, which sets HAVE_NTGUI and uses the Windows
GUI code for display (so no need for an X11 server).

The module code also uses dwMainThreadId for error checking, and may
need similar changes for the Cygwin w32 build. It may be safer to
provide the thread ID from a function to ensure that it has been
initialised before callers try to use it.

> Btw, it's high time you got write access to the repository.  Would you
> like that?

That would prbably make sense. What needs to be done to arrange that ?

    AndyM




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Crash at startup in Cygwin w32 build on emacs-25 branch
  2015-11-27 23:44   ` Andy Moreton
@ 2015-11-28  8:18     ` Eli Zaretskii
  2015-11-28 21:18       ` Andy Moreton
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2015-11-28  8:18 UTC (permalink / raw)
  To: Andy Moreton; +Cc: emacs-devel

> From: Andy Moreton <andrewjmoreton@gmail.com>
> Date: Fri, 27 Nov 2015 23:44:55 +0000
> 
> > I couldn't imagine Cygwin needs the thread information.
> 
> Only the Cygwin w32 build, which sets HAVE_NTGUI and uses the Windows
> GUI code for display (so no need for an X11 server).

Yes, I know.  But the way the Cygwin w32 build gets input is very
different from the native build.  Threads other than the main one are
used in the native build to receive messages from MS-Windows, in order
to emulate the read-socket hook and some other Posix features (like
interval timers).  AFAIU, Cygwin reads from /dev/windows pseudo-device
using the "normal" Posix reads from a file descriptor.  That's why I
didn't think about Cygwin in this case: I don't think it launches any
non-main threads.

> The module code also uses dwMainThreadId for error checking, and may
> need similar changes for the Cygwin w32 build.

The use of dwMainThreadId in emacs-module.c is guarded by WINDOWSNT,
so is not compiled into the Cygwin w32 build.  I believe the latter
uses pthreads for that.

> It may be safer to provide the thread ID from a function to ensure
> that it has been initialised before callers try to use it.

Not sure what you mean here.  Do you mean use an accessor instead of a
global variable?  If so, I don't understand the rationale.

> > Btw, it's high time you got write access to the repository.  Would you
> > like that?
> 
> That would prbably make sense. What needs to be done to arrange that ?

Get a Savannah account (http://savannah.gnu.org/account/register.php,
I believe), then apply for membership in the Emacs project.

Thanks.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Crash at startup in Cygwin w32 build on emacs-25 branch
  2015-11-28  8:18     ` Eli Zaretskii
@ 2015-11-28 21:18       ` Andy Moreton
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Moreton @ 2015-11-28 21:18 UTC (permalink / raw)
  To: emacs-devel

On Sat 28 Nov 2015, Eli Zaretskii wrote:

>> From: Andy Moreton <andrewjmoreton@gmail.com>
>> It may be safer to provide the thread ID from a function to ensure
>> that it has been initialised before callers try to use it.
>
> Not sure what you mean here.  Do you mean use an accessor instead of a
> global variable?  If so, I don't understand the rationale.

I meant an accessor, to ensure that users of dwMainThreadId don't use it
uninitialised, which is not necessarily easy to spot for all of the
combiations of build options. Probably not worth the bother though.

>> > Btw, it's high time you got write access to the repository.  Would you
>> > like that?
>> 
>> That would prbably make sense. What needs to be done to arrange that ?
>
> Get a Savannah account (http://savannah.gnu.org/account/register.php,
> I believe), then apply for membership in the Emacs project.

ok, will do.

    AndyM




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-28 21:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-27  0:13 Crash at startup in Cygwin w32 build on emacs-25 branch Andy Moreton
2015-11-27  8:03 ` Eli Zaretskii
2015-11-27 23:44   ` Andy Moreton
2015-11-28  8:18     ` Eli Zaretskii
2015-11-28 21:18       ` Andy Moreton

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).