[erlang-questions] R13B01: erts_cpu_info_update() "int mib[0];" + sysctl call trashes stack

Michael Turner leap@REDACTED
Wed Jul 29 07:51:01 CEST 2009



On 7/28/2009, "Mikael Pettersson" <mikpe@REDACTED> wrote:

[snipped bit about "int mib[0];"]

>On what platform does this code get compiled?

i386_unknown_freebsd4.10, is what ./configure can figure.  An old gcc as
well.

>I would have expected
>recent GCCs to complain about the out-of-bounds indexing,

I'm not so recent.  Even with "-pedantic" it doesn't complain.  I'm
using a pretty old gcc, though: compiled in 1999.  ("-pedantic" breaks
other stuff, so I'll turn it off.)

I don't understand those nested #ifdefs in erl_misc_utils.c, but for all
I know this code hasn't been gotten past the C proprocessor in some
years; maybe it's even part of some edit that had been (silently)
abandoned.  Like I say, I'm new to this.

>Anyway, you have indeed found a real bug. The code in question is
>utterly wrong.

But it's surfacing now.  Even though it might have been years since it
was compiled.

This raises a software engineering issue: why is there so much
conditional compilation in the .c files?  Shouldn't environment
dependencies be isolated in platform-specific libraries or (failing
that) in header files, to the extent possible?

  http://doc.cat-v.org/henry_spencer/ifdef_considered_harmful.pdf

And what's the process for getting involved in cleaning up these sorts
of messes?  If it's "not really a bug", can I still submit it in
patch format?

>Proper bug reporting procedure is to send an email to the erlang-bugs
>mailing list . . .

Thanks, will do.

Which brings up another software engineering / website / community issue:
I didn't know what to do here, because I had not only found a bug, but
wanted to submit a patch, and trapexit.org is misleading about this.

I went to the obvious place:

  http://forum.trapexit.org/viewforum.php?f=3  [*]

There, you'll see that

 (1) the most recent submitted patch is (implausibly) over a year ago;

 (2) the Site Admin's sticky posting says "For instruction [sic] how to
register, please visit http://www.erlang.org/mailman/listinfo" -- which
is a dead link.

At that point, I gave up, came here, and asked.  Sorry to be complaining
so much here.  I know it is an inappropriate list for these questions
and comments.  But I can't seem to get registered as a user.

-michael turner

[*] Not obvious from the URL?  Meta-meta-issue: why aren't trapexit.org
URLs more informative?

Meta-meta-meta-issue: how does one get involved in improving
www.trapexit.org?  I'd sure like to put the Search box up near
Navigation (search is, after all, navigation), or in the upper right
hand corner, the most obvious place to look.

  http://www.useit.com/alertbox/20010513.html

As it is, I have to hit my browser's right scroll bar twice to get to
the www.trapexit.org search box.



More information about the erlang-questions mailing list