[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[h-e-w] Re: emacsclientw.exe bug: random exit status
From: |
Kai Tetzlaff |
Subject: |
[h-e-w] Re: emacsclientw.exe bug: random exit status |
Date: |
Thu, 15 Oct 2009 10:41:52 +0200 |
User-agent: |
Thunderbird 2.0.0.23 (Windows/20090812) |
Lennart Borgman wrote:
> Please look at EmacsW32 documentation at
>
> http://ourcomments.org/Emacs/EmacsW32Util.html
>
> There is documentation about how to build Emacs on w32.
Thanks, that definitely helped to get started. I had some problems
getting the graphics libraries working. xpm needs some additional work
since simx.h (included by xpm.h) is only available in the source package
of libxpm/gnuwin32 and it's not installed by default in gnuwin32.
Also i'm still getting errors when compiling etags (s. below). But
emacsclient compiles fine and i started testing a changed version (s. my
other post in this thread).
gmake -Rrk -C ../lib-src all
gmake[1]: Entering directory `C:/kt/Work/src/emacs/lib-src'
gcc -o oo-spd/i386/ctags.exe -gdwarf-2 -g3 oo-spd/i386/ctags.o
oo-spd/i386/getopt.o oo-spd/i386/getopt1.o oo-spd/i38
6/ntlib.o oo-spd/i386/regex.o -ladvapi32
oo-spd/i386/ctags.o: In function `readline':
C:\kt\Work\src\emacs\lib-src/ctags.c:6335: undefined reference to
`_imp__re_match'
oo-spd/i386/ctags.o: In function `add_regex':
C:\kt\Work\src\emacs\lib-src/ctags.c:5880: undefined reference to
`_imp__re_set_syntax'
C:\kt\Work\src\emacs\lib-src/ctags.c:5884: undefined reference to
`_imp__re_compile_pattern'
C:\kt\Work\src\emacs\lib-src/ctags.c:5882: undefined reference to
`_imp__re_set_syntax'
oo-spd/i386/ctags.o: In function `regex_tag_multiline':
C:\kt\Work\src\emacs\lib-src/ctags.c:6006: undefined reference to
`_imp__re_search'
collect2: ld returned 1 exit status
gmake[1]: *** [oo-spd/i386/ctags.exe] Error 1
gcc -o oo-spd/i386/etags.exe -gdwarf-2 -g3 oo-spd/i386/etags.o
oo-spd/i386/getopt.o oo-spd/i386/getopt1.o oo-spd/i38
6/ntlib.o oo-spd/i386/regex.o -ladvapi32
oo-spd/i386/etags.o: In function `readline':
C:\kt\Work\src\emacs\lib-src/etags.c:6335: undefined reference to
`_imp__re_match'
oo-spd/i386/etags.o: In function `add_regex':
C:\kt\Work\src\emacs\lib-src/etags.c:5880: undefined reference to
`_imp__re_set_syntax'
C:\kt\Work\src\emacs\lib-src/etags.c:5884: undefined reference to
`_imp__re_compile_pattern'
C:\kt\Work\src\emacs\lib-src/etags.c:5882: undefined reference to
`_imp__re_set_syntax'
oo-spd/i386/etags.o: In function `regex_tag_multiline':
C:\kt\Work\src\emacs\lib-src/etags.c:6006: undefined reference to
`_imp__re_search'
collect2: ld returned 1 exit status
gmake[1]: *** [oo-spd/i386/etags.exe] Error 1
>
>
> On Tue, Oct 13, 2009 at 1:52 AM, Kai Tetzlaff <address@hidden> wrote:
>> Hah, there's a lot of stuff in main which i did not yet have a closer
>> look at ;-) and i'm not really familiar with the code. But (as a quick
>> shot) how about checking emacs_socket in addition to connected:
>>
>> if (connected || emacs_socket != INVALID_SOCKET) {
>> exit(exitval);
>> else
>> exit(EXIT_FAILURE);
>>
>> Maybe even forgetting about connected at all...
>>
>> Not sure though if this would work for all cases (or at all). If you
>> want i can have a closer look. But then i would probably also like to
>> set up a dev env to compile emacs on windows. Any good tips how to
>> start? I already have msys/mingw running and have been using it to port
>> some other stuff to windows ...
>>
>> /Kai
>>
>>> Hm, you are right ... ;-)
>>>
>>> Did you find out how to fix it?
>>>
>>>
>>> On Tue, Oct 13, 2009 at 1:03 AM, Kai Tetzlaff <address@hidden> wrote:
>>>> Gary Oberbrunner wrote:
>>>>> emacsclientw exits with a random exit status when called from a win32
>>>>> window app (such as emacs itself). The reason is an uninitialized
>>>>> variable in w32_teardown_window in w32emacsclient.h. I suspect if "ret"
>>>>> is initialized to zero (exit status success) in this function it would
>>>>> just work. I don't have mingw so I can't compile it here myself, sorry.
>>>>>
>>>>> This is on emacs 23.1.50, also happens on the latest CVS test version.
>>>>> I'm using the EmacsW32 patched version on XP, but don't think that
>>>>> matters either.
>>>>>
>>>>> The symptom is easy to reproduce. In a shell window inside emacs (I use
>>>>> cygwin zsh, but any shell will work), run
>>>>> emacsclient foo || echo BAD
>>>>> then C-x # to close the server buffer, and then look back in the shell
>>>>> window:
>>>>> % emacsclientw foo || echo BAD
>>>>> Waiting for Emacs...
>>>>> BAD
>>>>> %
>>>>>
>>>>> (I'm sure you already know that "emacsclient", the non-windows version,
>>>>> is totally broken, gives "Unknown&_command:&"... but emacsclientw is fine
>>>>> so it doesn't really matter.)
>>>>>
>>>>> Here's the affected code:
>>>>> ===========
>>>>> int
>>>>> w32_teardown_window (int connected)
>>>>> {
>>>>> int ret; <<<<<<<<<<====== FIX HERE to int ret=0;
>>>>> if (w32_window_app ())
>>>>> {
>>>>> w32_check_not_synced();
>>>>> w32_wait_threads_fin(connected);
>>>>> ret = W32_SYNC_get_g_exit_value();
>>>>> DeleteCriticalSection(&g_cs.cs);
>>>>> return ret;
>>>>> }
>>>>> else
>>>>> ret = g_exit_value;
>>>>> return ret;
>>>>> }
>>>>> ============
>>>>>
>>>>>
>>>> I've also been running into this. Now, when looking at the code of what
>>>> i believe should be the patched version of emacsclient.c, the main
>>>> function looks like this:
>>>>
>>>> int
>>>> main (argc, argv)
>>>> int argc;
>>>> char **argv;
>>>> {
>>>> int i, rl, needlf = 0;
>>>> char *cwd, *str;
>>>> char string[BUFSIZ+1];
>>>> int connected = 0;
>>>>
>>>> ...
>>>>
>>>> if ((emacs_socket = set_socket ( alternate_editor ||
>>>> (start_timeout_int > 0) , &islocal)) == INVALID_SOCKET)
>>>> {
>>>> ...
>>>> connected = 1;
>>>> }
>>>>
>>>> ...
>>>>
>>>> int exitval = finish_messages (connected);
>>>>
>>>> if (connected)
>>>> exit(exitval);
>>>> else
>>>> exit(EXIT_FAILURE);
>>>> }
>>>>
>>>> I.e. if connected is not set to a non-zero value somewhere after it gets
>>>> initialized, main will always exit with EXIT_FAILURE.
>>>>
>>>> The only place in main which sets connected is the if block included
>>>> above. This block is only entered if set_socket returns INVALID_SOCKET
>>>> which seems to be the case only if the server has not been started yet.
>>>> So if you use emacsclient to send files to the server when it is already
>>>> running, it will always seem to be failing.
>>>>
>>>> BR,
>>>> Kai
>>>>
>>>>
>>>>
>>>>
>>>
>>
>
>
>
- [h-e-w] Re: emacsclientw.exe bug: random exit status, Kai Tetzlaff, 2009/10/12
- [h-e-w] Re: emacsclientw.exe bug: random exit status, Kai Tetzlaff, 2009/10/15
- [h-e-w] Re: emacsclientw.exe bug: random exit status, Kai Tetzlaff, 2009/10/16
- [h-e-w] Re: emacsclientw.exe bug: random exit status, Lennart Borgman, 2009/10/16
- [h-e-w] Re: emacsclientw.exe bug: random exit status, Kai Tetzlaff, 2009/10/23
- Re: [h-e-w] Re: emacsclientw.exe bug: random exit status, Juanma Barranquero, 2009/10/23
- Re: [h-e-w] Re: emacsclientw.exe bug: random exit status, Lennart Borgman, 2009/10/23
- Re: [h-e-w] Re: emacsclientw.exe bug: random exit status, Juanma Barranquero, 2009/10/23