#111: jabberd-2.1.9 source distribution contain platform specifi characters and
C
prototype mismatches
--------------------+-------------------------------------------------------
Reporter: plmogan | Owner: smoku
Type: defect | Status: assigned
Priority: major | Component: c2s
Version: 2.1.13 | Resolution:
Keywords: | Blocking:
--------------------+-------------------------------------------------------
Changes (by plmogan):
* version: 2.1.8 => 2.1.13
Comment:
'''Introduction'''
I decided to take some time to try to figure out why recent jabberd-2.1.x
(x > 6) fail to build with SUN Studio 11 compiler in SUN Solaris 11/06 on
a UltraSPARC machine. BTW, I used {{{GNU make 3.81}}} instead of the SUN
Solaris bundled {{{/usr/ccs/bin/make}}}.
'''Observations'''
Below is what I found out so far, and the results of my preliminary
investigation:
2.1.13 builts better. Now it only fails in {{{c2s.c}}}.
if the {{{c2s.c}}} is replaced with its counterpart from 2.1.6 release,
then the entire distribution builds fine. I haven't had time to try to
actually run the resulted build. I only got time to do a quick
{{{/usr/local/bin/jabberd}}} and didn't observe any crashes.
'''Findings'''
Afterwards, I decided to make a context diff of the {{{c2s.c}}} from
2.1.13 and 2.1.6, as shown below:
{{{
*** 2.1.13-c2s.c Thu Aug 9 15:38:10 2007
--- 2.1.6-c2s.c Thu Aug 9 15:38:32 2007
***************
*** 78,86 ****
}
if(s->state >= state_STREAM && sess->jid != NULL)
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] [%s]
read error: %s (%d)", sess->fd->fd, jid_full(sess->jid),
MIO_STRERROR(MIO_ERROR), MIO_ERROR);
else
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] [%s,
port=%d] read error: %s (%d)", sess->fd->fd, sess->ip, sess->port,
MIO_STRERROR(MIO_ERROR), MIO_ERROR);
sx_kill(s);
--- 78,86 ----
}
if(s->state >= state_STREAM && sess->jid != NULL)
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] [%s]
read error: %s (%d)", sess->fd->fd, jid_full(sess->jid), strerror(errno),
errno);
else
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] [%s,
port=%d] read error: %s (%d)", sess->fd->fd, sess->ip, sess->port,
strerror(errno), errno);
sx_kill(s);
***************
*** 144,152 ****
return 0;
if(s->state >= state_OPEN && sess->jid != NULL)
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] [%s] write
error: %s (%d)", sess->fd->fd, jid_full(sess->jid),
MIO_STRERROR(MIO_ERROR), MIO_ERROR);
else
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] [%s.
port=%d] write error: %s (%d)", sess->fd->fd, sess->ip, sess->port,
MIO_STRERROR(MIO_ERROR), MIO_ERROR);
sx_kill(s);
--- 144,152 ----
return 0;
if(s->state >= state_OPEN && sess->jid != NULL)
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] [%s] write
error: %s (%d)", sess->fd->fd, jid_full(sess->jid), strerror(errno),
errno);
else
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] [%s.
port=%d] write error: %s (%d)", sess->fd->fd, sess->ip, sess->port,
strerror(errno), errno);
sx_kill(s);
***************
*** 198,206 ****
break;
case event_PACKET:
- /* we're counting packets */
- sess->packet_count++;
-
nad = (nad_t) data;
/* we only want (message|presence|iq) in jabber:client,
everything else gets dropped */
--- 198,203 ----
***************
*** 327,337 ****
#ifdef HAVE_SSL
/* drop packets if they have to starttls and they haven't */
if((sess->s->flags & SX_SSL_STARTTLS_REQUIRE) &&
sess->s->ssf == 0) {
- log_debug(ZONE, "pre STARTTLS packet, dropping");
- log_write(sess->c2s->log, LOG_NOTICE, "[%d] got pre
STARTTLS packet, dropping", sess->s->tag);
-
- sx_error(s, stream_err_POLICY_VIOLATION, "stanza sent
before starttls");
-
nad_free(nad);
return 0;
return 0;
}
--- 324,329 ----
***************
*** 372,378 ****
/* they sasl auth'd, so we only want the new-style session
start */
else {
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] SASL
authentication succeeded: mechanism=%s; authzid=%s%s", sess->s->tag,
&sess->s->auth_method[5], sess->s->auth_id,
sess->s->ssf ? ", TLS negotiated" : "");
sess->sasl_authd = 1;
}
--- 364,370 ----
/* they sasl auth'd, so we only want the new-style session
start */
else {
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] SASL
authentication succeeded: mechanism=%s; authzid=%s", sess->s->tag,
&sess->s->auth_method[5], sess->s->auth_id);
sess->sasl_authd = 1;
}
***************
*** 442,448 ****
case action_CLOSE:
log_debug(ZONE, "close action on fd %d", fd->fd);
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] [%s, port=%d]
disconnect jid=%s, packets: %i", sess->fd->fd, sess->ip, sess->port,
sess->jid?jid_full(sess->jid):"unbound"
, sess->packet_count);
/* tell the sm to close their session */
if(sess->active)
--- 434,440 ----
case action_CLOSE:
log_debug(ZONE, "close action on fd %d", fd->fd);
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] [%s, port=%d]
disconnect", sess->fd->fd, sess->ip, sess->port);
/* tell the sm to close their session */
if(sess->active)
***************
*** 593,599 ****
return 0;
}
! log_write(c2s->log, LOG_NOTICE, "[%d] [router] read
error: %s (%d)", c2s->fd->fd, MIO_STRERROR(MIO_ERROR), MIO_ERROR);
sx_kill(s);
--- 585,591 ----
return 0;
}
! log_write(c2s->log, LOG_NOTICE, "[%d] [router] read
error: %s (%d)", c2s->fd->fd, strerror(errno), errno);
sx_kill(s);
***************
*** 625,631 ****
if(errno == EWOULDBLOCK || errno == EINTR || errno ==
EAGAIN)
return 0;
! log_write(c2s->log, LOG_NOTICE, "[%d] [router] write error:
%s (%d)", c2s->fd->fd, MIO_STRERROR(MIO_ERROR), MIO_ERROR);
sx_kill(s);
--- 617,623 ----
if(errno == EWOULDBLOCK || errno == EINTR || errno ==
EAGAIN)
return 0;
! log_write(c2s->log, LOG_NOTICE, "[%d] [router] write error:
%s (%d)", c2s->fd->fd, strerror(errno), errno);
sx_kill(s);
}}}
I started changing the {{{c2s.c}}} by introducing changes one by one. In
so doing, however, I skipped the following:
{{{
*** 198,206 ****
break;
case event_PACKET:
- /* we're counting packets */
- sess->packet_count++;
-
nad = (nad_t) data;
/* we only want (message|presence|iq) in jabber:client,
everything else gets dropped */
--- 198,203 ----
***************
*** 327,337 ****
#ifdef HAVE_SSL
/* drop packets if they have to starttls and they haven't */
if((sess->s->flags & SX_SSL_STARTTLS_REQUIRE) &&
sess->s->ssf == 0) {
- log_debug(ZONE, "pre STARTTLS packet, dropping");
- log_write(sess->c2s->log, LOG_NOTICE, "[%d] got pre
STARTTLS packet, dropping", sess->s->tag);
-
- sx_error(s, stream_err_POLICY_VIOLATION, "stanza sent
before starttls");
-
nad_free(nad);
return 0;
}
}}}
Right after I introduced the following:
{{{
*** 442,448 ****
case action_CLOSE:
log_debug(ZONE, "close action on fd %d", fd->fd);
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] [%s, port=%d]
disconnect jid=%s, packets: %i", sess->fd->fd, sess->ip, sess->port,
sess->jid?jid_full(sess->jid):"unbound"
, sess->packet_count);
/* tell the sm to close their session */
if(sess->active)
--- 434,440 ----
case action_CLOSE:
log_debug(ZONE, "close action on fd %d", fd->fd);
! log_write(sess->c2s->log, LOG_NOTICE, "[%d] [%s, port=%d]
disconnect", sess->fd->fd, sess->ip, sess->port);
/* tell the sm to close their session */
if(sess->active)
}}}
the following error appeared:
{{{
Making all in c2s
make[2]: Entering directory `/src/network/sources/jabberd-2.1.13/c2s'
source='c2s.c' object='c2s-c2s.o' libtool=no \
DEPDIR=.deps depmode=none /bin/bash ../depcomp \
/opt/SUNWspro/bin/cc -DHAVE_CONFIG_H -I. -I..
-DCONFIG_DIR=\"/usr/local/etc\" -DLIBRARY_DIR=\"/usr/local/lib/jabberd\"
-I/usr/local/include -I/usr/local/include/openssl
-I/usr/local/include/mysql -xO3 - -c -o c2s-c2s.o `test -f 'c2s.c' ||
echo './'`c2s.c
"c2s.c", line 215: warning: argument #2 is incompatible with prototype:
prototype: pointer to const unsigned char : "../util/util.h", line
253
argument : pointer to char
"c2s.c", line 233: warning: argument #4 is incompatible with prototype:
prototype: pointer to const unsigned char : "../util/util.h", line
261
argument : pointer to char
"c2s.c", line 274: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 69
argument : pointer to const unsigned char
"c2s.c", line 274: warning: argument #2 is incompatible with prototype:
prototype: pointer to const char : "../util/nad.h", line 164
argument : pointer to const unsigned char
"c2s.c", line 437: operands have incompatible types:
pointer to const unsigned char ":" pointer to char
"c2s.c", line 544: warning: argument #1 is incompatible with prototype:
prototype: pointer to const char :
"/usr/include/iso/string_iso.h", line 64
argument : pointer to unsigned char
"c2s.c", line 883: warning: argument #2 is incompatible with prototype:
prototype: pointer to char : "unknown", line 0
argument : pointer to unsigned char
"c2s.c", line 933: warning: argument #3 is incompatible with prototype:
prototype: pointer to const char : "../sx/sx.h", line 172
argument : pointer to const unsigned char
cc: acomp failed for c2s.c
make[2]: *** [c2s-c2s.o] Error 2
make[2]: Leaving directory `/src/network/sources/jabberd-2.1.13/c2s'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/src/network/sources/jabberd-2.1.13'
make: *** [all] Error 2
}}}
'''Conclusions'''
Unlike what I initially suspected, the failer is not caused by prototype
mismatches. According to [http://docs.sun.com/source/819-3688/tguide.html
Chapter 6 Transition to ISO C], the compiler's -Xa default actually
accomodates K&R syntaxes (see '''6.1.2'''). So, the problem is caused by
the newly introduced constructs identified above.
I hope the above findings can help resolve this ticket.
Thanks,
--Peter
--
Ticket URL: <http://jabberd2.xiaoka.com/ticket/111#comment:9>
jabberd2 <http://jabberd2.xiaoka.com/>
jabberd2 project
_______________________________________________
Jabberd2 mailing list
[email protected]
http://lists.xiaoka.com/listinfo.cgi/jabberd2-xiaoka.com