Some additional information, and another mystery:
While compiling tmux-2.6/cfg.c I get these warnings:
cfg.c:126:16: warning: implicit declaration of function 'fparseln' is invalid in
C99 [-Wimplicit-function-declaration]
while ((buf = fparseln(f, NULL, &line, delim, 0)) != NULL) {
^
cfg.c:126:14: warning: incompatible integer to pointer conversion assigning to
'char *' from 'int' [-Wint-conversion]
while ((buf = fparseln(f, NULL, &line, delim, 0)) != NULL) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Regarding the implicit declaration warning, I noticed that the macOS man page
for fparseln() indicates that one needs to include util.h, which is absent from
cfg.c, so I added it. Odd thing is that the warning did not go away.
However, if I take out including util.h and add the function prototype from
util.h then that eliminates both warnings and tmux does not segfault when
starting a server.
char *fparseln(FILE *, size_t *, size_t *, const char[3], int);
-Jason
> On Oct 5, 2017, at 3:03 PM, Jason White <[email protected]> wrote:
>
> That does resolve the issue for me on 2.6. I'm not sure what, precisely,
> changed or when, but:
>
> On macOS 10.11.6/Xcode 7.3.1 I do not have this issue with 2.5.
> On macOS 10.12.6/Xcode 9 it doesn't work out of the box with at least 2.5 or
> 2.6.
>
> Both environments have fparseln as part of libc.
>
> FPARSELN(3) BSD Library Functions Manual FPARSELN(3)
>
> NAME
> fparseln -- return the next logical line from a stream
>
> LIBRARY
> Standard C Library (libc, -lc)
>
> SYNOPSIS
> #include <stdio.h>
> #include <util.h>
>
> char *
> fparseln(FILE *stream, size_t *len, size_t *lineno, const char delim[3],
> int flags);
>
> -Jason
>
>> On Oct 5, 2017, at 11:45 AM, Nicholas Marriott <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>
>>
>> This seems most likely to be a bug in fparseln on your platform, does it
>> work if you do this (you will need to run sh autogen.sh again before
>> configure):
>>
>> diff --git a/configure.ac b/configure.ac
>> index 83c104c3..15820a14 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -457,6 +457,7 @@ fi
>>
>> # Look for fparseln in libutil.
>> AC_SEARCH_LIBS(fparseln, util, found_fparseln=yes, found_fparseln=no)
>> +found_fparseln=no
>> if test "x$found_fparseln" = xyes; then
>> AC_DEFINE(HAVE_FPARSELN)
>> else
>>
>>
>>
>>
>> On Thu, Oct 05, 2017 at 10:48:54AM -0500, Jason White wrote:
>>> I've had this issue on Darwin for a while now, but only recently started
>>> digging in to it.
>>> My environment: macOS 10.12.6, Xcode 9, libevent-2.1.8, tmux-2.6 (same
>>> issue with 2.5).
>>> Issue: if I start tmux (as root or otherwise), I get a "lost server"
>>> message.
>>> If I start with "tmux -f /dev/null" it stars fine. When I "source
>>> ~/.tmux.conf", then "lost server".
>>> If I create a file with a single hash "#" character in it and use that for
>>> my config file it also crashes with "lost server", so server falls over
>>> reading any config file.
>>> Client/server debug logs:
>>> # cat tmux-server-36281.log
>>> 1507217486.996408 server started (36281): version 2.6, socket
>>> /private/tmp/tmux-0/default, protocol 8
>>> 1507217486.996427 on Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun
>>> 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64; libevent
>>> 2.1.8-stable (select)
>>> 1507217486.997625 add peer 0x7fee9781e200: 8 (0x7fee9781d800)
>>> 1507217486.997642 new client 0x7fee9781d800
>>> 1507217486.997683 loading /etc/tmux.conf
>>> 1507217486.997697 loading /Users/jdwhite/.tmux.conf
>>> # cat tmux-client-36279.log
>>> 1507217486.994835 client started (36279): version 2.6, socket
>>> /private/tmp/tmux-0/default, protocol 8
>>> 1507217486.994860 on Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun
>>> 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64; libevent
>>> 2.1.8-stable (select)
>>> 1507217486.994887 socket is /private/tmp/tmux-0/default
>>> 1507217486.994899 trying connect
>>> 1507217486.994915 connect failed: Connection refused
>>> 1507217486.995191 lock file is /private/tmp/tmux-0/default.lock
>>> 1507217486.995310 flock succeeded
>>> 1507217486.995314 got lock (6)
>>> 1507217486.995318 trying connect
>>> 1507217486.995323 connect failed: Connection refused
>>> 1507217486.995606 add peer 0x7fee98001800: 7 (0x0)
>>> 1507217486.996815 sending message 100 to peer 0x7fee98001800 (4 bytes)
>>> 1507217486.996827 sending message 101 to peer 0x7fee98001800 (12 bytes)
>>> 1507217486.996830 sending message 102 to peer 0x7fee98001800 (13 bytes)
>>> 1507217486.996833 sending message 108 to peer 0x7fee98001800 (18 bytes)
>>> 1507217486.996841 sending message 104 to peer 0x7fee98001800 (0 bytes)
>>> 1507217486.996843 sending message 107 to peer 0x7fee98001800 (4 bytes)
>>> 1507217486.996846 sending message 105 to peer 0x7fee98001800 (24 bytes)
>>> 1507217486.996849 sending message 105 to peer 0x7fee98001800 (16 bytes)
>>> 1507217486.996851 sending message 105 to peer 0x7fee98001800 (17 bytes)
>>> 1507217486.996854 sending message 105 to peer 0x7fee98001800 (16 bytes)
>>> 1507217486.996856 sending message 105 to peer 0x7fee98001800 (41 bytes)
>>> 1507217486.996859 sending message 105 to peer 0x7fee98001800 (38 bytes)
>>> 1507217486.996861 sending message 105 to peer 0x7fee98001800 (16 bytes)
>>> 1507217486.996864 sending message 105 to peer 0x7fee98001800 (19 bytes)
>>> 1507217486.996867 sending message 105 to peer 0x7fee98001800 (14 bytes)
>>> 1507217486.996869 sending message 105 to peer 0x7fee98001800 (10 bytes)
>>> 1507217486.996872 sending message 105 to peer 0x7fee98001800 (18 bytes)
>>> 1507217486.996874 sending message 105 to peer 0x7fee98001800 (13 bytes)
>>> 1507217486.996877 sending message 105 to peer 0x7fee98001800 (66 bytes)
>>> 1507217486.996879 sending message 105 to peer 0x7fee98001800 (38 bytes)
>>> 1507217486.996882 sending message 105 to peer 0x7fee98001800 (14 bytes)
>>> 1507217486.996885 sending message 105 to peer 0x7fee98001800 (11 bytes)
>>> 1507217486.996887 sending message 105 to peer 0x7fee98001800 (13 bytes)
>>> 1507217486.996890 sending message 105 to peer 0x7fee98001800 (8 bytes)
>>> 1507217486.996892 sending message 105 to peer 0x7fee98001800 (20 bytes)
>>> 1507217486.996895 sending message 105 to peer 0x7fee98001800 (259 bytes)
>>> 1507217486.996898 sending message 105 to peer 0x7fee98001800 (13 bytes)
>>> 1507217486.996900 sending message 105 to peer 0x7fee98001800 (22 bytes)
>>> 1507217486.996903 sending message 105 to peer 0x7fee98001800 (12 bytes)
>>> 1507217486.996905 sending message 105 to peer 0x7fee98001800 (17 bytes)
>>> 1507217486.996908 sending message 105 to peer 0x7fee98001800 (30 bytes)
>>> 1507217486.996911 sending message 105 to peer 0x7fee98001800 (193 bytes)
>>> 1507217486.996913 sending message 105 to peer 0x7fee98001800 (23 bytes)
>>> 1507217486.996916 sending message 105 to peer 0x7fee98001800 (8 bytes)
>>> 1507217486.996918 sending message 105 to peer 0x7fee98001800 (23 bytes)
>>> 1507217486.996921 sending message 105 to peer 0x7fee98001800 (15 bytes)
>>> 1507217486.996923 sending message 105 to peer 0x7fee98001800 (20 bytes)
>>> 1507217486.996926 sending message 105 to peer 0x7fee98001800 (26 bytes)
>>> 1507217486.996929 sending message 105 to peer 0x7fee98001800 (41 bytes)
>>> 1507217486.996931 sending message 105 to peer 0x7fee98001800 (122 bytes)
>>> 1507217486.996934 sending message 105 to peer 0x7fee98001800 (13 bytes)
>>> 1507217486.996936 sending message 105 to peer 0x7fee98001800 (12 bytes)
>>> 1507217486.996939 sending message 105 to peer 0x7fee98001800 (30 bytes)
>>> 1507217486.996941 sending message 105 to peer 0x7fee98001800 (13 bytes)
>>> 1507217486.996944 sending message 105 to peer 0x7fee98001800 (12 bytes)
>>> 1507217486.996946 sending message 105 to peer 0x7fee98001800 (20 bytes)
>>> 1507217486.996949 sending message 105 to peer 0x7fee98001800 (9 bytes)
>>> 1507217486.996952 sending message 105 to peer 0x7fee98001800 (17 bytes)
>>> 1507217486.996961 sending message 105 to peer 0x7fee98001800 (15 bytes)
>>> 1507217486.996964 sending message 106 to peer 0x7fee98001800 (0 bytes)
>>> 1507217486.996968 sending message 200 to peer 0x7fee98001800 (4 bytes)
>>> 1507217486.996971 client loop enter
>>> 1507217489.162538 client loop exit
>>> Debugger backtrace:
>>> # lldb -c /cores/core.36281 ./tmux
>>> (lldb) target create "./tmux" --core "/cores/core.36281"
>>> warning: (x86_64) /cores/core.36281 load command 346 LC_SEGMENT_64 has a
>>> fileoff + filesize (0x2cf6a000) that extends beyond the end of the file
>>> (0x2cf69000), the segment will be truncated to match
>>> warning: (x86_64) /cores/core.36281 load command 347 LC_SEGMENT_64 has a
>>> fileoff (0x2cf6a000) that extends beyond the end of the file (0x2cf69000),
>>> ignoring this section
>>> Core file '/cores/core.36281' (x86_64) was loaded.
>>> (lldb) bt
>>> * thread #1, stop reason = signal SIGSTOP
>>> * frame #0: 0x00007fffcc638b52 libsystem_c.dylib`strlen + 18
>>> frame #1: 0x00007fffcc67e9fc libsystem_c.dylib`__vfprintf + 5701
>>> frame #2: 0x00007fffcc6a7423 libsystem_c.dylib`__v2printf + 699
>>> frame #3: 0x00007fffcc67cf46 libsystem_c.dylib`_vasprintf + 554
>>> frame #4: 0x0000000100bac587 tmux`log_vwrite + 39
>>> frame #5: 0x0000000100bac540 tmux`log_debug + 144
>>> frame #6: 0x0000000100b89097 tmux`load_cfg + 439
>>> frame #7: 0x0000000100b88e94 tmux`start_cfg + 164
>>> frame #8: 0x0000000100bbce62 tmux`server_start + 450
>>> frame #9: 0x0000000100b89998 tmux`client_main + 1080
>>> frame #10: 0x0000000100bc52d2 tmux`main + 1874
>>> frame #11: 0x00007fffcc602235 libdyld.dylib`start + 1
>>> frame #12: 0x00007fffcc602235 libdyld.dylib`start + 1
>>> --
>>> Jason White
>>> [email protected] <mailto:[email protected]>
>>> "The single biggest problem in communication is the illusion that it has
>>> taken place." - George Bernard Shaw
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "tmux-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected]
>>> <mailto:[email protected]>.
>>> To post to this group, send email to [email protected]
>>> <mailto:[email protected]>.
>>> For more options, visit https://groups.google.com/d/optout
>>> <https://groups.google.com/d/optout>.
>
> --
> Jason White
> [email protected] <mailto:[email protected]>
> "The single biggest problem in communication is the illusion that it has
> taken place." - George Bernard Shaw
>
>
>
--
Jason White
[email protected]
"The single biggest problem in communication is the illusion that it has taken
place." - George Bernard Shaw
--
You received this message because you are subscribed to the Google Groups
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.