From michael.santos@REDACTED Tue Aug 3 19:26:21 2010
From: michael.santos@REDACTED (Michael Santos)
Date: Tue, 3 Aug 2010 13:26:21 -0400
Subject: [PATCH] epmd: suppress startup message
Message-ID: <20100803172621.GA23723@ecn.lan>
Running transient distributed Erlang nodes can generate a large number
of informational messages to syslog. Modify epmd to log the startup
message only when passed the debug switch.
Reported-By: Sergey Samokhin
---
erts/epmd/src/epmd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c
index 6ddf30e..9c2ce06 100644
--- a/erts/epmd/src/epmd.c
+++ b/erts/epmd/src/epmd.c
@@ -236,7 +236,7 @@ int main(int argc, char** argv)
else
usage(g);
}
- dbg_printf(g,0,"epmd running - daemon = %d",g->is_daemon);
+ dbg_printf(g,1,"epmd running - daemon = %d",g->is_daemon);
#ifndef NO_SYSCONF
if ((g->max_conn = sysconf(_SC_OPEN_MAX)) <= 0)
--
1.5.4.3
From bgustavsson@REDACTED Wed Aug 4 11:50:54 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Wed, 4 Aug 2010 11:50:54 +0200
Subject: [erlang-patches] [PATCH] epmd: suppress startup message
In-Reply-To: <20100803172621.GA23723@ecn.lan>
References: <20100803172621.GA23723@ecn.lan>
Message-ID:
On Tue, Aug 3, 2010 at 7:26 PM, Michael Santos wrote:
> Running transient distributed Erlang nodes can generate a large number
> of informational messages to syslog. Modify epmd to log the startup
> message only when passed the debug switch.
Thanks! Included in 'pu'.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From pguyot@REDACTED Wed Aug 4 11:51:25 2010
From: pguyot@REDACTED (Paul Guyot)
Date: Wed, 4 Aug 2010 11:51:25 +0200
Subject: Fix SSL 4.0.1 handshake bug
Message-ID: <37E96D08-659A-4640-BA49-08ED6C21E71B@kallisys.net>
Hello,
There is a bug in SSL 4.0.1 handshake from the client side. When a client certificate is used, SSL 4.0.1 filters ciphers to only send those compatible with the certificate (e.g. of the same algorithm dsa/rsa, and in the case of RSA, it depends on the key usage extension of the certificate).
This behavior differs from common implementations (e.g. openssl s_client) and from what the TLS 1.0 specification says.
RFC2246 mentions filtering cipher suites based on the *server* certificate (7.4.2). The public key in the server certificate is sent to the client to encrypt the pre-master.
However, RFC2246 does not say clients should do the same with the client certificate. The key in the client certificate is never used to encrypt any key (therefore, there is no reason to filter on keyEncipherment usage), it is only used to sign the exchange so far *if the certificate has signing capability* (7.4.6, 7.4.8). As a result, the client should send all the ciphers it is capable of using (this is what openssl s_client as well as {ssl_imp, old} does).
Since openssl blindly sends all the cipher suites, this is what I suggest and what is implemented in the patch.
However, I am not sure if the client should refuse to send the certificate verify message if the certificate usage extension does not include digitalSignature (and the critical bit is set ?).
A patch with a non-regression test is available here:
git fetch git://github.com/pguyot/otp.git pg/fix-ssl-handshake-client-certificate
http://github.com/pguyot/otp/commit/0975941a5b2684158ec8e94107a531f12827ca66
Paul
--
Semiocast http://semiocast.com/
+33.175000290 - 62 bis rue Gay-Lussac, 75005 Paris
From bgustavsson@REDACTED Wed Aug 4 11:53:25 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Wed, 4 Aug 2010 11:53:25 +0200
Subject: [erlang-patches] Callback attribute for better definition of
behaviour callbacks.
In-Reply-To: <20100630142918.GA11962@erix.ericsson.se>
References:
<20100630102356.GA5480@erix.ericsson.se>
<20100630142918.GA11962@erix.ericsson.se>
Message-ID:
On Wed, Jun 30, 2010 at 4:29 PM, Raimo Niskanen
wrote:
>> > > The patch can be obtained with:
>> > >
>> > > git fetch git://github.com/aronisstav/otp.git callback-attr
>
> Thank you! It will be included in 'pu'.
>
The BEAM files included in several commits make this branch
a merging nightmare. I have reorganized the branch so that
there is one update of the bootstrap compiler in a separate
commit.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From bgustavsson@REDACTED Wed Aug 4 11:56:36 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Wed, 4 Aug 2010 11:56:36 +0200
Subject: [erlang-patches] Fix SSL 4.0.1 handshake bug
In-Reply-To: <37E96D08-659A-4640-BA49-08ED6C21E71B@kallisys.net>
References: <37E96D08-659A-4640-BA49-08ED6C21E71B@kallisys.net>
Message-ID:
On Wed, Aug 4, 2010 at 11:51 AM, Paul Guyot wrote:
>
> git fetch git://github.com/pguyot/otp.git pg/fix-ssl-handshake-client-certificate
> http://github.com/pguyot/otp/commit/0975941a5b2684158ec8e94107a531f12827ca66
Thanks! Included in 'pu'.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From aronisstav@REDACTED Wed Aug 4 12:01:21 2010
From: aronisstav@REDACTED (Stavros Aronis)
Date: Wed, 4 Aug 2010 13:01:21 +0300
Subject: [erlang-patches] Callback attribute for better definition of
behaviour callbacks.
In-Reply-To:
References:
<20100630102356.GA5480@erix.ericsson.se>
<20100630142918.GA11962@erix.ericsson.se>
Message-ID:
That's a painful truth which I faced not a few times while rebasing!
My reasoning was that each commit should be independent and stable on it's
own, (as it's suggested in many git guides) so I applied the various updates
on the bootstrap as they were introduced.
Thanks for the refactoring and the feedback! I'll update my branch as soon
as possible!
-- Stavros Aronis
2010/8/4 Bj?rn Gustavsson
> ...
The BEAM files included in several commits make this branch
> a merging nightmare. I have reorganized the branch so that
> there is one update of the bootstrap compiler in a separate
> commit.
>
> --
> Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
>
From bgustavsson@REDACTED Wed Aug 4 12:24:04 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Wed, 4 Aug 2010 12:24:04 +0200
Subject: [erlang-patches] Callback attribute for better definition of
behaviour callbacks.
In-Reply-To:
References:
<20100630102356.GA5480@erix.ericsson.se>
<20100630142918.GA11962@erix.ericsson.se>
Message-ID:
2010/8/4 Stavros Aronis :
> My reasoning was that each commit should be independent and stable on it's
> own, (as it's suggested in many git guides) so I applied the various updates
> on the bootstrap as they were introduced.
Yes, that is very good advice, which I also make my
utmost to follow (so that tools like "git bisect" can be
used).
The way I did it, putting the update of the primary
bootstrap just before the commit that first will need
the new feature should still make each commit stable
on its own.
> Thanks for the refactoring and the feedback! I'll update my branch as soon
> as possible!
You are welcome.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From rtilder@REDACTED Sat Aug 7 06:34:32 2010
From: rtilder@REDACTED (Ryan Tilder)
Date: Fri, 6 Aug 2010 21:34:32 -0700
Subject: [PATCH] Solaris PTY fixes for run_erl
Message-ID:
A couple of our customers have run into problems with our use of run_erl on
Solaris. These patches include the addition of a simple open("/dev/ptmx")
in place of the call to posix_openpt() in open_pty_master() and the addition
of several calls to ioctl() to push three STREAMS modules onto the slave PTY
in open_pty_slave(). Also a small typo fix for debug code in
open_pty_slave().
These patches may work on other platforms but I only have
Solaris/OpenSolaris to test on, so the #ifdefs are deliberately restricted.
git fetch git://github.com/rtilder/otp.git solaris-pty-handling-fixes
Debug typo fix:
http://github.com/rtilder/otp/commit/edfe4b9e94762fb48da2d533f83a0e7c095fad7a
Solaris PTY handling:
http://github.com/rtilder/otp/commit/06ab492ea956010955689acfd95d24b8fb351fda
--Ryan
From bgustavsson@REDACTED Tue Aug 10 15:23:38 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Tue, 10 Aug 2010 15:23:38 +0200
Subject: [erlang-patches] [PATCH] Solaris PTY fixes for run_erl
In-Reply-To:
References:
Message-ID:
On Sat, Aug 7, 2010 at 6:34 AM, Ryan Tilder wrote:
>
> git fetch git://github.com/rtilder/otp.git solaris-pty-handling-fixes
Thanks! Included in pu.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From mikpe@REDACTED Wed Aug 11 19:31:43 2010
From: mikpe@REDACTED (Mikael Pettersson)
Date: Wed, 11 Aug 2010 19:31:43 +0200
Subject: fix hipe_bifs_alloc_data_2 to avoid "Yikes!" warning
Message-ID: <19554.56959.239938.294848@pilspetsen.it.uu.se>
It's been reported that HiPE-enabled Erlang VMs running on BSD
systems sometimes generate messages like
Yikes! erts_alloc() returned misaligned address 0x8016a512c
These originate from hipe_bif0.c:hipe_bifs_alloc_data_2().
A native code module has an associated data area of some
size and alignment. In the case where the size is zero,
the alignment is irrelevant, but the allocation BIF checks
it anyway. The warning then triggers on systems where
malloc(0) returns blocks with less alignment than we
(erroneously) expected.
The fix is to simply skip the allocation in this case and
return NULL. The loader won't actually use the address in
this case so that's safe. This is also an optimization since
it avoids allocating memory that cannot be used, and it avoids
fragmenting the system heap with useless tiny blocks.
A second problem is that the warning message failed to
identify its origin. Fixed by prefixing the message by
the BIF's name rather than the silly Yikes! string.
Tested and confirmed to solve the original reporter's problem.
/Mikael
--- otp_src_R14A/erts/emulator/hipe/hipe_bif0.c.~1~ 2010-02-19 19:04:06.000000000 +0100
+++ otp_src_R14A/erts/emulator/hipe/hipe_bif0.c 2010-08-05 09:57:48.000000000 +0200
@@ -440,9 +440,12 @@ BIF_RETTYPE hipe_bifs_alloc_data_2(BIF_A
align != sizeof(long) && align != sizeof(double)))
BIF_ERROR(BIF_P, BADARG);
nrbytes = unsigned_val(BIF_ARG_2);
+ if (nrbytes == 0)
+ BIF_RET(make_small(0));
block = erts_alloc(ERTS_ALC_T_HIPE, nrbytes);
if ((unsigned long)block & (align-1))
- fprintf(stderr, "Yikes! erts_alloc() returned misaligned address %p\r\n", block);
+ fprintf(stderr, "%s: erts_alloc(%lu) returned %p which is not %lu-byte aligned\r\n",
+ __FUNCTION__, (unsigned long)nrbytes, block, (unsigned long)align);
BIF_RET(address_to_term(block, BIF_P));
}
From jonas.p@REDACTED Thu Aug 12 11:34:02 2010
From: jonas.p@REDACTED (jonas)
Date: Thu, 12 Aug 2010 11:34:02 +0200
Subject: Allow server to use verify_peer and have no cacertfile
Message-ID:
Hey *,
I wanted to implement a server that can authenticate clients using the
FOAF+SSL protocol (http://esw.w3.org/Foaf+ssl). This protocol uses the
existing TLS infrastructure but does not use a cacert to authenticate
the user. Providing no cacert was just an option for a client, since
they can usually verify the certificate manually. If a server doesn't
provide a cacertfile you get an error. This patch removes this
restriction and allows a server to have no cacert, too.
git fetch git://github.com/jonasp/otp.git foaf_ssl
I didn't delete the testcase "Test server must have cacerts if it
wants to verify client" yet. I can do so if you think that the patch
is fine as it is.
As far as documentation is concerned I am not exactly sure what would
be reasonable to change since the FOAF+SSL usecase is still a bit too
exotic to be referred to. (It is still in the process of being
formally standardized.) And the Erlang man page for ssl just states
that the cacertfile option can be omitted if you do not want to verify
the peer but does not differentiate between client or server as it
actually should at the moment. So I don't think any change is needed
there.
Best regards
Jonas Pollok
From rickard@REDACTED Thu Aug 12 17:38:01 2010
From: rickard@REDACTED (Rickard Green)
Date: Thu, 12 Aug 2010 17:38:01 +0200
Subject: Patch for configurable ERTS_DE_BUSY_LIMIT
Message-ID: <4C641559.5030100@erlang.org>
Scott Lystig Fritchie wrote:
> Rickard Green < rickard ? erlang ? org > wrote:
>
> rg> It seems reasonable to add a configuration parameter for this.
> rg> However: [...]
>
> Assuming I followed instructions correctly, version 2 of this new config
> knob should be available via:
>
> git fetch git://github.com/slfritchie/otp.git erts_de_busy_limit
>
> Add flag-based setting for 'erts_de_busy_limit' constant
>
> A prior patch to change the 'erts_de_busy_limit' constant, based on an
> environment variable, was rejected by the Ericsson OTP team because
> environment variables are no longer used for modifying the VM's
> behavior.
>
> Families of flags like "+s" are devoted to the scheduler (except for
> "+sss"), but it wasn't obvious to me where a "+"-style flag for
> 'erts_de_busy_limit' should go. So, this patch creates a new family
> of flags, prefixed with "+z", for miscellaneous VM settings.
>
> The full flag name is "+zerts_de_busy_limit", which goes against the
> tradition of using "+Qmbl" for adjusting some kind of "mumble mumble"
> value but "mumble mumble" is obviously too long to be useful. If
> "+zerts_de_busy_limit" is too long, then I'll leave it to the OTP team
> to create a tradition-fitting, impossible-to-remember abbreviation to
> use instead.
>
> I don't a functional Java compiler with the suitable Java compliance
> level, so compiling & running the test suite isn't an option for me
> yet. I've made the attempt to write a test, but I haven't executed it
> to know if it works. erlang:system_info(erts_de_busy_limit) was added
> to make a unit test possible.
>
> The documentation changes are terse but present. Given the lack of
> Java above, my doc-building toolchain is broken, so I don't know if
> the formatting is correct, sorry.
>
> -Scott
Hi Scott,
I've had a look at your patch, and it needs some improvements before we
can accept it.
* The patch have no effect. The variable erts_de_busy_limit isn't used
by the distribution code.
* Improve commit message (see
http://wiki.github.com/erlang/otp/writing-good-commit-messages). It
would also be good to get some figures on the effects of increasing the
limit (latency, throughput).
* Choose a better name than erts_de_dist_limit. It doesn't explain
anything without looking in the source code. Its hard to choose a good
name, but perhaps dist_buf_busy_limit.
* The command line argument name should be constructed similar to the
other parameters, e.g., +zdbbl (where dbbl are the first letters in each
word in dist_buf_busy_limit).
* Improve documentation (both of the command line argument and the
system_info() argument). Describe the effect, e.g., something like: A
larger buffer limit will allow processes to buffer more outgoing
messages over the distribution. When the buffer limit has been reached,
sending processes will be suspended until the buffer size has shrunk.
The buffer limit is per distribution channel. A higher limit will give
lower latency (and higher throughput?) at the expense of higher memory
usage.
* Move the testcase into erts/emulator/test/distribution_SUITE.erl
* The testcase should use test_server:start_node/test_server:stop_node
for starting and stopping nodes. There are also local implementations in
distribution_SUITE of start_node/stop_node (using the test_server
versions) which you can use.
* The testcase should test that the parameter have the desired effect.
E.g., verify that you get lots of busy_dist_port with a small value at a
certain amount of traffic, and no or fewer busy_dist_port with a large
setting and the same amount of traffic.
Regards,
Rickard Green
---
Rickard Green, Erlang/OTP, Ericsson AB.
From bgustavsson@REDACTED Fri Aug 13 11:12:04 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Fri, 13 Aug 2010 11:12:04 +0200
Subject: [erlang-patches] Allow server to use verify_peer and have no cacertfile
In-Reply-To:
References:
Message-ID:
On Thu, Aug 12, 2010 at 11:34 AM, jonas wrote:
>
> git fetch git://github.com/jonasp/otp.git foaf_ssl
>
Thanks! Will include in pu.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From bgustavsson@REDACTED Fri Aug 13 11:42:21 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Fri, 13 Aug 2010 11:42:21 +0200
Subject: What's cooking in erlang/otp (2010-08-13)
Message-ID:
We are now developing towards the R14B release and
primarily will accept bugfixes for that.
New features are not desired in that release...
------------------------------------------------------------
[Graduated]
* cg/small-typos (erl_interface, kernel, megaco, odbc, snmp, ssl,
stdlib) (2010-07-16) 1 commit
+ Fix minor typos and errors in documentation (205cc29)
* db/tv_nthtail_fix (tv) (2009-12-01) 1 commit
+ Fix for tv which restarts while trying to open a table (28f1e36)
* pg/load-native-code-for-early-modules (kernel) (2010-07-11) 1 commit
+ Load native code for modules loaded before the code server (a8b8ec5)
* pg/optimize_beam_dict_string_table (compiler) (2010-07-04) 1 commit
+ beam_asm: Simplify string table generation for beams (173d1fd)
* ta/doc-fixes (eunit, reltool, stdlib) (2010-07-25) 3 commits
+ Remove extra leading spaces in filename doc (ac2ab4a)
+ Remove wrong ')' in eunit overview edoc (fd54521)
+ Correct a couple of reltool documentation errors (ec989d8)
------------------------------------------------------------
[New topics]
* jp/ssl-foaf (ssl) (2010-08-12) 1 commit
- Allow server to use verify_peer and have no cacert (9971792)
* mp/fix-hipe_bifs_alloc_data (erts) (2010-08-11) 1 commit
- fix hipe_bifs_alloc_data_2 to avoid "Yikes!" warning (6b8733b)
* ms/inet-bug-fixes (erts, kernel) (2010-07-21) 4 commits
- inet: support retrieving MAC address on BSD (c8070ff)
- inet: fix getservbyname buffer overflow (d61d41e)
- inet: fix ifr_name buffer overflow (227d3f3)
- inet: null terminate ifr_name buffer (cfcb962)
* ms/suppress-epmd-startup-message (erts) (2010-08-03) 1 commit
- epmd: suppress startup message (af2787b)
* pan/local_univ_time_bsd/OTP-8580 (erts) (2010-06-10) 1 commit
- Teach erl_time_sup to handle timezones w/o DST on FreeBSD as on
other platforms (7e6fe78)
This branch replaces bg/safer-local_to_univ.
* pg/fix-hipe-load (hipe) (2010-07-11) 1 commit
- Fix hipe:load/1 (9196195)
* pg/fix-ssl-handshake-client-certificate (ssl) (2010-08-04) 1 commit
- Fix bug in ssl handshake protocol related to the choice of cipher
suites in client hello message when a client certificate is used
(0975941)
* rt/solaris-pty-handling-fixes (erts) (2010-08-06) 2 commits
- Add corrected support for Solaris PTYs to run_erl (2ba4818)
- Fix a typo that leads to syntax errors with DEBUG defined in
run_erl (edfe4b9)
* rz/fix-httpc-docs (inets) (2010-07-10) 2 commits
- Fix http client docs (294dfc0)
- Fix broken links in inets docs (7e417c3)
* sv/epmd-check-listen (erts) (2010-07-14) 1 commit
- check return value of epmd server listen() call (c5c8baa)
* ta/asn1ct-fix-whitespace (asn1) (2010-07-12) 1 commit
- asn1ct: change unusual whitespace char from 0xA0 to 0x20 (c43d20b)
* tj/ct-timestamp-granularity (common_test) (2010-07-13) 1 commit
- Include milliseconds in timestamps in Common Test log entries (4d18f18)
* tm/fix-cover-html-escaping (tools) (2010-07-09) 1 commit
- Fix cover's HTML-generation logic to escape ampersands in source
code (acc2dce)
------------------------------------------------------------
[Stalled]
* er/ei-decode_msg (erl_interface) (2010-03-11) 1 commit
- Add function to decode distribution header (864091a)
Needs documentation and test cases.
Action expected from: Topic author
* jp/dependencies_makefile (compiler, erts) (2010-02-14) 3 commits
- squash! eliminate dialyzer warning (434e2ca)
- squash! fix snprintf for Windows (bf2708d)
- Add dependencies Makefile generation to erlc(1) and compile(3) (7cbc437)
Approved in principle by the OTP Technical Board; now awaits a closer
review of the implementation.
Action expected from: Bj?rn Gustavsson (the reviewer)
* jn/gen_stream (stdlib) (2010-07-15) 2 commits
- Track gen_stream processes directly for accurate test results (38a4083)
- Patch dev to reproduce jn/gen_stream (7694a74)
. Add new gen_stream behaviour for efficiently consuming serial
streams (65f3db8)
This topic branch has failing test cases.
shell_SUITE:start_restricted_from_shell;
We have now tested with and without this topic branch and when
it is present that test case fails. We consider it proved
to be guilty. The test case does not fail when run standalone
so it seems to be tricky... Also, some of its own test cases
fail sporadicly apparently since the assumption there shoul
be no more processes after the test case does not hold;
probably a timing issue.
Action expected from: Topic author.
* kr/gs-browser (gs) (2010-02-10) 1 commit
- Change lib/gs/src/tool_utils.erl to select multiple browsers other
than Netscape (802d159)
This topic branch introduces a new call to the deprecated regexp module.
Action expected from: Topic author or anyone else with an interest to
advance the topic
* sf/erts_de_busy_limit (erts) (2010-06-08) 1 commit
- Add flag-based setting for 'erts_de_busy_limit' constant (67ed9ab)
This topic branch has multiple issues described in this email:
http://www.erlang.org/cgi-bin/ezmlm-cgi?3:mss:1303:201008:ldciadjdmjednikemjch
Action expected from: Topic author.
------------------------------------------------------------
[Cooking]
* bg/temp-hipe-fixes (compiler, hipe, kernel) (2010-03-15) 6 commits
- Avoid crash by skipping compilation_SUITE:on_load/1 (234e13e)
- Inline less aggressively for native-code compilation (9fcb48b)
- Crudely fix return type for the lists:key{search,find,member}/3 (ef71597)
- seq_trace_SUITE: Don't native-compile (2a81b1a)
- Disable native code if on_load is used (3befa76)
- andor_SUITE: Don't native-compile (97aa2da)
This branch contains temporary workarounds to avoid failing test
cases and is never intended to graduate.
* gc/gen-format-status-improvements (stdlib) (2010-06-12) 1 commit
- Fix format_status bug for unregistered gen_event processes (95ed86f)
* jf/run_erl-disable-flow-control (erts) (2010-03-05) 1 commit
- Teach run_erl RUN_ERL_DISABLE_FLOWCNTRL for disabling flow control (d0775cd)
* jr/cover-src-path (tools) (2010-04-23) 1 commit
- Fix searching for source files in analyse_to_file/* (b9d5068)
* mk/net-dragonfly-bsd-patches (asn1, common_test, erl_interface,
erts, et, mnesia, reltool, runtime_tools, test_server, wx)
(2010-06-23) 4 commits
- Remove unused variables (88a04a1)
- Use proper install method (6960062)
- Add support for DragonFly BSD (2008472)
- Add support for NetBSD (2fb2a1e)
* pg/fix-segfault-on-crash_dump-with-hipe (erts) (2010-07-06) 1 commit
- Fix a bug that could produce a segmentation fault when dumping the
crash log with hipe enabled and natively compiled modules (089e48c)
* pg/hipe_crash_with_on_load (erts) (2010-07-30) 2 commits
- Fix crash when calling a module with an on_load attribute from a
native module (2862bd2)
* pg/honor-start-type-in-rel-files (sasl) (2010-06-06) 1 commit
- Honor start type in .rel files when building relup files (7599900)
* sa/callback-attr (compiler, inets, kernel, otp, stdlib) (2010-06-08) 7 commits
- Add callback specs into 'application' module in kernel (b12de0a)
- Add callback specs to tftp module following internet documentation (2f27196)
- Add callback specs to inets_service module following possibly
deprecated comments (cc249ec)
- Add '-callback' attributes in stdlib's behaviours (6df97f4)
- Update primary bootstrap (c864c17)
- Automatical generation of 'behaviour_info' function from
'-callback' attributes (5b455e8)
- Add '-callback' attribute to language syntax (2f6c340)
* sb/make-files-like-erlc (tools) (2010-05-18) 1 commit
- Change make:files to behave more like erlc (5e9d051)
* ta/asn1-reporting (asn1) (2010-04-23) 1 commit
- asn1ct: Make formatting of errors and warnings consistent (93face2)
* uw/epmd-fullnames (kernel) (2010-05-07) 1 commit
- Allow the erlang nodename host part to differ from the hostname (e0774be)
------------------------------------------------------------
[Dropped]
* bg/safer-local_to_univ (erts) (2010-02-11) 1 commit
. erl_time_sup.c: test for error return from mktime() (0f62f0b)
Replaced by pan/local_univ_time_bsd/OTP-8580.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From puzza007@REDACTED Wed Aug 18 13:13:37 2010
From: puzza007@REDACTED (Paul Oliver)
Date: Wed, 18 Aug 2010 12:13:37 +0100
Subject: Add spec for base64:encode_binary/1
Message-ID:
Dialyzer was reporting that use of base64:encode(Foo :: binary()) had spec
binary() -> <<_:_*1>>. The binary comprehension in base64:encode seems to
result in the return type of <<_:_*1>>. The patch below enforces a return
type of binary().
git fetch git://github.com/puzza007/otp.git base64_encode_binary_spec
Cheers,
Paul.
From kostis@REDACTED Wed Aug 18 13:26:25 2010
From: kostis@REDACTED (Kostis Sagonas)
Date: Wed, 18 Aug 2010 14:26:25 +0300
Subject: [erlang-patches] Add spec for base64:encode_binary/1
In-Reply-To:
References:
Message-ID: <4C6BC361.3020606@cs.ntua.gr>
Paul Oliver wrote:
> Dialyzer was reporting that use of base64:encode(Foo :: binary()) had spec
> binary() -> <<_:_*1>>. The binary comprehension in base64:encode seems to
> result in the return type of <<_:_*1>>. The patch below enforces a return
> type of binary().
Sorry, but I cannot understand your mail... Can you elaborate a bit?
First of all, dialyzer cannot be reporting what you are claiming because
the spec of base64:encode/1 is:
-spec encode(string() | binary()) -> binary().
You are probably referring to some other function...
Looking at your patch, it seems that it refers to base64:encode_binary/1
which is a *module-local* function, not an exported one. Why do you feel
the need to add a spec to this function? What exactly is it that changes
in your use case?
Kostis
From puzza007@REDACTED Wed Aug 18 14:57:34 2010
From: puzza007@REDACTED (Paul Oliver)
Date: Wed, 18 Aug 2010 13:57:34 +0100
Subject: [erlang-patches] Add spec for base64:encode_binary/1
In-Reply-To: <4C6BC361.3020606@cs.ntua.gr>
References: <4C6BC361.3020606@cs.ntua.gr>
Message-ID:
On Wed, Aug 18, 2010 at 12:26 PM, Kostis Sagonas wrote:
> Paul Oliver wrote:
>
>> Dialyzer was reporting that use of base64:encode(Foo :: binary()) had spec
>> binary() -> <<_:_*1>>. The binary comprehension in base64:encode seems to
>> result in the return type of <<_:_*1>>. The patch below enforces a return
>> type of binary().
>>
>
> Sorry, but I cannot understand your mail... Can you elaborate a bit?
>
> First of all, dialyzer cannot be reporting what you are claiming because
> the spec of base64:encode/1 is:
>
> -spec encode(string() | binary()) -> binary().
>
> You are probably referring to some other function...
>
> Looking at your patch, it seems that it refers to base64:encode_binary/1
> which is a *module-local* function, not an exported one. Why do you feel the
> need to add a spec to this function? What exactly is it that changes in your
> use case?
>
>
Hi Kostis,
Sorry for the bother and disregard this patch. I had code like:
-spec(check_hmac(Bin :: binary()) -> binary()).
check_hmac(_Bin) ->
base64:encode(crypto:sha_mac(<<"foo">>, <<"bar">>)).
and looking now, it seems that the version of R14 I had compiled with had:
%%
%% SHA_MAC
%%
-spec sha_mac(iodata(), iodata()) ->* binary*.
-spec sha_mac_96(iodata(), iodata()) -> binary.
sha_mac(Key, Data) ->
sha_mac_n(Key,Data,20).
sha_mac_96(Key, Data) ->
sha_mac_n(Key,Data,12).
which was fixed here
http://github.com/erlang/otp/commit/8b6f2052d0a83da44462cd2642a52341d4ee193b
I had applied my "fix" to the dev branch, saw dialyzer now passed my code
and assumed I had fixed the problem.
Paul.
From jay@REDACTED Wed Aug 18 19:52:29 2010
From: jay@REDACTED (jay@REDACTED)
Date: Wed, 18 Aug 2010 10:52:29 -0700 (PDT)
Subject: gen_stream intermittent errors
Message-ID: <59567.76.79.190.165.1282153949.squirrel@s98814.gridserver.com>
Recent 'pu' summary stated:
* jn/gen_stream (stdlib) (2010-07-15) 2 commits
- Track gen_stream processes directly for accurate test results (38a4083)
- Patch dev to reproduce jn/gen_stream (7694a74)
. Add new gen_stream behaviour for efficiently consuming serial
streams (65f3db8)
This topic branch has failing test cases.
shell_SUITE:start_restricted_from_shell;
We have now tested with and without this topic branch and when
it is present that test case fails. We consider it proved
to be guilty. The test case does not fail when run standalone
so it seems to be tricky... Also, some of its own test cases
fail sporadicly apparently since the assumption there shoul
be no more processes after the test case does not hold;
probably a timing issue.
------------------
Is it really still having intermittent errors? I made a patch to correct
the test results that doesn't depend on the number of running processes
(it exposes an interface to report on the processes being used). It
should no longer be giving any errors.
Is there any more information on the shell_SUITE issue. I added the
failing line to the test cases to see what caused it to fail. If there is
a shell failure it should isolate the exact test which is causing the
failure.
Just wanted to get the latest information on the results of the nightly
test runs.
jay
From th.lachmann@REDACTED Wed Aug 18 21:05:29 2010
From: th.lachmann@REDACTED (Thomas Lachmann)
Date: Wed, 18 Aug 2010 21:05:29 +0200
Subject: Fix SSL bug when {packet, line} and list are set
Message-ID: <20100818210529.4b922d1a@optd.heidelberg.local>
Hello,
these patches correct the behaviour of the new ssl implementation, if
{packet, line} and mode list are set.
Previously the returned type was a binary.
The first patch changes the test ssl_packet_SUITE:packet_line_decode
to check for both cases packet line combined with mode binary and packet
line combined with mode list.
The second patch corrects the error.
I suspect the packet formats asn1, cdr, sunrm, fcgi and tpkt to suffer
the same problem. But as I don't know these formats, I don't know if
there are reasonable representations of them as lists.
The patches are available here:
git fetch git@REDACTED:thlachmann/otp.git
ssl_fix_packet_line_mode_list
Thomas
From th.lachmann@REDACTED Wed Aug 18 21:14:31 2010
From: th.lachmann@REDACTED (Thomas Lachmann)
Date: Wed, 18 Aug 2010 21:14:31 +0200
Subject: Fix SSL bug when {packet, line} and list are set
In-Reply-To: <20100818210529.4b922d1a@optd.heidelberg.local>
References: <20100818210529.4b922d1a@optd.heidelberg.local>
Message-ID: <20100818211431.087063d4@optd.heidelberg.local>
I seem to have mangled the git address, sorry for that.
Here it is again:
git fetch git://github.com/thlachmann/otp.git
ssl_fix_packet_line_mode_list
Thomas
From matthias@REDACTED Thu Aug 19 16:10:51 2010
From: matthias@REDACTED (Matthias Lang)
Date: Thu, 19 Aug 2010 16:10:51 +0200
Subject: extend erlang:port_info/1,2 to show the OS pid of a spawned process
Message-ID: <20100819141051.GA11601@corelatus.se>
Hi,
git fetch git://github.com/matthiasl/otp.git add-os-pid-to-port-info
This patch extends erlang:process_info/1,2 so that it reports a new
item, 'os_pid'. Example:
3> Port = erlang:open_port({spawn, "wc /dev/zero"}, []).
#Port<0.475>
4> erlang:port_info(Port).
[{name,"wc /dev/zero"},
{links,[<0.35.0>]},
{id,475},
{connected,<0.35.0>},
{input,0},
{output,0},
{os_pid,17736}] %% <----- This line is new
5> exit(Port, kill).
** exception exit: killed
6> erlang:port_info(Port).
undefined
7> os:cmd("kill 17736").
Why I did this:
Knowing the operating system's pid for a spawned process is useful
for debugging and for killing processes, such as "wc /dev/zero",
which won't die just because you close stdin/stdout.
The same effect can be accomplished with a wrapper. Such wrappers
are considered "less than ideal" by some, e.g. in this discussion:
http://www.erlang.org/cgi-bin/ezmlm-cgi?4:mss:50223:201003:clkfnmmlhkikkegdgclb
Limitations and concerns:
- I've only tested the patch on linux. (I expect it to work, but
report 'undefined' as the os_pid on win32 and vxworks)
- I store the pid in the port struct, which costs pid_t extra
storage per spawned process (4 or 8 octets). An alternative
would be to step through ifd[] and ofd[] to find the right
entry, but that would involve exporting a new function from sys.c
Matt
From bgustavsson@REDACTED Fri Aug 20 15:02:04 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Fri, 20 Aug 2010 15:02:04 +0200
Subject: [erlang-patches] Fix SSL bug when {packet, line} and list are set
In-Reply-To: <20100818210529.4b922d1a@optd.heidelberg.local>
References: <20100818210529.4b922d1a@optd.heidelberg.local>
Message-ID:
On Wed, Aug 18, 2010 at 9:05 PM, Thomas Lachmann
wrote:
> Hello,
>
> these patches correct the behaviour of the new ssl implementation, if
> {packet, line} and mode list are set.
Thanks! Will include in pu.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From bgustavsson@REDACTED Fri Aug 20 15:08:31 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Fri, 20 Aug 2010 15:08:31 +0200
Subject: [erlang-patches] extend erlang:port_info/1,2 to show the OS pid
of a spawned process
In-Reply-To: <20100819141051.GA11601@corelatus.se>
References: <20100819141051.GA11601@corelatus.se>
Message-ID:
On Thu, Aug 19, 2010 at 4:10 PM, Matthias Lang wrote:
> git fetch git://github.com/matthiasl/otp.git add-os-pid-to-port-info
>
> This patch extends erlang:process_info/1,2 so that it reports a new
> item, 'os_pid'.
Thanks! Will include in pu.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From bgustavsson@REDACTED Fri Aug 20 15:17:51 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Fri, 20 Aug 2010 15:17:51 +0200
Subject: What's cooking in erlang/otp (2010-08-20)
Message-ID:
We are now developing towards the R14B release and
primarily will accept bugfixes for that.
New features are not desired in that release...
------------------------------------------------------------
[Graduated]
* mp/fix-hipe_bifs_alloc_data (erts) (2010-08-11) 1 commit
+ fix hipe_bifs_alloc_data_2 to avoid "Yikes!" warning (6b8733b)
* ms/suppress-epmd-startup-message (erts) (2010-08-03) 1 commit
+ epmd: suppress startup message (af2787b)
* pg/fix-ssl-handshake-client-certificate (ssl) (2010-08-04) 1 commit
+ Fix bug in ssl handshake protocol related to the choice of cipher
suites in client hello message when a client certificate is used
(60b61d9)
* tm/fix-cover-html-escaping (tools) (2010-07-09) 1 commit
+ Fix cover's HTML-generation logic to escape ampersands in source
code (acc2dce)
------------------------------------------------------------
[New topics]
* ml/add-os-pid-to-port-info (erts) (2010-08-19) 1 commit
- Extend erlang:port_info/1,2 to show the OS pid of a spawned process (b2d85bf)
* tl/ssl-fix-packet-line-mode-list (ssl) (2010-08-18) 2 commits
- Correct behaviour if {packet, line} and mode list are given (06f147c)
- Change packet_line_decode/1 to not only check binary mode (5e6972f)
------------------------------------------------------------
[Stalled]
* er/ei-decode_msg (erl_interface) (2010-03-11) 1 commit
- Add function to decode distribution header (864091a)
Needs documentation and test cases.
Action expected from: Topic author
* jn/gen_stream (stdlib) (2010-07-15) 2 commits
- Track gen_stream processes directly for accurate test results (38a4083)
- Patch dev to reproduce jn/gen_stream (7694a74)
. Add new gen_stream behaviour for efficiently consuming serial
streams (65f3db8)
This topic branch has a failing test case:
shell_SUITE:start_restricted_from_shell;
We have now tested with and without this topic branch and when
it is present that test case fails. We consider it proved
to be guilty. The test case does not fail when run standalone
so it seems to be tricky... Also, some of its own test cases
fail sporadicly.
Action expected from: Topic author.
* jp/dependencies_makefile (compiler, erts) (2010-02-14) 3 commits
- squash! eliminate dialyzer warning (434e2ca)
- squash! fix snprintf for Windows (bf2708d)
- Add dependencies Makefile generation to erlc(1) and compile(3) (7cbc437)
Approved in principle by the OTP Technical Board; now awaits a closer
review of the implementation.
Action expected from: Bj?rn Gustavsson (the reviewer)
* kr/gs-browser (gs) (2010-02-10) 1 commit
- Change lib/gs/src/tool_utils.erl to select multiple browsers other
than Netscape (802d159)
This topic branch introduces a new call to the deprecated regexp module.
Action expected from: Topic author or anyone else with an interest to
advance the topic
* sf/erts_de_busy_limit (erts) (2010-06-08) 1 commit
- Add flag-based setting for 'erts_de_busy_limit' constant (67ed9ab)
This topic branch has multiple issues described in this email:
http://www.erlang.org/cgi-bin/ezmlm-cgi?3:mss:1303:201008:ldciadjdmjednikemjch
Action expected from: Topic author.
------------------------------------------------------------
[Cooking]
* bg/temp-hipe-fixes (compiler, hipe, kernel) (2010-03-15) 6 commits
- Avoid crash by skipping compilation_SUITE:on_load/1 (234e13e)
- Inline less aggressively for native-code compilation (9fcb48b)
- Crudely fix return type for the lists:key{search,find,member}/3 (ef71597)
- seq_trace_SUITE: Don't native-compile (2a81b1a)
- Disable native code if on_load is used (3befa76)
- andor_SUITE: Don't native-compile (97aa2da)
This branch contains temporary workarounds to avoid failing test
cases and is never intended to graduate.
* gc/gen-format-status-improvements (stdlib) (2010-06-12) 1 commit
- Fix format_status bug for unregistered gen_event processes (95ed86f)
* jf/run_erl-disable-flow-control (erts) (2010-03-05) 1 commit
- Teach run_erl RUN_ERL_DISABLE_FLOWCNTRL for disabling flow control (d0775cd)
* jp/ssl-foaf (ssl) (2010-08-12) 1 commit
- Allow server to use verify_peer and have no cacert (9971792)
* jr/cover-src-path (tools) (2010-04-23) 1 commit
- Fix searching for source files in analyse_to_file/* (b9d5068)
* mk/net-dragonfly-bsd-patches (asn1, common_test, erl_interface,
erts, et, mnesia, reltool, runtime_tools, test_server, wx)
(2010-06-23) 4 commits
- Remove unused variables (88a04a1)
- Use proper install method (6960062)
- Add support for DragonFly BSD (2008472)
- Add support for NetBSD (2fb2a1e)
* ms/inet-bug-fixes (erts, kernel) (2010-07-21) 4 commits
- inet: support retrieving MAC address on BSD (c8070ff)
- inet: fix getservbyname buffer overflow (d61d41e)
- inet: fix ifr_name buffer overflow (227d3f3)
- inet: null terminate ifr_name buffer (cfcb962)
* pan/local_univ_time_bsd/OTP-8580 (erts) (2010-06-10) 1 commit
- Teach erl_time_sup to handle timezones w/o DST on FreeBSD as on
other platforms (7e6fe78)
This branch replaces bg/safer-local_to_univ.
* pg/fix-hipe-load (hipe) (2010-07-11) 1 commit
- Fix hipe:load/1 (9196195)
* pg/fix-segfault-on-crash_dump-with-hipe (erts) (2010-07-06) 1 commit
- Fix a bug that could produce a segmentation fault when dumping the
crash log with hipe enabled and natively compiled modules (089e48c)
* pg/hipe_crash_with_on_load (erts) (2010-06-27) 1 commit
- Fix crash when calling a module with an on_load attribute from a
native module (2862bd2)
* pg/honor-start-type-in-rel-files (sasl) (2010-06-06) 1 commit
- Honor start type in .rel files when building relup files (7599900)
* rt/solaris-pty-handling-fixes (erts) (2010-08-06) 2 commits
- Add corrected support for Solaris PTYs to run_erl (2ba4818)
- Fix a typo that leads to syntax errors with DEBUG defined in
run_erl (edfe4b9)
* rz/fix-httpc-docs (inets) (2010-07-10) 2 commits
- Fix http client docs (294dfc0)
- Fix broken links in inets docs (7e417c3)
* sa/callback-attr (compiler, inets, kernel, otp, stdlib) (2010-06-08) 7 commits
- Add callback specs into 'application' module in kernel (b12de0a)
- Add callback specs to tftp module following internet documentation (2f27196)
- Add callback specs to inets_service module following possibly
deprecated comments (cc249ec)
- Add '-callback' attributes in stdlib's behaviours (6df97f4)
- Update primary bootstrap (c864c17)
- Automatical generation of 'behaviour_info' function from
'-callback' attributes (5b455e8)
- Add '-callback' attribute to language syntax (2f6c340)
* sb/make-files-like-erlc (tools) (2010-05-18) 1 commit
- Change make:files to behave more like erlc (5e9d051)
* sv/epmd-check-listen (erts) (2010-07-14) 1 commit
- check return value of epmd server listen() call (c5c8baa)
* ta/asn1-reporting (asn1) (2010-04-23) 1 commit
- asn1ct: Make formatting of errors and warnings consistent (93face2)
* ta/asn1ct-fix-whitespace (asn1) (2010-07-12) 1 commit
- asn1ct: change unusual whitespace char from 0xA0 to 0x20 (c43d20b)
* tj/ct-timestamp-granularity (common_test) (2010-07-13) 1 commit
- Include milliseconds in timestamps in Common Test log entries (4d18f18)
* uw/epmd-fullnames (kernel) (2010-05-07) 1 commit
- Allow the erlang nodename host part to differ from the hostname (e0774be)
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From pguyot@REDACTED Fri Aug 20 15:21:43 2010
From: pguyot@REDACTED (Paul Guyot)
Date: Fri, 20 Aug 2010 15:21:43 +0200
Subject: Fix crypto:rc4_encrypt_with_state/2 (Gmail SSL issue)
Message-ID:
Hello,
There is a simple bug in crypto:rc4_encrypt_with_state/2 NIF binding. As a result, RC4 stream cipher does not work, and one cannot connect to SSL servers that want to use an RC4 cipher suite (e.g. smtp.gmail.com).
The fix is available here, with a non-regression test:
git fetch git://github.com/pguyot/otp.git pg/fix-crypto-rc4_encrypt_with_state
http://github.com/pguyot/otp/commit/c1af26a59c46a6f9d295a0374326574157f6d8a5
Regards,
Paul
--
Semiocast http://semiocast.com/
+33.175000290 - 62 bis rue Gay-Lussac, 75005 Paris
From raimo+erlang-patches@REDACTED Fri Aug 20 15:25:18 2010
From: raimo+erlang-patches@REDACTED (Raimo Niskanen)
Date: Fri, 20 Aug 2010 15:25:18 +0200
Subject: [erlang-patches] gen_stream intermittent errors
In-Reply-To: <59567.76.79.190.165.1282153949.squirrel@s98814.gridserver.com>
References: <59567.76.79.190.165.1282153949.squirrel@s98814.gridserver.com>
Message-ID: <20100820132518.GA4857@erix.ericsson.se>
On Wed, Aug 18, 2010 at 10:52:29AM -0700, jay@REDACTED wrote:
> Recent 'pu' summary stated:
>
> * jn/gen_stream (stdlib) (2010-07-15) 2 commits
> - Track gen_stream processes directly for accurate test results (38a4083)
> - Patch dev to reproduce jn/gen_stream (7694a74)
>
> . Add new gen_stream behaviour for efficiently consuming serial
> streams (65f3db8)
>
> This topic branch has failing test cases.
>
> shell_SUITE:start_restricted_from_shell;
> We have now tested with and without this topic branch and when
> it is present that test case fails. We consider it proved
> to be guilty. The test case does not fail when run standalone
> so it seems to be tricky... Also, some of its own test cases
> fail sporadicly apparently since the assumption there shoul
> be no more processes after the test case does not hold;
> probably a timing issue.
>
> ------------------
>
> Is it really still having intermittent errors? I made a patch to correct
> the test results that doesn't depend on the number of running processes
> (it exposes an interface to report on the processes being used). It
> should no longer be giving any errors.
The failing test case are:
gen_stream_SUITE:block_buffers_file SLES10_debug, WinXP, Solaris10
=== location {gen_stream_SUITE,1325}
=== reason = no match of right hand side value
{proc_info,[{requested,2},
{active,2},
{pids,[<0.22755.2>,<0.22756.2>]}]}
in function gen_stream_SUITE:block_buffer_info/6
in call from gen_stream_SUITE:'-block_buffers_file/1-lc$^0/1-0-'/4
in call from gen_stream_SUITE:block_buffers_file/1
in call from test_server:my_apply/3
in call from test_server:ts_tc/3
in call from test_server:run_test_case_eval1/6
in call from test_server:run_test_case_eval/8
KindOf, the pids vary between platforms...
gen_stream_SUITE:num_buffers_file SLES10_debug, WinXP, Solaris10
=== location {gen_stream_SUITE,1258}
=== reason = no match of right hand side value
{proc_info,[{requested,2},
{active,2},
{pids,[<0.22650.2>,<0.22651.2>]}]}
in function gen_stream_SUITE:buffer_file_info/4
in call from gen_stream_SUITE:'-num_buffers_file/1-lc$^0/1-0-'/3
in call from gen_stream_SUITE:num_buffers_file/1
in call from test_server:my_apply/3
in call from test_server:ts_tc/3
in call from test_server:run_test_case_eval1/6
in call from test_server:run_test_case_eval/8
KindOf, the pids vary between platforms...
gen_stream_SUITE:num_procs_file WinXP
=== location {gen_stream_SUITE,1170}
=== reason = no match of right hand side value
{proc_info,[{requested,1},{active,1},{pids,[<0.22480.2>]}]}
in function gen_stream_SUITE:proc_file_info/4
in call from gen_stream_SUITE:'-num_procs_file/1-lc$^0/1-0-'/3
in call from gen_stream_SUITE:num_procs_file/1
in call from test_server:my_apply/3
in call from test_server:ts_tc/3
in call from test_server:run_test_case_eval1/6
in call from test_server:run_test_case_eval/8
>
> Is there any more information on the shell_SUITE issue. I added the
> failing line to the test cases to see what caused it to fail. If there is
> a shell failure it should isolate the exact test which is causing the
> failure.
shell_SUITE:start_restricted_from_shell All Platforms
=== location {shell_SUITE,122}
=== reason = timetrap timeout
>
> Just wanted to get the latest information on the results of the nightly
> test runs.
>
> jay
>
>
>
> ________________________________________________________________
> erlang-patches (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-patches-unsubscribe@REDACTED
--
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
From max.lapshin@REDACTED Fri Aug 20 15:25:49 2010
From: max.lapshin@REDACTED (Max Lapshin)
Date: Fri, 20 Aug 2010 17:25:49 +0400
Subject: [erlang-patches] Fix crypto:rc4_encrypt_with_state/2 (Gmail SSL issue)
In-Reply-To:
References:
Message-ID:
On Fri, Aug 20, 2010 at 5:21 PM, Paul Guyot wrote:
> Hello,
>
> There is a simple bug in crypto:rc4_encrypt_with_state/2 NIF binding. As a result, RC4 stream cipher does not work, and one cannot connect to SSL servers that want to use an RC4 cipher suite (e.g. smtp.gmail.com).
>
It looks like the problem, I've met, implementing RTMPE
From bgustavsson@REDACTED Fri Aug 20 15:39:20 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Fri, 20 Aug 2010 15:39:20 +0200
Subject: [erlang-bugs] Fix crypto:rc4_encrypt_with_state/2 (Gmail SSL issue)
In-Reply-To:
References:
Message-ID:
On Fri, Aug 20, 2010 at 3:21 PM, Paul Guyot wrote:
> Hello,
>
> There is a simple bug in crypto:rc4_encrypt_with_state/2 NIF binding. As a result, RC4 stream cipher does not work, and one cannot connect to SSL servers that want to use an RC4 cipher suite (e.g. smtp.gmail.com).
>
> The fix is available here, with a non-regression test:
> git fetch git://github.com/pguyot/otp.git pg/fix-crypto-rc4_encrypt_with_state
> http://github.com/pguyot/otp/commit/c1af26a59c46a6f9d295a0374326574157f6d8a5
Thanks! Included in pu.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From michael.santos@REDACTED Sun Aug 22 00:37:17 2010
From: michael.santos@REDACTED (Michael Santos)
Date: Sat, 21 Aug 2010 18:37:17 -0400
Subject: [PATCH] ei_connect: correct man page examples
Message-ID: <20100821223717.GA4290@ecn.lan>
---
lib/erl_interface/doc/src/ei_connect.xml | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/erl_interface/doc/src/ei_connect.xml b/lib/erl_interface/doc/src/ei_connect.xml
index 927395d..36dfb14 100644
--- a/lib/erl_interface/doc/src/ei_connect.xml
+++ b/lib/erl_interface/doc/src/ei_connect.xml
@@ -116,7 +116,7 @@
int n = 0;
struct in_addr addr;
ei_cnode ec;
-addr = inet_addr("150.236.14.75");
+addr.s_addr = inet_addr("150.236.14.75");
if (ei_connect_xinit(&ec,
"chivas",
"madonna",
@@ -132,7 +132,7 @@ if (ei_connect_xinit(&ec,
@@ -177,7 +177,7 @@ int fd = ei_connect(&ec, NODE);
/*** Variant 2 ***/
struct in_addr addr;
-addr = inet_addr(IP_ADDR);
+addr.s_addr = inet_addr(IP_ADDR);
fd = ei_xconnect(&ec, &addr, ALIVE);
]]>
--
1.7.0.4
From michael.santos@REDACTED Sun Aug 22 00:40:25 2010
From: michael.santos@REDACTED (Michael Santos)
Date: Sat, 21 Aug 2010 18:40:25 -0400
Subject: [PATCH] erl_call: fix multiple buffer overflows
Message-ID: <20100821224025.GA4331@ecn.lan>
Check operations that can overflow, e.g.,
erl_call -sname $(perl -e 'print "x"x5000')
perl -e 'print "-module(", "x"x10000, ");"' | erl_call -m -r -sname foo
---
lib/erl_interface/src/prog/erl_call.c | 132 +++++++++++++++++++++++----------
1 files changed, 93 insertions(+), 39 deletions(-)
diff --git a/lib/erl_interface/src/prog/erl_call.c b/lib/erl_interface/src/prog/erl_call.c
index 93b84cb..7b8ba2c 100644
--- a/lib/erl_interface/src/prog/erl_call.c
+++ b/lib/erl_interface/src/prog/erl_call.c
@@ -123,6 +123,10 @@ static int do_connect(ei_cnode *ec, char *nodename, struct call_flags *flags);
static int read_stdin(char **buf);
static void split_apply_string(char *str, char **mod,
char **fun, char **args);
+static void* my_malloc(size_t size);
+static void* my_calloc(size_t nmemb, size_t size);
+static void* my_realloc(void *old, size_t size);
+static char* my_strdup(char *s);
/***************************************************************************
@@ -132,7 +136,6 @@ static void split_apply_string(char *str, char **mod,
***************************************************************************/
/* FIXME isn't VxWorks to handle arguments differently? */
-/* FIXME check errors from malloc */
#if !defined(VXWORKS)
int main(int argc, char *argv[])
@@ -165,8 +168,7 @@ int erl_call(int argc, char **argv)
usage_arg(progname, "-sname ");
}
- flags.node = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.node, argv[i+1]);
+ flags.node = my_strdup(argv[i+1]);
i++;
flags.use_long_name = 0;
} else if (strcmp(argv[i], "-name") == 0) { /* -name NAME */
@@ -174,8 +176,7 @@ int erl_call(int argc, char **argv)
usage_arg(progname, "-name ");
}
- flags.node = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.node, argv[i+1]);
+ flags.node = my_strdup(argv[i+1]);
i++;
flags.use_long_name = 1;
} else {
@@ -210,16 +211,14 @@ int erl_call(int argc, char **argv)
usage_arg(progname, "-c ");
}
flags.cookiep = 1;
- flags.cookie = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.cookie, argv[i+1]);
+ flags.cookie = my_strdup(argv[i+1]);
i++;
break;
case 'n':
if (i+1 >= argc) {
usage_arg(progname, "-n ");
}
- flags.node = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.node, argv[i+1]);
+ flags.node = my_strdup(argv[i+1]);
flags.use_long_name = 1;
i++;
break;
@@ -227,24 +226,21 @@ int erl_call(int argc, char **argv)
if (i+1 >= argc) {
usage_arg(progname, "-h ");
}
- flags.hidden = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.hidden, argv[i+1]);
+ flags.hidden = my_strdup(argv[i+1]);
i++;
break;
case 'x':
if (i+1 >= argc) {
usage_arg(progname, "-x ");
}
- flags.script = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.script, argv[i+1]);
+ flags.script = my_strdup(argv[i+1]);
i++;
break;
case 'a':
if (i+1 >= argc) {
usage_arg(progname, "-a ");
}
- flags.apply = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.apply, argv[i+1]);
+ flags.apply = my_strdup(argv[i+1]);
i++;
break;
case '?':
@@ -304,8 +300,7 @@ int erl_call(int argc, char **argv)
if (flags.hidden == NULL) {
/* As default we are c17@REDACTED */
i = flags.randomp ? (time(NULL) % 997) : 17;
- /* FIXME allocates to small !!! */
- flags.hidden = (char *) malloc(3 + 2 ); /* c17 or cXYZ */
+ flags.hidden = (char *) my_malloc(10 + 2 ); /* c17 or cXYZ */
#if defined(VXWORKS)
sprintf(flags.hidden, "c%d",
i < 0 ? (int) taskIdSelf() : i);
@@ -330,17 +325,24 @@ int erl_call(int argc, char **argv)
initWinSock();
#endif
- gethostname(h_hostname, EI_MAXHOSTNAMELEN);
+ if (gethostname(h_hostname, EI_MAXHOSTNAMELEN) < 0) {
+ fprintf(stderr,"erl_call: failed to get host name: %d\n", errno);
+ exit(1);
+ }
if ((hp = ei_gethostbyname(h_hostname)) == 0) {
fprintf(stderr,"erl_call: can't resolve hostname %s\n", h_hostname);
exit(1);
}
- /* If shortnames cut of the name at first '.' */
+ /* If shortnames, cut off the name at first '.' */
if (flags.use_long_name == 0 && (ct = strchr(hp->h_name, '.')) != NULL) {
*ct = '\0';
}
- strcpy(h_hostname, hp->h_name);
+ strncpy(h_hostname, hp->h_name, EI_MAXHOSTNAMELEN);
memcpy(&h_ipadr.s_addr, *hp->h_addr_list, sizeof(struct in_addr));
+ if (strlen(h_alivename) + strlen(h_hostname) + 2 > sizeof(h_nodename)) {
+ fprintf(stderr,"erl_call: hostname too long: %s\n", h_hostname);
+ exit(1);
+ }
sprintf(h_nodename, "%s@%s", h_alivename, h_hostname);
if (ei_connect_xinit(&ec, h_hostname, h_alivename, h_nodename,
@@ -368,11 +370,15 @@ int erl_call(int argc, char **argv)
fprintf(stderr,"erl_call: can't get_hostent(%s)\n", host);
exit(1);
}
- /* If shortnames cut of the name at first '.' */
+ /* If shortnames, cut off the name at first '.' */
if (flags.use_long_name == 0 && (ct = strchr(hp->h_name, '.')) != NULL) {
*ct = '\0';
}
- strcpy(host_name, hp->h_name);
+ strncpy(host_name, hp->h_name, EI_MAXHOSTNAMELEN);
+ if (strlen(flags.node) + strlen(host_name) + 2 > sizeof(nodename)) {
+ fprintf(stderr,"erl_call: nodename too long: %s\n", flags.node);
+ exit(1);
+ }
sprintf(nodename, "%s@%s", flags.node, host_name);
/*
@@ -401,7 +407,7 @@ int erl_call(int argc, char **argv)
ei_encode_empty_list(NULL, &i);
- p = (char *)malloc(i);
+ p = (char *)my_malloc(i);
i = 0; /* Reset */
ei_encode_empty_list(p, &i);
@@ -426,6 +432,10 @@ int erl_call(int argc, char **argv)
if (flags.modp && (modname != NULL)) {
char fname[256];
+ if (strlen(modname) + 4 + 1 > sizeof(fname)) {
+ fprintf(stderr,"erl_call: module name too long: %s\n", modname);
+ exit(1);
+ }
strcpy(fname, modname);
strcat(fname, ".erl");
@@ -443,7 +453,7 @@ int erl_call(int argc, char **argv)
ei_encode_binary(NULL, &i, module, modsize);
ei_encode_empty_list(NULL, &i);
- p = (char *)malloc(i);
+ p = (char *)my_malloc(i);
i = 0; /* Reset */
ei_encode_list_header(p, &i, 2);
@@ -476,7 +486,7 @@ int erl_call(int argc, char **argv)
ei_encode_empty_list(NULL, &i);
ei_encode_empty_list(NULL, &i);
- p = (char *)malloc(i);
+ p = (char *)my_malloc(i);
i = 0; /* Reset */
ei_encode_list_header(p, &i, 2);
@@ -521,7 +531,7 @@ int erl_call(int argc, char **argv)
ei_encode_binary(NULL, &i, evalbuf, len);
ei_encode_empty_list(NULL, &i);
- p = (char *)malloc(i);
+ p = (char *)my_malloc(i);
i = 0; /* Reset */
ei_encode_list_header(p, &i, 1);
@@ -719,32 +729,28 @@ static void split_apply_string(char *str,
EAT(str);
len = str-begin;
- *mod = (char *) calloc(len + 1, sizeof(char));
+ *mod = (char *) my_calloc(len + 1, sizeof(char));
memcpy(*mod, begin, len);
SKIP_SPACE(str);
if (*str == '\0') {
- *fun = (char *) calloc(strlen(start)+1, sizeof(char));
- strcpy(*fun, start);
- *args = (char *) calloc(strlen(empty_list)+1, sizeof(char));
- strcpy(*args, empty_list);
+ *fun = my_strdup(start);
+ *args = my_strdup(empty_list);
return;
}
begin = str;
EAT(str);
len = str-begin;
- *fun = (char *) calloc(len + 1, sizeof(char));
+ *fun = (char *) my_calloc(len + 1, sizeof(char));
memcpy(*fun, begin, len);
SKIP_SPACE(str);
if (*str == '\0') {
- *args = (char *) calloc(strlen(empty_list)+1, sizeof(char));
- strcpy(*args, empty_list);
+ *args = my_strdup(empty_list);
return;
}
- *args = (char *) calloc(strlen(str) + 1, sizeof(char));
- strcpy(*args, str);
+ *args = my_strdup(str);
return;
@@ -760,7 +766,7 @@ static int read_stdin(char **buf)
int bsize = BUFSIZ;
int len = 0;
int i;
- char *tmp = (char *) malloc(bsize);
+ char *tmp = (char *) my_malloc(bsize);
while (1) {
if ((i = read(0, &tmp[len], bsize-len)) < 0) {
@@ -772,7 +778,7 @@ static int read_stdin(char **buf)
len += i;
if ((len+50) > bsize) {
bsize = len * 2;
- tmp = (char *) realloc(tmp, bsize);
+ tmp = (char *) my_realloc(tmp, bsize);
} else {
continue;
}
@@ -809,7 +815,7 @@ static int get_module(char **mbuf, char **mname)
}
} /* while */
i = tmp - start;
- *mname = (char *) calloc(i+1, sizeof(char));
+ *mname = (char *) my_calloc(i+1, sizeof(char));
memcpy(*mname, start, i);
}
if (*mbuf)
@@ -905,3 +911,51 @@ static void initWinSock(void)
}
}
#endif
+
+
+/***************************************************************************
+ *
+ * Utility functions
+ *
+ ***************************************************************************/
+
+static void* my_malloc(size_t size)
+{
+ void *p = malloc(size);
+ if (p == NULL) {
+ fprintf(stderr,"erl_call: insufficient memory\n");
+ exit(1);
+ }
+ return p;
+}
+
+static void* my_calloc(size_t nmemb, size_t size)
+{
+ void *p = calloc(nmemb, size);
+ if (p == NULL) {
+ fprintf(stderr,"erl_call: insufficient memory\n");
+ exit(1);
+ }
+ return p;
+}
+
+static void* my_realloc(void *old, size_t size)
+{
+ void *p = realloc(old, size);
+ if (!p) {
+ fprintf(stderr, "erl_call: cannot reallocate %u bytes of memory from %p\n",
+ (unsigned) size, old);
+ exit (1);
+ }
+ return p;
+}
+
+static char* my_strdup(char *s)
+{
+ char *p = strdup(s);
+ if (p == NULL) {
+ fprintf(stderr,"erl_call: insufficient memory\n");
+ exit(1);
+ }
+ return p;
+}
--
1.7.0.4
From andrew@REDACTED Sun Aug 22 03:14:59 2010
From: andrew@REDACTED (Andrew Thompson)
Date: Sat, 21 Aug 2010 21:14:59 -0400
Subject: [erlang-patches] Fix SSL bug when {packet, line} and list are set
In-Reply-To:
References: <20100818210529.4b922d1a@optd.heidelberg.local>
Message-ID: <20100822011459.GP18924@hijacked.us>
On Fri, Aug 20, 2010 at 03:02:04PM +0200, Bj??rn Gustavsson wrote:
> On Wed, Aug 18, 2010 at 9:05 PM, Thomas Lachmann
> wrote:
> > Hello,
> >
> > these patches correct the behaviour of the new ssl implementation, if
> > {packet, line} and mode list are set.
>
> Thanks! Will include in pu.
This bug broke my code on R14A, so I'd definitely recommend that it
makes it into R14B. The patch resolves the problem.
Andrew
From michael.santos@REDACTED Sun Aug 22 04:15:01 2010
From: michael.santos@REDACTED (Michael Santos)
Date: Sat, 21 Aug 2010 22:15:01 -0400
Subject: [PATCH] ei: prevent overflow in ei_connect_init/ei_xconnect
Message-ID: <20100822021501.GA4684@ecn.lan>
Check the length of the buffer before copying.
ei_cnode ec;
struct in_addr addr;
char *node = (char *)calloc(5001, 1);
(void)memset(node, 'x', 5000);
ei_connect_init(&ec, node, "", 0);
addr.s_addr = inet_addr("192.168.1.1");
ei_xconnect(&ec, &addr, node);
---
lib/erl_interface/src/connect/ei_connect.c | 8 ++++++--
lib/erl_interface/src/epmd/epmd_port.c | 12 ++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/lib/erl_interface/src/connect/ei_connect.c b/lib/erl_interface/src/connect/ei_connect.c
index b1b79aa..e191f3f 100644
--- a/lib/erl_interface/src/connect/ei_connect.c
+++ b/lib/erl_interface/src/connect/ei_connect.c
@@ -502,10 +502,14 @@ int ei_connect_init(ei_cnode* ec, const char* this_node_name,
return ERL_ERROR;
}
- if (this_node_name == NULL)
+ if (this_node_name == NULL) {
sprintf(thisalivename, "c%d", (int) getpid());
- else
+ } else if (strlen(this_node_name) >= sizeof(thisalivename)) {
+ EI_TRACE_ERR0("ei_connect_init","ERROR: this_node_name too long");
+ return ERL_ERROR;
+ } else {
strcpy(thisalivename, this_node_name);
+ }
if ((hp = ei_gethostbyname(thishostname)) == 0) {
/* Looking up IP given hostname fails. We must be on a standalone
diff --git a/lib/erl_interface/src/epmd/epmd_port.c b/lib/erl_interface/src/epmd/epmd_port.c
index 663b38d..cf6122f 100644
--- a/lib/erl_interface/src/epmd/epmd_port.c
+++ b/lib/erl_interface/src/epmd/epmd_port.c
@@ -106,6 +106,12 @@ static int ei_epmd_r3_port (struct in_addr *addr, const char *alive,
char ntoabuf[32];
#endif
+ if (len > sizeof(buf) - 3)
+ {
+ erl_errno = ERANGE;
+ return -1;
+ }
+
put16be(s,len);
put8(s,EI_EPMD_PORT_REQ);
strcpy(s,alive);
@@ -164,6 +170,12 @@ static int ei_epmd_r4_port (struct in_addr *addr, const char *alive,
#if defined(VXWORKS)
char ntoabuf[32];
#endif
+
+ if (len > sizeof(buf) - 3)
+ {
+ erl_errno = ERANGE;
+ return -1;
+ }
put16be(s,len);
put8(s,EI_EPMD_PORT2_REQ);
--
1.7.0.4
From andrew@REDACTED Sun Aug 22 07:04:58 2010
From: andrew@REDACTED (Andrew Thompson)
Date: Sun, 22 Aug 2010 01:04:58 -0400
Subject: [erlang-patches] Fix searching for source files in cover:analyse_to_file/*
In-Reply-To:
References:
Message-ID: <20100822050458.GQ18924@hijacked.us>
This patch breaks current behaviour of cover:analyse_to_file.
Consider the following case. I have src/wtf.erl compiled to
debug_ebin/wtf.beam. I'm running cover from the parent directory of
these 2 directories, lets call it /home/andrew/project.
The new function; path_in_beam is run on debug_ebin/wtf.beam and it
returns "src/wtf.erl", is a relative path.
filelib:is_file() is run on the result and, in our case, returns true.
Thus we hit the {ok, Path} of the case in find_source(). Where the bug
comes in is that the code blindly gets the dirname of the .beam file (in
this case "/home/andrew/project/debug_ebin" and appends the path from
the beam, yielding the path
"/home/andrew/project/debug_ebin/src/wtf.erl". This path is obviously
garbage and thus cover_analyze_to_file fails.
The simplest fix is simply to return Path from that case clause, and not
use filename:dirname and filename:join at all. Since the other function
checks if the file is a valid path from pwd() that should never fail.
I'm not really seeing the usefulness of this patch overall, though,
since the file source is relative so in the vast majority of cases it
will be useless. To check it first (and incompletely at that) seems
like a bad idea.
Either way, this patch should not graduate in its current state.
Andrew
From daniel.neri@REDACTED Sun Aug 22 21:50:22 2010
From: daniel.neri@REDACTED (=?ISO-8859-1?Q?Daniel_N=E9ri?=)
Date: Sun, 22 Aug 2010 21:50:22 +0200
Subject: [erlang-patches] [PATCH] erl_call: fix multiple buffer overflows
In-Reply-To: <20100821224025.GA4331@ecn.lan>
References: <20100821224025.GA4331@ecn.lan>
Message-ID:
Hello,
On Sun, Aug 22, 2010 at 00:40, Michael Santos wrote:
>
> - ? ? ?strcpy(h_hostname, hp->h_name);
> + ? ? ?strncpy(h_hostname, hp->h_name, EI_MAXHOSTNAMELEN);
> ? ? ? memcpy(&h_ipadr.s_addr, *hp->h_addr_list, sizeof(struct in_addr));
> + ? ? ?if (strlen(h_alivename) + strlen(h_hostname) + 2 > sizeof(h_nodename)) {
> + ? ? ? ? fprintf(stderr,"erl_call: hostname too long: %s\n", h_hostname);
> + ? ? ? ? exit(1);
> + ? ? ?}
[cut]
> - strcpy(host_name, hp->h_name);
> + strncpy(host_name, hp->h_name, EI_MAXHOSTNAMELEN);
> + if (strlen(flags.node) + strlen(host_name) + 2 > sizeof(nodename)) {
> + fprintf(stderr,"erl_call: nodename too long: %s\n", flags.node);
> + exit(1);
> + }
Beware that strncpy (being broken by design) leaves off the
terminating '\0' when the destination buffer isn't large enough, so
you need to make sure that 'h_hostname' and 'host_name' are properly
null-terminated here. Or see [*] for a better solution.
Regards,
Daniel
[*] http://en.wikipedia.org/wiki/Strlcpy
From michael.santos@REDACTED Sun Aug 22 23:04:02 2010
From: michael.santos@REDACTED (Michael Santos)
Date: Sun, 22 Aug 2010 17:04:02 -0400
Subject: [erlang-patches] [PATCH] erl_call: fix multiple buffer
overflows
In-Reply-To:
References: <20100821224025.GA4331@ecn.lan>
Message-ID: <20100822210402.GA5902@ecn.lan>
On Sun, Aug 22, 2010 at 09:50:22PM +0200, Daniel N?ri wrote:
> Beware that strncpy (being broken by design) leaves off the
> terminating '\0' when the destination buffer isn't large enough, so
> you need to make sure that 'h_hostname' and 'host_name' are properly
> null-terminated here.
Thanks! You are right, of course. I was sure the final extra byte of
the buffer had been null terminated somewhere in the preceeding code ...
I'll send out an updated patch.
> Or see [*] for a better solution.
>
> [*] http://en.wikipedia.org/wiki/Strlcpy
strlcpy is cool, but unfortunately not so portable.
Thanks for catching that!
From michael.santos@REDACTED Sun Aug 22 23:05:29 2010
From: michael.santos@REDACTED (Michael Santos)
Date: Sun, 22 Aug 2010 17:05:29 -0400
Subject: [PATCH] erl_call: fix multiple buffer overflows
Message-ID: <20100822210529.GA6635@ecn.lan>
Check operations that can overflow, e.g.,
erl_call -sname $(perl -e 'print "x"x5000')
perl -e 'print "-module(", "x"x10000, ");"' | erl_call -m -r -sname foo
---
lib/erl_interface/src/prog/erl_call.c | 134 +++++++++++++++++++++++----------
1 files changed, 95 insertions(+), 39 deletions(-)
diff --git a/lib/erl_interface/src/prog/erl_call.c b/lib/erl_interface/src/prog/erl_call.c
index 93b84cb..aa4b2b4 100644
--- a/lib/erl_interface/src/prog/erl_call.c
+++ b/lib/erl_interface/src/prog/erl_call.c
@@ -123,6 +123,10 @@ static int do_connect(ei_cnode *ec, char *nodename, struct call_flags *flags);
static int read_stdin(char **buf);
static void split_apply_string(char *str, char **mod,
char **fun, char **args);
+static void* my_malloc(size_t size);
+static void* my_calloc(size_t nmemb, size_t size);
+static void* my_realloc(void *old, size_t size);
+static char* my_strdup(char *s);
/***************************************************************************
@@ -132,7 +136,6 @@ static void split_apply_string(char *str, char **mod,
***************************************************************************/
/* FIXME isn't VxWorks to handle arguments differently? */
-/* FIXME check errors from malloc */
#if !defined(VXWORKS)
int main(int argc, char *argv[])
@@ -165,8 +168,7 @@ int erl_call(int argc, char **argv)
usage_arg(progname, "-sname ");
}
- flags.node = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.node, argv[i+1]);
+ flags.node = my_strdup(argv[i+1]);
i++;
flags.use_long_name = 0;
} else if (strcmp(argv[i], "-name") == 0) { /* -name NAME */
@@ -174,8 +176,7 @@ int erl_call(int argc, char **argv)
usage_arg(progname, "-name ");
}
- flags.node = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.node, argv[i+1]);
+ flags.node = my_strdup(argv[i+1]);
i++;
flags.use_long_name = 1;
} else {
@@ -210,16 +211,14 @@ int erl_call(int argc, char **argv)
usage_arg(progname, "-c ");
}
flags.cookiep = 1;
- flags.cookie = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.cookie, argv[i+1]);
+ flags.cookie = my_strdup(argv[i+1]);
i++;
break;
case 'n':
if (i+1 >= argc) {
usage_arg(progname, "-n ");
}
- flags.node = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.node, argv[i+1]);
+ flags.node = my_strdup(argv[i+1]);
flags.use_long_name = 1;
i++;
break;
@@ -227,24 +226,21 @@ int erl_call(int argc, char **argv)
if (i+1 >= argc) {
usage_arg(progname, "-h ");
}
- flags.hidden = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.hidden, argv[i+1]);
+ flags.hidden = my_strdup(argv[i+1]);
i++;
break;
case 'x':
if (i+1 >= argc) {
usage_arg(progname, "-x ");
}
- flags.script = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.script, argv[i+1]);
+ flags.script = my_strdup(argv[i+1]);
i++;
break;
case 'a':
if (i+1 >= argc) {
usage_arg(progname, "-a ");
}
- flags.apply = (char *) malloc(strlen(argv[i+1]) + 1);
- strcpy(flags.apply, argv[i+1]);
+ flags.apply = my_strdup(argv[i+1]);
i++;
break;
case '?':
@@ -304,8 +300,7 @@ int erl_call(int argc, char **argv)
if (flags.hidden == NULL) {
/* As default we are c17@REDACTED */
i = flags.randomp ? (time(NULL) % 997) : 17;
- /* FIXME allocates to small !!! */
- flags.hidden = (char *) malloc(3 + 2 ); /* c17 or cXYZ */
+ flags.hidden = (char *) my_malloc(10 + 2 ); /* c17 or cXYZ */
#if defined(VXWORKS)
sprintf(flags.hidden, "c%d",
i < 0 ? (int) taskIdSelf() : i);
@@ -330,17 +325,25 @@ int erl_call(int argc, char **argv)
initWinSock();
#endif
- gethostname(h_hostname, EI_MAXHOSTNAMELEN);
+ if (gethostname(h_hostname, EI_MAXHOSTNAMELEN) < 0) {
+ fprintf(stderr,"erl_call: failed to get host name: %d\n", errno);
+ exit(1);
+ }
if ((hp = ei_gethostbyname(h_hostname)) == 0) {
fprintf(stderr,"erl_call: can't resolve hostname %s\n", h_hostname);
exit(1);
}
- /* If shortnames cut of the name at first '.' */
+ /* If shortnames, cut off the name at first '.' */
if (flags.use_long_name == 0 && (ct = strchr(hp->h_name, '.')) != NULL) {
*ct = '\0';
}
- strcpy(h_hostname, hp->h_name);
+ strncpy(h_hostname, hp->h_name, EI_MAXHOSTNAMELEN);
+ h_hostname[EI_MAXHOSTNAMELEN] = '\0';
memcpy(&h_ipadr.s_addr, *hp->h_addr_list, sizeof(struct in_addr));
+ if (strlen(h_alivename) + strlen(h_hostname) + 2 > sizeof(h_nodename)) {
+ fprintf(stderr,"erl_call: hostname too long: %s\n", h_hostname);
+ exit(1);
+ }
sprintf(h_nodename, "%s@%s", h_alivename, h_hostname);
if (ei_connect_xinit(&ec, h_hostname, h_alivename, h_nodename,
@@ -368,11 +371,16 @@ int erl_call(int argc, char **argv)
fprintf(stderr,"erl_call: can't get_hostent(%s)\n", host);
exit(1);
}
- /* If shortnames cut of the name at first '.' */
+ /* If shortnames, cut off the name at first '.' */
if (flags.use_long_name == 0 && (ct = strchr(hp->h_name, '.')) != NULL) {
*ct = '\0';
}
- strcpy(host_name, hp->h_name);
+ strncpy(host_name, hp->h_name, EI_MAXHOSTNAMELEN);
+ host_name[EI_MAXHOSTNAMELEN] = '\0';
+ if (strlen(flags.node) + strlen(host_name) + 2 > sizeof(nodename)) {
+ fprintf(stderr,"erl_call: nodename too long: %s\n", flags.node);
+ exit(1);
+ }
sprintf(nodename, "%s@%s", flags.node, host_name);
/*
@@ -401,7 +409,7 @@ int erl_call(int argc, char **argv)
ei_encode_empty_list(NULL, &i);
- p = (char *)malloc(i);
+ p = (char *)my_malloc(i);
i = 0; /* Reset */
ei_encode_empty_list(p, &i);
@@ -426,6 +434,10 @@ int erl_call(int argc, char **argv)
if (flags.modp && (modname != NULL)) {
char fname[256];
+ if (strlen(modname) + 4 + 1 > sizeof(fname)) {
+ fprintf(stderr,"erl_call: module name too long: %s\n", modname);
+ exit(1);
+ }
strcpy(fname, modname);
strcat(fname, ".erl");
@@ -443,7 +455,7 @@ int erl_call(int argc, char **argv)
ei_encode_binary(NULL, &i, module, modsize);
ei_encode_empty_list(NULL, &i);
- p = (char *)malloc(i);
+ p = (char *)my_malloc(i);
i = 0; /* Reset */
ei_encode_list_header(p, &i, 2);
@@ -476,7 +488,7 @@ int erl_call(int argc, char **argv)
ei_encode_empty_list(NULL, &i);
ei_encode_empty_list(NULL, &i);
- p = (char *)malloc(i);
+ p = (char *)my_malloc(i);
i = 0; /* Reset */
ei_encode_list_header(p, &i, 2);
@@ -521,7 +533,7 @@ int erl_call(int argc, char **argv)
ei_encode_binary(NULL, &i, evalbuf, len);
ei_encode_empty_list(NULL, &i);
- p = (char *)malloc(i);
+ p = (char *)my_malloc(i);
i = 0; /* Reset */
ei_encode_list_header(p, &i, 1);
@@ -719,32 +731,28 @@ static void split_apply_string(char *str,
EAT(str);
len = str-begin;
- *mod = (char *) calloc(len + 1, sizeof(char));
+ *mod = (char *) my_calloc(len + 1, sizeof(char));
memcpy(*mod, begin, len);
SKIP_SPACE(str);
if (*str == '\0') {
- *fun = (char *) calloc(strlen(start)+1, sizeof(char));
- strcpy(*fun, start);
- *args = (char *) calloc(strlen(empty_list)+1, sizeof(char));
- strcpy(*args, empty_list);
+ *fun = my_strdup(start);
+ *args = my_strdup(empty_list);
return;
}
begin = str;
EAT(str);
len = str-begin;
- *fun = (char *) calloc(len + 1, sizeof(char));
+ *fun = (char *) my_calloc(len + 1, sizeof(char));
memcpy(*fun, begin, len);
SKIP_SPACE(str);
if (*str == '\0') {
- *args = (char *) calloc(strlen(empty_list)+1, sizeof(char));
- strcpy(*args, empty_list);
+ *args = my_strdup(empty_list);
return;
}
- *args = (char *) calloc(strlen(str) + 1, sizeof(char));
- strcpy(*args, str);
+ *args = my_strdup(str);
return;
@@ -760,7 +768,7 @@ static int read_stdin(char **buf)
int bsize = BUFSIZ;
int len = 0;
int i;
- char *tmp = (char *) malloc(bsize);
+ char *tmp = (char *) my_malloc(bsize);
while (1) {
if ((i = read(0, &tmp[len], bsize-len)) < 0) {
@@ -772,7 +780,7 @@ static int read_stdin(char **buf)
len += i;
if ((len+50) > bsize) {
bsize = len * 2;
- tmp = (char *) realloc(tmp, bsize);
+ tmp = (char *) my_realloc(tmp, bsize);
} else {
continue;
}
@@ -809,7 +817,7 @@ static int get_module(char **mbuf, char **mname)
}
} /* while */
i = tmp - start;
- *mname = (char *) calloc(i+1, sizeof(char));
+ *mname = (char *) my_calloc(i+1, sizeof(char));
memcpy(*mname, start, i);
}
if (*mbuf)
@@ -905,3 +913,51 @@ static void initWinSock(void)
}
}
#endif
+
+
+/***************************************************************************
+ *
+ * Utility functions
+ *
+ ***************************************************************************/
+
+static void* my_malloc(size_t size)
+{
+ void *p = malloc(size);
+ if (p == NULL) {
+ fprintf(stderr,"erl_call: insufficient memory\n");
+ exit(1);
+ }
+ return p;
+}
+
+static void* my_calloc(size_t nmemb, size_t size)
+{
+ void *p = calloc(nmemb, size);
+ if (p == NULL) {
+ fprintf(stderr,"erl_call: insufficient memory\n");
+ exit(1);
+ }
+ return p;
+}
+
+static void* my_realloc(void *old, size_t size)
+{
+ void *p = realloc(old, size);
+ if (!p) {
+ fprintf(stderr, "erl_call: cannol reallocate %u bytes of memory from %p\n",
+ (unsigned) size, old);
+ exit (1);
+ }
+ return p;
+}
+
+static char* my_strdup(char *s)
+{
+ char *p = strdup(s);
+ if (p == NULL) {
+ fprintf(stderr,"erl_call: insufficient memory\n");
+ exit(1);
+ }
+ return p;
+}
--
1.7.0.4
From raimo+erlang-patches@REDACTED Mon Aug 23 09:44:02 2010
From: raimo+erlang-patches@REDACTED (Raimo Niskanen)
Date: Mon, 23 Aug 2010 09:44:02 +0200
Subject: [erlang-patches] gen_stream intermittent errors
In-Reply-To: <54263.64.81.32.114.1282490484.squirrel@duomark.com>
References: <59567.76.79.190.165.1282153949.squirrel@s98814.gridserver.com> <20100820132518.GA4857@erix.ericsson.se> <54263.64.81.32.114.1282490484.squirrel@duomark.com>
Message-ID: <20100823074402.GA6104@erix.ericsson.se>
On Sun, Aug 22, 2010 at 08:21:24AM -0700, jay@REDACTED wrote:
> In the 3 failing test cases below, the problem is a timing issue.
> Internally, the gen_stream has sent a {stop} message to all the children
> workers. The result of requesting 'proc_info' is a property list of the
> number of procs requested to run, the number still active and the actual
> pids of the processes. In all the 3 cases the expected value for active
> is 0.
>
> The bad match is because the workers have not yet been given a time slice
> to match their message queue and self-stop because of the {stop} message.
>
> What is the proper way to give other procs a chance to run and consume
> their message queue in a test suite, before requesting the 'proc_info'
> results?
The question is if the problem should be solved in the test suite
or in the {stop} handshake (there seem to be no handshake today)?
By looping over the list orig_procs with is_process_alive/1 there
are inherent race conditions since you can not know if a process
is on the way down or not.
You either write an explicit handshake where the process receiving
{stop} replies, or process sending {stop} can use erlang:monitor/2
to ensure the stopped process has stopped.
I have not had time to dig into and understand the gen_stream code.
If there should be a handshake for {stop} and if it should be
through monitor depends on if one gen_stream can be stopped
from several others. It is a design question; how is a
gen_stream state defined and how can other gen_streams
know the state? Think distributed. If gen_streams are on
different nodes, what happens then?
To solve this problem only in the test suite sounds like sweeping
a real problem under the rug, but I am not certain about it.
You can e.g use erlang:monitor/2 to observe the processes going
down before calling gen_stream:proc_info/1, or by delay
repeate until it replies correctly.
>
> jay
>
> > The failing test case are:
> >
> > gen_stream_SUITE:block_buffers_file SLES10_debug, WinXP, Solaris10
> > === location {gen_stream_SUITE,1325}
> > === reason = no match of right hand side value
> > {proc_info,[{requested,2},
> > {active,2},
> > {pids,[<0.22755.2>,<0.22756.2>]}]}
>
> > gen_stream_SUITE:num_buffers_file SLES10_debug, WinXP, Solaris10
> > === location {gen_stream_SUITE,1258}
> > === reason = no match of right hand side value
> > {proc_info,[{requested,2},
> > {active,2},
> > {pids,[<0.22650.2>,<0.22651.2>]}]}
>
> > gen_stream_SUITE:num_procs_file WinXP
> > === location {gen_stream_SUITE,1170}
> > === reason = no match of right hand side value
> > {proc_info,[{requested,1},{active,1},{pids,[<0.22480.2>]}]}
>
--
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
From bgustavsson@REDACTED Mon Aug 23 14:09:31 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Mon, 23 Aug 2010 14:09:31 +0200
Subject: [erlang-patches] Fix searching for source files in cover:analyse_to_file/*
In-Reply-To: <20100822050458.GQ18924@hijacked.us>
References:
<20100822050458.GQ18924@hijacked.us>
Message-ID:
On Sun, Aug 22, 2010 at 7:04 AM, Andrew Thompson wrote:
[...]
>
> Either way, this patch should not graduate in its current state.
>
Thanks for the review. I will set the branch in the "Stalled" state
in the next What's cooking email.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From bgustavsson@REDACTED Mon Aug 23 16:00:44 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Mon, 23 Aug 2010 16:00:44 +0200
Subject: [erlang-patches] [PATCH] ei_connect: correct man page examples
In-Reply-To: <20100821223717.GA4290@ecn.lan>
References: <20100821223717.GA4290@ecn.lan>
Message-ID:
On Sun, Aug 22, 2010 at 12:37 AM, Michael Santos
wrote:
> ---
> lib/erl_interface/doc/src/ei_connect.xml | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
Thanks! Will include in pu.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From bgustavsson@REDACTED Mon Aug 23 16:03:48 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Mon, 23 Aug 2010 16:03:48 +0200
Subject: [erlang-patches] [PATCH] ei: prevent overflow in ei_connect_init/ei_xconnect
In-Reply-To: <20100822021501.GA4684@ecn.lan>
References: <20100822021501.GA4684@ecn.lan>
Message-ID:
On Sun, Aug 22, 2010 at 4:15 AM, Michael Santos
wrote:
> Check the length of the buffer before copying.
>
> ei_cnode ec;
> struct in_addr addr;
> char *node = (char *)calloc(5001, 1);
> (void)memset(node, 'x', 5000);
>
> ei_connect_init(&ec, node, "", 0);
>
> addr.s_addr = inet_addr("192.168.1.1");
> ei_xconnect(&ec, &addr, node);
> ---
> lib/erl_interface/src/connect/ei_connect.c | 8 ++++++--
> lib/erl_interface/src/epmd/epmd_port.c | 12 ++++++++++++
> 2 files changed, 18 insertions(+), 2 deletions(-)
>
Thanks! Will include in pu.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From bgustavsson@REDACTED Mon Aug 23 16:07:06 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Mon, 23 Aug 2010 16:07:06 +0200
Subject: [erlang-patches] Fix searching for source files in cover:analyse_to_file/*
In-Reply-To: <365505872-1282566084-cardhu_decombobulator_blackberry.rim.net-1736452455-@bda521.bisx.prod.on.blackberry>
References: <365505872-1282566084-cardhu_decombobulator_blackberry.rim.net-1736452455-@bda521.bisx.prod.on.blackberry>
Message-ID:
2010/8/23 :
> I'm not likely to make any updates to this patch. Feel free to drop it.
OK. Thanks for replying. I will drop it.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From bgustavsson@REDACTED Mon Aug 23 16:09:53 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Mon, 23 Aug 2010 16:09:53 +0200
Subject: [erlang-patches] [PATCH] erl_call: fix multiple buffer overflows
In-Reply-To: <20100822210529.GA6635@ecn.lan>
References: <20100822210529.GA6635@ecn.lan>
Message-ID:
On Sun, Aug 22, 2010 at 11:05 PM, Michael Santos
wrote:
> Check operations that can overflow, e.g.,
>
> erl_call -sname $(perl -e 'print "x"x5000')
> perl -e 'print "-module(", "x"x10000, ");"' | erl_call -m -r -sname foo
> ---
> lib/erl_interface/src/prog/erl_call.c | 134 +++++++++++++++++++++++----------
> 1 files changed, 95 insertions(+), 39 deletions(-)
>
Thanks! Will include in pu.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From jay@REDACTED Mon Aug 23 18:13:43 2010
From: jay@REDACTED (jay@REDACTED)
Date: Mon, 23 Aug 2010 09:13:43 -0700 (PDT)
Subject: Dev not building
Message-ID: <55342.64.81.32.114.1282580023.squirrel@duomark.com>
I get the following error after pulling the latest dev:
make[5]: *** No rule to make target
`obj/powerpc-apple-darwin9.8.0/opt/r/ethr_event.o', needed by
`../lib/internal/powerpc-apple-darwin9.8.0/libethread.a'. Stop.
make[4]: *** [opt] Error 2
make[3]: *** [erts_lib] Error 2
make[2]: *** [opt] Error 2
make[1]: *** [smp] Error 2
make: *** [emulator] Error 2
Is this a known broken build, something in my environment (Mac OS X
10.5.8), or did I not get a complete baseline?
jay
From rickard@REDACTED Mon Aug 23 19:25:11 2010
From: rickard@REDACTED (Rickard Green)
Date: Mon, 23 Aug 2010 19:25:11 +0200
Subject: [erlang-patches] Dev not building
In-Reply-To: <55342.64.81.32.114.1282580023.squirrel@duomark.com>
References: <55342.64.81.32.114.1282580023.squirrel@duomark.com>
Message-ID:
Our daily builds on MacOSX succeeds. Try cleaning your source tree.
'make clean' in the erts directory will probably be sufficient. If
not, 'git clean -dfx' makes your source tree completely clean (make
sure you haven't got any untracked files in the source tree that you
want to keep before doing this).
Regards,
Rickard Green, Erlang/OTP, Ericsson AB.
2010/8/23 :
> I get the following error after pulling the latest dev:
>
>
> make[5]: *** No rule to make target
> `obj/powerpc-apple-darwin9.8.0/opt/r/ethr_event.o', needed by
> `../lib/internal/powerpc-apple-darwin9.8.0/libethread.a'. Stop.
> make[4]: *** [opt] Error 2
> make[3]: *** [erts_lib] Error 2
> make[2]: *** [opt] Error 2
> make[1]: *** [smp] Error 2
> make: *** [emulator] Error 2
>
>
> Is this a known broken build, something in my environment (Mac OS X
> 10.5.8), or did I not get a complete baseline?
>
> jay
>
>
>
> ________________________________________________________________
> erlang-patches (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-patches-unsubscribe@REDACTED
>
>
From raimo+erlang-patches@REDACTED Tue Aug 24 16:21:05 2010
From: raimo+erlang-patches@REDACTED (Raimo Niskanen)
Date: Tue, 24 Aug 2010 16:21:05 +0200
Subject: [erlang-patches] gen_stream intermittent errors
In-Reply-To: <37752.64.81.32.110.1282575780.squirrel@s98814.gridserver.com>
References: <59567.76.79.190.165.1282153949.squirrel@s98814.gridserver.com> <20100820132518.GA4857@erix.ericsson.se> <54263.64.81.32.114.1282490484.squirrel@duomark.com> <20100823074402.GA6104@erix.ericsson.se> <37752.64.81.32.110.1282575780.squirrel@s98814.gridserver.com>
Message-ID: <20100824142105.GA10929@erix.ericsson.se>
On Mon, Aug 23, 2010 at 08:03:00AM -0700, jay@REDACTED wrote:
> >
> > The question is if the problem should be solved in the test suite
> > or in the {stop} handshake (there seem to be no handshake today)?
>
> The {stop} message is internal to a single opaque gen_stream instance. It
> is a cast message to the self-spawned and owned internal processes
> delivering the stream in parallel, and is sent on first detection of
> 'end_of_stream' internal to the gen_stream process.
>
> >
> > By looping over the list orig_procs with is_process_alive/1 there
> > are inherent race conditions since you can not know if a process
> > is on the way down or not.
> >
> > You either write an explicit handshake where the process receiving
> > {stop} replies, or process sending {stop} can use erlang:monitor/2
> > to ensure the stopped process has stopped.
>
> These problems are merely test suite artifacts of my own creation in
> trying to make the test suite thorough enough to prove the code works. I
> am just trying to show that when a gen_stream starts it will spin up the
> requested number of processes, and when the stream reaches completion, the
> processes are no longer running. I could provide no such guarantee, and
> just say that when you stop the gen_stream all linked internal processes
> will die.
Ok.
>
> >
> > I have not had time to dig into and understand the gen_stream code.
> > If there should be a handshake for {stop} and if it should be
> > through monitor depends on if one gen_stream can be stopped
> > from several others. It is a design question; how is a
> > gen_stream state defined and how can other gen_streams
> > know the state? Think distributed. If gen_streams are on
> > different nodes, what happens then?
>
> The initial implementation of gen_stream is to provide multi-core benefits
> by reading a serial stream using multiple processes on the same node. The
> serial data is striped across the local processes so that a single logical
> buffer is generated by the user-requested number of processes internally.
>
> When client callers do a gen_stream:next call, the next serial chunk of
> the stream is served from an internal process and the counter is
> incremented so that a different process will serve the next chunk.
>
> When the last chunk of the entire stream is served, internally I cast a
> message to all internal process to stop executing. Continued calls to
> gen_stream:next just return 'end_of_stream' directly from the parent
> gen_server with complete ignorance as to whether the internal worker
> processes are still alive. All internal processes are linked to the
> parent gen_server / gen_stream process, so they will get cleaned up if the
> parent is terminated.
>
> I foolishly added a check to the test suite to see that once
> 'end_of_stream' is being returned, the internal processes should have
> terminated. I wanted to prove there is no process leakage during the time
> between end_of_stream and when the parent process is terminated.
That is a very good test! I wish we had more of those.
We have process counting in some test suites, and if your
leaves behind stray processes it could annoy later suites...
>
> >
> > To solve this problem only in the test suite sounds like sweeping
> > a real problem under the rug, but I am not certain about it.
> > You can e.g use erlang:monitor/2 to observe the processes going
> > down before calling gen_stream:proc_info/1, or by delay
> > repeate until it replies correctly.
> >
>
> I really never even wanted to expose the proc_info interface (as there is
> no way to later hide it), since the user should neither access nor
> communicate with the internal processes, but I was intent on having
> thorough testing to get it through the review process.
I aggree on your first approach here. Exposing internals just for testing
is seldom a good idea.
>
> Should I leave this approach in, call proc_info and do a busy wait on the
> monitors for a few seconds? Or should I remove the portion of the tests
> which count the number of processes internal to the opaque gen_stream
> process?
How about removing proc_info, use the known fact that the workers are linked
and write an utility function in the test suite that uses
erlang:process_info(GenStream, links) to (filter out the parent of GenStream)
check if all workers are gone, and busy wait with one second delay over it.
Let the test suite timeout detect a failure.
>
> jay
>
--
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
From ingela@REDACTED Tue Aug 24 16:47:41 2010
From: ingela@REDACTED (Ingela Anderton Andin)
Date: Tue, 24 Aug 2010 16:47:41 +0200
Subject: [erlang-patches] Fix SSL bug when {packet, line} and list are
set
In-Reply-To: <20100818210529.4b922d1a@optd.heidelberg.local>
References: <20100818210529.4b922d1a@optd.heidelberg.local>
Message-ID: <4C73DB8D.6090901@erix.ericsson.se>
Hi!
Thank you for reporting this. We will not take the patch as is, because
you are right it does
not fix the whole problem. Instead we have made the following patch:
--- a/lib/ssl/src/ssl_connection.erl
+++ b/lib/ssl/src/ssl_connection.erl
@@ -1738,12 +1738,13 @@ format_packet_error(#socket_options{active = _,
mode = Mode}, Data) ->
format_reply(binary, _, N, Data) when N > 0 -> % Header mode
header(N, Data);
-format_reply(binary, _, _, Data) -> Data;
+format_reply(binary, _, _, Data) ->
+ Data;
format_reply(list, Packet, _, Data)
- when is_integer(Packet); Packet == raw; Packet == line ->
- binary_to_list(Data);
-format_reply(list, _,_, Data) ->
- Data.
+ when Packet == http; Packet == {http, headers}; Packet == http_bin;
Packet == {http_bin, headers} ->
+ Data;
+format_reply(list, _,_, Data) ->
+ binary_to_list(Data).
header(0, <<>>) ->
<<>>;
And add appropriate test cases not listed in this mail.
Regards Ingela Erlang/OTP team - Ericsson AB
Thomas Lachmann wrote:
> Hello,
>
> these patches correct the behaviour of the new ssl implementation, if
> {packet, line} and mode list are set.
> Previously the returned type was a binary.
>
> The first patch changes the test ssl_packet_SUITE:packet_line_decode
> to check for both cases packet line combined with mode binary and packet
> line combined with mode list.
>
> The second patch corrects the error.
>
> I suspect the packet formats asn1, cdr, sunrm, fcgi and tpkt to suffer
> the same problem. But as I don't know these formats, I don't know if
> there are reasonable representations of them as lists.
>
> The patches are available here:
>
> git fetch git@REDACTED:thlachmann/otp.git
> ssl_fix_packet_line_mode_list
>
>
> Thomas
>
> ________________________________________________________________
> erlang-patches (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-patches-unsubscribe@REDACTED
>
>
From ingela@REDACTED Wed Aug 25 10:04:00 2010
From: ingela@REDACTED (Ingela Anderton Andin)
Date: Wed, 25 Aug 2010 10:04:00 +0200
Subject: [erlang-patches] Allow server to use verify_peer and have no
cacertfile
In-Reply-To:
References:
Message-ID: <4C74CE70.2050108@erix.ericsson.se>
Hi!
After discussing this with Jonas a bit I feel that the
what we probably want to do is to make it possible for
the server to send a certificate request in verify_none
mode as then the verify fun can be used in the way that
Jonas wants. It seems there is a bug in public_key that
under certain circumstances would make the path_validation
not return an error in verify_peer mode as intended.
As I explained in an Erlang-questions thread:
If verify_none all possible path validation errors will be passed
to the the verify fun and it will be up to the verify fun if the
connection should fail or succeed. At the moment this option is
only relevant for the client side as the server will never send a
certificate request in verify_none mode. ( It is possible that we
want this to be possible and we are looking in to that now).
If verify_peer any path validation error should make the
connection fail we should never get to the branch using the
verify fun, the public_key path validation should return {error,
Reason}.
So we are working on a solution I can not promise it will be
ready for R14B but I think it can make a maintenance release
i.e. I do not think you will have to wait for R15.
Regards Ingela Erlang/OTP team - Ericsson AB
jonas wrote:
> Hey *,
> I wanted to implement a server that can authenticate clients using the
> FOAF+SSL protocol (http://esw.w3.org/Foaf+ssl). This protocol uses the
> existing TLS infrastructure but does not use a cacert to authenticate
> the user. Providing no cacert was just an option for a client, since
> they can usually verify the certificate manually. If a server doesn't
> provide a cacertfile you get an error. This patch removes this
> restriction and allows a server to have no cacert, too.
>
> git fetch git://github.com/jonasp/otp.git foaf_ssl
>
> I didn't delete the testcase "Test server must have cacerts if it
> wants to verify client" yet. I can do so if you think that the patch
> is fine as it is.
> As far as documentation is concerned I am not exactly sure what would
> be reasonable to change since the FOAF+SSL usecase is still a bit too
> exotic to be referred to. (It is still in the process of being
> formally standardized.) And the Erlang man page for ssl just states
> that the cacertfile option can be omitted if you do not want to verify
> the peer but does not differentiate between client or server as it
> actually should at the moment. So I don't think any change is needed
> there.
>
> Best regards
> Jonas Pollok
>
> ________________________________________________________________
> erlang-patches (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-patches-unsubscribe@REDACTED
>
>
From mikpe@REDACTED Thu Aug 26 00:25:23 2010
From: mikpe@REDACTED (Mikael Pettersson)
Date: Thu, 26 Aug 2010 00:25:23 +0200
Subject: [PATCH] robustify hipe_bifs:get_hrvtime/0
Message-ID: <19573.38995.714271.847299@pilspetsen.it.uu.se>
The HiPE runtime system has a hipe_bifs:get_hrvtime/0 BIF which
mimics the non-standard gethrvtime() C API. It's possible to
configure the implementation to use the "perfctr" Linux kernel
extension for performance-monitoring counters, in which case
get_hrvtime has very high precision and low overhead. Otherwise
it uses the same code as runtime(statistics).
This patch changes the get_hrvtime implementation to do a runtime
check to see if perfctr is available, and to use the fallback code
rather than returning a dummy value if perfctr is unavailable,
which is common.
The current dummy value return is a bug. It messes up the API
and either breaks callers (they get badarg when trying to compute
on the value) or forces them to implement checks and fallbacks
themselves. Timing code in HiPE's test suites and benchmarks
is known to be affected.
/Mikael
--- otp_src_R14A/erts/emulator/hipe/hipe_bif1.c.~1~ 2009-03-12 13:16:10.000000000 +0100
+++ otp_src_R14A/erts/emulator/hipe/hipe_bif1.c 2010-08-25 23:04:39.000000000 +0200
@@ -876,22 +876,44 @@ BIF_RETTYPE hipe_bifs_misc_timer_clear_0
* + The fallback, which is the same as {X,_} = runtime(statistics).
*/
+static double fallback_get_hrvtime(void)
+{
+ unsigned long ms_user;
+
+ elapsed_time_both(&ms_user, NULL, NULL, NULL);
+ return (double)ms_user;
+}
+
#if USE_PERFCTR
#include "hipe_perfctr.h"
-static int hrvtime_is_open;
-#define hrvtime_is_started() hrvtime_is_open
+static int hrvtime_started; /* 0: closed, +1: perfctr, -1: fallback */
+#define hrvtime_is_started() (hrvtime_started != 0)
static void start_hrvtime(void)
{
if (hipe_perfctr_hrvtime_open() >= 0)
- hrvtime_is_open = 1;
+ hrvtime_started = 1;
+ else
+ hrvtime_started = -1;
+}
+
+static void stop_hrvtime(void)
+{
+ if (hrvtime_started > 0)
+ hipe_perfctr_hrvtime_close();
+ hrvtime_started = 0;
}
-#define get_hrvtime() hipe_perfctr_hrvtime_get()
-#define stop_hrvtime() hipe_perfctr_hrvtime_close()
+static double get_hrvtime(void)
+{
+ if (hrvtime_started > 0)
+ return hipe_perfctr_hrvtime_get();
+ else
+ return fallback_get_hrvtime();
+}
-#else
+#else /* !USE_PERFCTR */
/*
* Fallback, if nothing better exists.
@@ -902,15 +924,9 @@ static void start_hrvtime(void)
#define hrvtime_is_started() 1
#define start_hrvtime() do{}while(0)
#define stop_hrvtime() do{}while(0)
+#define get_hrvtime() fallback_get_hrvtime()
-static double get_hrvtime(void)
-{
- unsigned long ms_user;
- elapsed_time_both(&ms_user, NULL, NULL, NULL);
- return (double)ms_user;
-}
-
-#endif /* hrvtime support */
+#endif /* !USE_PERFCTR */
BIF_RETTYPE hipe_bifs_get_hrvtime_0(BIF_ALIST_0)
{
@@ -918,11 +934,8 @@ BIF_RETTYPE hipe_bifs_get_hrvtime_0(BIF_
Eterm res;
FloatDef f;
- if (!hrvtime_is_started()) {
+ if (!hrvtime_is_started())
start_hrvtime();
- if (!hrvtime_is_started())
- BIF_RET(NIL); /* arity 0 BIFs may not fail */
- }
f.fd = get_hrvtime();
hp = HAlloc(BIF_P, FLOAT_SIZE_OBJECT);
res = make_float(hp);
From tuncer.ayaz@REDACTED Thu Aug 26 15:38:25 2010
From: tuncer.ayaz@REDACTED (Tuncer Ayaz)
Date: Thu, 26 Aug 2010 15:38:25 +0200
Subject: asn1-test-compile-options
Message-ID:
Check the return value in the (non-)verbose asn1ct:compile/2 test case.
git fetch git://github.com/tuncer/otp.git asn1-test-compile-options
From bgustavsson@REDACTED Fri Aug 27 12:00:49 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Fri, 27 Aug 2010 12:00:49 +0200
Subject: [erlang-patches] [PATCH] robustify hipe_bifs:get_hrvtime/0
In-Reply-To: <19573.38995.714271.847299@pilspetsen.it.uu.se>
References: <19573.38995.714271.847299@pilspetsen.it.uu.se>
Message-ID:
On Thu, Aug 26, 2010 at 12:25 AM, Mikael Pettersson wrote:
> The HiPE runtime system has a hipe_bifs:get_hrvtime/0 BIF which
> mimics the non-standard gethrvtime() C API. It's possible to
> configure the implementation to use the "perfctr" Linux kernel
> extension for performance-monitoring counters, in which case
> get_hrvtime has very high precision and low overhead. Otherwise
> it uses the same code as runtime(statistics).
>
> This patch changes the get_hrvtime implementation to do a runtime
> check to see if perfctr is available, and to use the fallback code
> rather than returning a dummy value if perfctr is unavailable,
> which is common.
>
> The current dummy value return is a bug. It messes up the API
> and either breaks callers (they get badarg when trying to compute
> on the value) or forces them to implement checks and fallbacks
> themselves. Timing code in HiPE's test suites and benchmarks
> is known to be affected.
>
Thanks! Will include in pu.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From bgustavsson@REDACTED Fri Aug 27 12:09:55 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Fri, 27 Aug 2010 12:09:55 +0200
Subject: [erlang-patches] asn1-test-compile-options
In-Reply-To:
References:
Message-ID:
On Thu, Aug 26, 2010 at 3:38 PM, Tuncer Ayaz wrote:
> Check the return value in the (non-)verbose asn1ct:compile/2 test case.
>
> git fetch git://github.com/tuncer/otp.git asn1-test-compile-options
Thanks! Will include in pu.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From mikpe@REDACTED Fri Aug 27 22:00:53 2010
From: mikpe@REDACTED (Mikael Pettersson)
Date: Fri, 27 Aug 2010 22:00:53 +0200
Subject: fix crash in hipe_icode_exceptions
Message-ID: <19576.6517.146942.219277@pilspetsen.it.uu.se>
This fixes a problem in the HiPE compiler's BEAM-to-Icode
pass where it can crash due to the BEAM compiler's merging
of identical basic blocks with different exception handling
contexts. This bug has been latent, but is now exposed by
what appears to be more aggressive optimizations in BEAM.
The added comment explains things in more detail.
/Mikael
--- otp_src_R14A/lib/hipe/icode/hipe_icode_exceptions.erl.~1~ 2009-09-18 16:08:48.000000000 +0200
+++ otp_src_R14A/lib/hipe/icode/hipe_icode_exceptions.erl 2010-08-27 21:09:34.000000000 +0200
@@ -344,6 +344,16 @@ pop_catch(Cs) ->
pop_catch_1([[_|C] | Cs]) ->
[C | pop_catch_1(Cs)];
+pop_catch_1([[] | Cs]) ->
+ %% The elements in the list represent different possible incoming
+ %% stacks of catch handlers to this BB. Before the fixpoint has
+ %% been found these elements are underapproximations of the true
+ %% stacks, therefore it's possible for these elements to be too
+ %% short for the number of pops implied by the code in the BB.
+ %% We must not fail in that case, so we set pop([]) = [].
+ %% This fixes find_catches_crash.erl and compiler_tests in the
+ %% HiPE test suite.
+ [[] | pop_catch_1(Cs)];
pop_catch_1([]) ->
[].
From tuncer.ayaz@REDACTED Sat Aug 28 16:24:58 2010
From: tuncer.ayaz@REDACTED (Tuncer Ayaz)
Date: Sat, 28 Aug 2010 16:24:58 +0200
Subject: [PATCH] Fix variable name in spawn/4 doc
Message-ID: <1283005498-1943-1-git-send-email-tuncer.ayaz@gmail.com>
ArgumentList -> Args
---
erts/doc/src/erlang.xml | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
index 579a5a1..388c8e2 100644
--- a/erts/doc/src/erlang.xml
+++ b/erts/doc/src/erlang.xml
@@ -4513,7 +4513,7 @@ true
- spawn(Node, Module, Function, ArgumentList) -> pid()
+ spawn(Node, Module, Function, Args) -> pid()
Create a new process with a function as entry point on a given node
Node = node()
From pguyot@REDACTED Sun Aug 29 21:58:07 2010
From: pguyot@REDACTED (Paul Guyot)
Date: Sun, 29 Aug 2010 21:58:07 +0200
Subject: Allow the pool of hipe constants to grow at runtime
Message-ID:
Hello,
The hipe constants pool was previously set to a static, non-growable pool of 1.5 M words. While this works in most setups, an OTP deployment with many natively compiled modules, including modules with a lot of constants, would crash with:
Native code constants pool depleted!
A simple implementation based on a linked-list of pools that maintains the ability to iterate on hipe constant terms (as required by hipe_bifs_show_literals_0) can be found here:
git fetch git://github.com/pguyot/otp.git pg/growable-hipe-constants-pool
http://github.com/pguyot/otp/commit/d94f2c6d5d8774eea96e63b0c26e55484cc8bc10
The rationale for not directly using erts_alloc used to be able to quickly tell if a term is constant or not (cf the comment that I removed, since the gc does not refer to the pool anymore, so I guess it is outdated). In the proposed patch, I maintained pools to minimally change the behaviour (indeed, deployments that do not require more than 1.5M words will use a single pool as they previously did, deployments that do will simply, well, not crash) and keep hipe_bifs_show_literals_0.
However, I am wondering if we could simply replace constants_alloc with erts_alloc and either phase out hipe_bifs_show_literals_0, since it's for debugging only, or replace it with an iteration on const_term_table table.
Regards,
Paul
--
Semiocast http://semiocast.com/
+33.175000290 - 62 bis rue Gay-Lussac, 75005 Paris
From mikpe@REDACTED Mon Aug 30 13:31:19 2010
From: mikpe@REDACTED (Mikael Pettersson)
Date: Mon, 30 Aug 2010 13:31:19 +0200
Subject: Allow the pool of hipe constants to grow at runtime
In-Reply-To:
References:
Message-ID: <19579.38535.178938.340824@pilspetsen.it.uu.se>
Paul Guyot writes:
> Hello,
>
> The hipe constants pool was previously set to a static, non-growable pool of 1.5 M words. While this works in most setups, an OTP deployment with many natively compiled modules, including modules with a lot of constants, would crash with:
>
> Native code constants pool depleted!
>
> A simple implementation based on a linked-list of pools that maintains the ability to iterate on hipe constant terms (as required by hipe_bifs_show_literals_0) can be found here:
>
> git fetch git://github.com/pguyot/otp.git pg/growable-hipe-constants-pool
> http://github.com/pguyot/otp/commit/d94f2c6d5d8774eea96e63b0c26e55484cc8bc10
>
> The rationale for not directly using erts_alloc used to be able to quickly tell if a term is constant or not (cf the comment that I removed, since the gc does not refer to the pool anymore, so I guess it is outdated). In the proposed patch, I maintained pools to minimally change the behaviour (indeed, deployments that do not require more than 1.5M words will use a single pool as they previously did, deployments that do will simply, well, not crash) and keep hipe_bifs_show_literals_0.
>
> However, I am wondering if we could simply replace constants_alloc with erts_alloc and either phase out hipe_bifs_show_literals_0, since it's for debugging only, or replace it with an iteration on const_term_table table.
I agree changing this is reasonable. I haven't seen many bug reports
about the limitation though, certainly none recently.
Please post the patch inline as plain text for review; a quick glance
via github's awful web interface reveals several coding style issues.
/Mikael
From bgustavsson@REDACTED Mon Aug 30 15:41:28 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Mon, 30 Aug 2010 15:41:28 +0200
Subject: [erlang-patches] Allow the pool of hipe constants to grow at runtime
In-Reply-To:
References:
Message-ID:
On Sun, Aug 29, 2010 at 9:58 PM, Paul Guyot wrote:
> Hello,
>
> The hipe constants pool was previously set to a static, non-growable pool of 1.5 M words. While this works in most setups, an OTP deployment with many natively compiled modules, including modules with a lot of constants, would crash with:
>
> Native code constants pool depleted!
>
Would it not be better to have a separate constant pool per module,
just as BEAM handles it?
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From mikpe@REDACTED Mon Aug 30 15:56:09 2010
From: mikpe@REDACTED (Mikael Pettersson)
Date: Mon, 30 Aug 2010 15:56:09 +0200
Subject: [erlang-patches] Allow the pool of hipe constants to grow at runtime
In-Reply-To:
References:
Message-ID: <19579.47225.571149.151798@pilspetsen.it.uu.se>
bgustavsson@REDACTED wrote:
> On Sun, Aug 29, 2010 at 9:58 PM, Paul Guyot wrote:
> > Hello,
> >
> > The hipe constants pool was previously set to a static, non-growable pool=
> of 1.5 M words. While this works in most setups, an OTP deployment with ma=
> ny natively compiled modules, including modules with a lot of constants, wo=
> uld crash with:
> >
> > Native code constants pool depleted!
> >
>
> Would it not be better to have a separate constant pool per module,
> just as BEAM handles it?
The HiPE runtime doesn't have a module concept. But yes,
one the hypothetical HiPE loader reimplementation in C is
done it should probably be done that way.
/Mikael
From bgustavsson@REDACTED Mon Aug 30 16:09:17 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Mon, 30 Aug 2010 16:09:17 +0200
Subject: [erlang-patches] [PATCH] Fix variable name in spawn/4 doc
In-Reply-To: <1283005498-1943-1-git-send-email-tuncer.ayaz@gmail.com>
References: <1283005498-1943-1-git-send-email-tuncer.ayaz@gmail.com>
Message-ID:
On Sat, Aug 28, 2010 at 4:24 PM, Tuncer Ayaz wrote:
> ArgumentList -> Args
> ---
> erts/doc/src/erlang.xml | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
> index 579a5a1..388c8e2 100644
> --- a/erts/doc/src/erlang.xml
> +++ b/erts/doc/src/erlang.xml
> @@ -4513,7 +4513,7 @@ true
>
>
>
> - spawn(Node, Module, Function, ArgumentList) -> pid()
> + spawn(Node, Module, Function, Args) -> pid()
> Create a new process with a function as entry point on a given node
>
> Node = node()
Thanks! Applied directly to dev.
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB
From pguyot@REDACTED Mon Aug 30 19:31:08 2010
From: pguyot@REDACTED (Paul Guyot)
Date: Mon, 30 Aug 2010 19:31:08 +0200
Subject: [erlang-patches] Allow the pool of hipe constants to grow at runtime
In-Reply-To:
References:
Message-ID: <1EA19045-208E-4020-87BE-D159CC8C60BE@kallisys.net>
Le 30 ao?t 2010 ? 15:41, Bj?rn Gustavsson a ?crit :
> On Sun, Aug 29, 2010 at 9:58 PM, Paul Guyot wrote:
>> Hello,
>>
>> The hipe constants pool was previously set to a static, non-growable pool of 1.5 M words. While this works in most setups, an OTP deployment with many natively compiled modules, including modules with a lot of constants, would crash with:
>>
>> Native code constants pool depleted!
>>
>
> Would it not be better to have a separate constant pool per module,
> just as BEAM handles it?
I believe that BEAM has a separate constant pool per module because constants probably go away when a module is unloaded. In HiPE, constants currently never go away. In other words, the bug is two folded:
- a memory leak with code replacement,
- a "Native code constants pool depleted!" crash when the pool is depleted.
Until the leak is fixed (with a rewrite of the loader in C ?) I suggest to simplify the code and to remove the unnecessary constant pool implementation. This would at least avoid the crash, as well as avoid unnecessary allocations. A typical erl shell configured with --enable-native-libs will have 32K words, the pool has a fixed size of 1.5 M words. We encountered this crash with nodes that allocate more than 3.5M words on boot.
A new patch is available here:
git fetch git://github.com/pguyot/otp.git pg/remove-hipe-constants-pool
http://github.com/pguyot/otp/commit/2f00cf20e222dd1ad5c0c48b3808821640ff57a6
This patch removes hipe_bifs:show_literals/0, but maintains hipe_bifs:constants_size/0. Both are debugging undocumented functions, but hipe_bifs:show_literals/0 always returned true and printed lines on the console, so I guess it is not used in any faceless program, while hipe_bifs:constants_size/0 returns a value.
Mikael, I understand that the OTP team prefers git fetch command lines, but you can see the patch in plain old diff format here:
http://github.com/pguyot/otp/commit/2f00cf20e222dd1ad5c0c48b3808821640ff57a6.diff
Regards,
Paul
--
Semiocast http://semiocast.com/
+33.175000290 - 62 bis rue Gay-Lussac, 75005 Paris
From bgustavsson@REDACTED Tue Aug 31 10:38:33 2010
From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=)
Date: Tue, 31 Aug 2010 10:38:33 +0200
Subject: [erlang-patches] Allow the pool of hipe constants to grow at runtime
In-Reply-To: <1EA19045-208E-4020-87BE-D159CC8C60BE@kallisys.net>
References:
<1EA19045-208E-4020-87BE-D159CC8C60BE@kallisys.net>
Message-ID:
2010/8/30 Paul Guyot :
>
> Mikael, I understand that the OTP team prefers git fetch command lines, but you can see the patch in plain old diff format here:
> http://github.com/pguyot/otp/commit/2f00cf20e222dd1ad5c0c48b3808821640ff57a6.diff
We do accept patches inlined in emails, provided
that they formatted in the same way as "git format-patch" does
and that they are not white-space damaged. Such
patches are easy to apply using "git am". Since it
can be tricky to avoid white-space damaging inlined
patches (depending on which email client you use),
we only recommend sending inlined patches if you
know how to do it properly.
(Note: We don't accept attached patches or inlined
patches that don't have the commit message in the
subject line and email body.)
The advantage of inlined patches are that they
can be easily reviewed on the mailing list by
just replying to the email and inserting the comments
after the lines they refer to.
In order to help Mikael review the patch, your patch
follows here. (The patch is only meant for review purposes,
not for applying; it is probably white-spaced damaged since
I have pasted into Gmail's web client.)
diff --git a/erts/emulator/beam/erl_nmgc.c b/erts/emulator/beam/erl_nmgc.c
index 626d4e2..60424ba 100644
--- a/erts/emulator/beam/erl_nmgc.c
+++ b/erts/emulator/beam/erl_nmgc.c
@@ -26,7 +26,6 @@
#include "erl_nmgc.h"
#include "erl_debug.h"
#if HIPE
-#include "hipe_bif0.h" /* for hipe_constants_{start,next} */
#include "hipe_stack.h"
#endif
diff --git a/erts/emulator/hipe/hipe_bif0.c b/erts/emulator/hipe/hipe_bif0.c
index 2a877d8..6c89af6 100644
--- a/erts/emulator/hipe/hipe_bif0.c
+++ b/erts/emulator/hipe/hipe_bif0.c
@@ -450,52 +450,13 @@ BIF_RETTYPE hipe_bifs_alloc_data_2(BIF_ALIST_2)
}
/*
- * Memory area for constant Erlang terms.
- *
- * These constants must not be forwarded by the gc.
- * Therefore, the gc needs to be able to distinguish between
- * collectible objects and constants. Unfortunately, an Erlang
- * process' collectible objects are scattered around in two
- * heaps and a list of message buffers, so testing "is X a
- * collectible object?" can be expensive.
- *
- * Instead, constants are placed in a single contiguous area,
- * which allows for an inexpensive "is X a constant?" test.
- *
- * XXX: Allow this area to be grown.
+ * Statistics on hipe constants: size of hipe constants, in words.
*/
-
-/* not static, needed by garbage collector */
-Eterm *hipe_constants_start = NULL;
-Eterm *hipe_constants_next = NULL;
-static unsigned constants_avail_words = 0;
-#define CONSTANTS_BYTES (1536*1024*sizeof(Eterm)) /* 1.5 M words */
-
-static Eterm *constants_alloc(unsigned nwords)
-{
- Eterm *next;
-
- /* initialise at the first call */
- if ((next = hipe_constants_next) == NULL) {
- next = (Eterm*)erts_alloc(ERTS_ALC_T_HIPE, CONSTANTS_BYTES);
- hipe_constants_start = next;
- hipe_constants_next = next;
- constants_avail_words = CONSTANTS_BYTES / sizeof(Eterm);
- }
- if (nwords > constants_avail_words) {
- fprintf(stderr, "Native code constants pool depleted!\r\n");
- /* Must terminate immediately. erl_exit() seems to
- continue running some code which then SIGSEGVs. */
- exit(1);
- }
- constants_avail_words -= nwords;
- hipe_constants_next = next + nwords;
- return next;
-}
+unsigned int hipe_constants_size = 0;
BIF_RETTYPE hipe_bifs_constants_size_0(BIF_ALIST_0)
{
- BIF_RET(make_small(hipe_constants_next - hipe_constants_start));
+ BIF_RET(make_small(hipe_constants_size));
}
/*
@@ -526,14 +487,17 @@ static void *const_term_alloc(void *tmpl)
{
Eterm obj;
Uint size;
+ Uint alloc_size;
Eterm *hp;
struct const_term *p;
obj = (Eterm)tmpl;
ASSERT(is_not_immed(obj));
size = size_object(obj);
+ alloc_size = size + (offsetof(struct const_term, mem)/sizeof(Eterm));
+ hipe_constants_size += alloc_size;
- p = (struct const_term*)constants_alloc(size + (offsetof(struct
const_term, mem)/sizeof(Eterm)));
+ p = (struct const_term*)erts_alloc(ERTS_ALC_T_HIPE, alloc_size *
sizeof(Eterm));
/* I have absolutely no idea if having a private 'off_heap'
works or not. _Some_ off_heap object is required for
diff --git a/erts/emulator/hipe/hipe_bif0.h b/erts/emulator/hipe/hipe_bif0.h
index ed27d56..a283ffe 100644
--- a/erts/emulator/hipe/hipe_bif0.h
+++ b/erts/emulator/hipe/hipe_bif0.h
@@ -26,10 +26,6 @@
extern Uint *hipe_bifs_find_pc_from_mfa(Eterm mfa);
-/* shared with ggc.c -- NOT an official API */
-extern Eterm *hipe_constants_start;
-extern Eterm *hipe_constants_next;
-
extern void hipe_mfa_info_table_init(void);
extern void *hipe_get_remote_na(Eterm m, Eterm f, unsigned int a);
extern Eterm hipe_find_na_or_make_stub(Process*, Eterm, Eterm, Eterm);
diff --git a/erts/emulator/hipe/hipe_bif2.c b/erts/emulator/hipe/hipe_bif2.c
index f992b75..e5a236c 100644
--- a/erts/emulator/hipe/hipe_bif2.c
+++ b/erts/emulator/hipe/hipe_bif2.c
@@ -33,7 +33,6 @@
#include "big.h"
#include "hipe_debug.h"
#include "hipe_mode_switch.h"
-#include "hipe_bif0.h" /* hipe_constants_{start,next} */
#include "hipe_arch.h"
#include "hipe_stack.h"
@@ -124,18 +123,6 @@ BIF_RETTYPE hipe_bifs_show_term_1(BIF_ALIST_1)
BIF_RET(am_true);
}
-BIF_RETTYPE hipe_bifs_show_literals_0(BIF_ALIST_0)
-{
- Eterm *p;
-
- p = hipe_constants_start;
- for (; p < hipe_constants_next; ++p)
- printf("0x%0*lx: 0x%0*lx\r\n",
- 2*(int)sizeof(long), (unsigned long)p,
- 2*(int)sizeof(long), *p);
- BIF_RET(am_true);
-}
-
BIF_RETTYPE hipe_bifs_in_native_0(BIF_ALIST_0)
{
BIF_RET(am_false);
diff --git a/erts/emulator/hipe/hipe_bif2.tab b/erts/emulator/hipe/hipe_bif2.tab
index d8d627e..9578b69 100644
--- a/erts/emulator/hipe/hipe_bif2.tab
+++ b/erts/emulator/hipe/hipe_bif2.tab
@@ -26,7 +26,6 @@ bif hipe_bifs:show_nstack/1
bif hipe_bifs:nstack_used_size/0
bif hipe_bifs:show_pcb/1
bif hipe_bifs:show_term/1
-bif hipe_bifs:show_literals/0
bif hipe_bifs:in_native/0
bif hipe_bifs:modeswitch_debug_on/0
bif hipe_bifs:modeswitch_debug_off/0
diff --git a/erts/emulator/hipe/hipe_gc.c b/erts/emulator/hipe/hipe_gc.c
index 6c9e1d9..6dd296d 100644
--- a/erts/emulator/hipe/hipe_gc.c
+++ b/erts/emulator/hipe/hipe_gc.c
@@ -28,7 +28,6 @@
#include "hipe_stack.h"
#include "hipe_gc.h"
-#include "hipe_bif0.h" /* for hipe_constants_{start,next} */
Eterm *fullsweep_nstack(Process *p, Eterm *n_htop)
{
--
Bj?rn Gustavsson, Erlang/OTP, Ericsson AB