ILYA Khlopotov | 21 Aug 01:44 2015
Picon

Dialyzer crashes with Solver v2 failed: error:function_clause

Hi,

It looks like my previous report (from different email address) didn't go through.

Following spec causes dialyzer to crash

-opaque att() :: #att{} | attachment().

More info is here
https://gist.github.com/iilyak/25a2534b65b6972bf251

Is it a known issue?

BR,
ILYA
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Leo Liu | 20 Aug 12:23 2015
Picon

[PATCH] Improve error message for {error, no_src} in int:int_mod/2

The catch all error message doesn't explain {error, no_src} and is
confusing.

_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Ondřej Adamovský | 18 Aug 14:31 2015
Picon

httpc relative redirect bug

Hi,

I have stumbled upon a bug in inets application. When a HTTP request  
(tested using httpc:request/4 call with {relaxed,true} HTTP option)  
returns redirect (e.g. status 302) with relative address in Location  
header, it is mishandled. The relative address is simply appended to the  
path of the base request, which is OK only if the base path is empty.

The right approach would be:
a) if the relative address starts with /, the base path should be replaced  
by the relative one
b) otherwise, the relative path should be appended to base path with the  
last segment of the base path removed

I understand the inets application was written according to RFC 2616,  
which required the redirect location to be absolute address and the  
relative redirect was only an optional expansion. Now, the RFC 2616 is  
obsoleted by RFC 7231, which allows for the relative redirects  
(https://tools.ietf.org/html/rfc7231#section-7.1.2) and the creation of  
the resulting address is specified in RFC 3986  
(https://tools.ietf.org/html/rfc3986#section-5.2).

Regards,
Ondřej Adamovský
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Loïc Hoguin | 18 Aug 10:38 2015
Picon

SSL key option docs incorrect?

Reading http://www.erlang.org/doc/man/ssl.html

{key, {'RSAPrivateKey'| 'DSAPrivateKey' | 'ECPrivateKey' 
|'PrivateKeyInfo', public_key:der_encoded()}}
The DER-encoded user's private key. If this option is supplied, it 
overrides option keyfile.

However the code says this:

https://github.com/erlang/otp/blob/master/lib/ssl/src/ssl.erl#L802

Doesn't look like it allows 'ECPrivateKey' here?

--

-- 
Loïc Hoguin
http://ninenines.eu
Author of The Erlanger Playbook,
A book about software development using Erlang
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Loïc Hoguin | 18 Aug 00:40 2015
Picon

inet:setops manual: {priority, Integer} is documented twice

http://www.erlang.org/doc/man/inet.html#setopts-2

I think it refers to the same option, but as I am not sure what this 
option does *exactly* I'm reporting a bug rather than fixing it.

First time it mentions the option it says:

{priority, Priority}
     Set the protocol-defined priority for all packets to be sent on 
this socket.

Second time:

{priority, Integer}
     Sets the SO_PRIORITY socket level option on platforms where this is 
implemented. The behaviour and allowed range varies on different 
systems. The option is ignored on platforms where the option is not 
implemented. Use with caution.

Second one sounds better though it's probably good to add it's for all 
packets sent on this socket.

Cheers,

--

-- 
Loïc Hoguin
http://ninenines.eu
Author of The Erlanger Playbook,
A book about software development using Erlang
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Bruno Matos Tavares | 13 Aug 13:36 2015
Picon

OTP-18.0 --enable-native-libs build failed on Ubuntu Server 14.04 LTS (HVM) and Amazon Linux AMI 2015.03 (HVM)

Hi,

I’m trying to build Erlang 18.0 from the official tarball with --enable-native-libs and it fails (log at
the bottom). After discussing the issue on erlang-questions
(https://groups.google.com/forum/#!topic/erlang-programming/OnMkdZpml8E)
--enable-native-libs seems not to be working at all on Ubuntu Server 14.04 LTS (HVM) and Amazon Linux AMI
2015.03 (HVM) (the ones I was able to test) but with a workaround only the HiPE applications gets the native
libs treatment. 

* without workaround

./configure --prefix=/usr/local \
--disable-debug \
--enable-silent-rules \
--enable-m64-build \
--enable-threads \
--enable-smp-support \
--enable-kernel-poll \
--enable-hipe \
--enable-native-libs \
--with-ssl=/usr/bin \
--without-docs \
--without-wx \
--without-javac \
—without-odbc

make

make[2]: Entering directory `/home/ec2-user/tmp/tmp_1/otp_src_18.0/lib/hipe'
Makefile:72: warning: overriding recipe for target `clean'
/home/ec2-user/tmp/tmp_1/otp_src_18.0/make/otp_subdir.mk:29: warning: ignoring old recipe for
target `clean'
=== Entering application hipe
make[3]: Entering directory `/home/ec2-user/tmp/tmp_1/otp_src_18.0/lib/hipe/rtl'
 ERLC   ../ebin/hipe_rtl.beam
hipe_rtl.erl: internal error in native_compile;
crash reason: undef

  in function  hipe:compile/4
     called as hipe:compile(hipe_rtl,[],
 <<70,…,0>>,
 [])
  in call from compile:native_compile_1/1 (compile.erl, line 1361)
  in call from compile:'-internal_comp/4-anonymous-1-'/2 (compile.erl, line 295)
  in call from compile:fold_comp/3 (compile.erl, line 321)
  in call from compile:internal_comp/4 (compile.erl, line 305)
  in call from compile:'-do_compile/2-anonymous-0-'/2 (compile.erl, line 155)
make[3]: *** [../ebin/hipe_rtl.beam] Error 1
make[3]: Leaving directory `/home/ec2-user/tmp/tmp_1/otp_src_18.0/lib/hipe/rtl'
make[2]: *** [opt] Error 2
make[2]: Leaving directory `/home/ec2-user/tmp/tmp_1/otp_src_18.0/lib/hipe'
make[1]: *** [opt] Error 2
make[1]: Leaving directory `/home/ec2-user/tmp/tmp_1/otp_src_18.0/lib'
make: *** [libs] Error 2

* with the workaround
Drop —enable-m64-build and add CFLAGS=‘-O2 -m64'

CFLAGS=‘-O2 -m64' ./configure --prefix=/usr/local \
--disable-debug \
--enable-silent-rules \
--enable-threads \
--enable-smp-support \
--enable-kernel-poll \
--enable-hipe \
--enable-native-libs \
--with-ssl=/usr/bin \
--without-docs \
--without-wx \
--without-javac \
—without-odbc

1> code:is_loaded(gen_server).
{file,"/opt/erlang//lib/stdlib-2.5/ebin/gen_server.beam"}
2> code:is_loaded(gen_server).
{file,”/opt/erlang//lib/stdlib-2.5/ebin/gen_server.beam”}
3> gen_server:module_info(native).
false

Thank you,
Bruno.

_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Leo Liu | 6 Aug 02:19 2015
Picon

eunit:test/2 return value

I have noticed the return value may be `error' instead of `{error,
Rsn}'. Is it a documentation error?

Here is an example:

-include_lib("eunit/include/eunit.hrl").

basic_test_() ->
    [?_assert(1 + 1 =:= 3)].

Leo
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs

Papadomitsos Panagiotis | 1 Aug 00:43 2015
Picon

Failure to decode EC private key via public_key application

Hi all,

I've been trying to read an EC password protected private key in pem format into Erlang but I've been getting this error:

{ok, M} = file:read_file("m.key"),
[Pem] = public_key:pem_decode(M),
exception error: no function clause matching
                 pubkey_pbe:cipher({'PBES2-params_encryptionScheme',
                                    {2,16,840,1,101,3,4,1,42},
                                    {asn1_OPENTYPE,
                                     <<4,16,255,71,145,188,80,110,6,134,174,
                                       100,0,176,46,76,243,205>>}}) (pubkey_pbe.erl, line 271)
  in function  pubkey_pbe:decrypt_parameters/2 (pubkey_pbe.erl, line 185)
  in call from pubkey_pem:decode_encrypted_private_keyinfo/1 (pubkey_pem.erl, line 146)
  in call from pubkey_pem:decode_pem_entries/2 (pubkey_pem.erl, line 121)

This is in Erlang 18.0.2, both on MacOS 10.10.4 and Ubuntu 14.04. OpenSSL is 1.0.1f.

A sample key in the format that causes the issue is:

-----BEGIN ENCRYPTED PRIVATE KEY-----
MIHeMEkGCSqGSIb3DQEFDTA8MBsGCSqGSIb3DQEFDDAOBAhIMXJLXX+miQICCAAw
HQYJYIZIAWUDBAEqBBD/R5G8UG4Ghq5kALAuTPPNBIGQSk3UlBws+Y/BiJg5KIyV
IuqsCngm+l10zFNFVrFQNlFQ8+nQHuHYOMXk5UCoqMPkAVD+xSJ1pj00wQiQ85Y5
XS3B9YObYN5iSzFOyTe4S9+qJtW2OI5VQ5gW7xq9LMUKBwJzkpsd9w5lyOgN9/Gt
Meq24+3LkqP8DjB7L5fc9U+1F9+BMoUuE+HiLBy6Sww3
-----END ENCRYPTED PRIVATE KEY-----

--
Panagiotis Papadomitsos
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
-E:), niku | 30 Jul 19:40 2015

erlang:binary_to_integer(<<"+">>) returns 0

Hi folks.

erlang:binary_to_integer(<<"+">>) and
erlang:binary_to_integer(<<"-">>) return 0

I think it should cause exception same as erlang:list_to_integer("+").

Here is an example

$ erl
Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:4:4]
[async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V6.4  (abort with ^G)
1> binary_to_integer(<<"+">>).
0
2> binary_to_integer(<<"-">>).
0

regards.
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs

James Fish | 29 Jul 18:24 2015

Type assertion failure when tracing with process_dump message

When using {message, {process_dump}} in a trace the VM can abort on OTP R16B03 to 18.0.2 (not R16B02 and earlier) on a linux 3.19.0-21-generic x86_64:

TYPE ASSERTION FAILED, file beam/erl_term.c, line 115: tag_val_def: 0x7f9c183ee6d2
Aborted (core dumped)

#0  0x00007f9c1c56f267 in __GI_raise (sig=sig <at> entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1  0x00007f9c1c570eca in __GI_abort () at abort.c:89
#2  0x000000000056dfd1 in et_abort (expr=0x9081e0 <msg> "tag_val_def: 0x7f9c183ee6d2", file=0x64fe45 "beam/erl_term.c", line=115) at beam/erl_term.c:48
#3  tag_val_def (x=x <at> entry=140308398401234) at beam/erl_term.c:115
#4  0x00000000004cf12e in print_term (obj_base=<optimised out>, dcount=<synthetic pointer>, obj=140308398401234, arg=0x7f9c1d780078, fn=0x630a10 <write_ds>) at beam/erl_printf_term.c:352
#5  erts_printf_term (fn=0x630a10 <write_ds>, arg=0x7f9c1d780078, term=<optimised out>, precision=99999, term_base=<optimised out>) at beam/erl_printf_term.c:657
#6  0x000000000062ed17 in erts_printf_format (fn=fn <at> entry=0x630a10 <write_ds>, arg=arg <at> entry=0x7f9c1d780078, fmt=fmt <at> entry=0x64830b "%T\n", ap=ap <at> entry=0x7f9c198fc640) at common/erl_printf_format.c:847
#7  0x0000000000631750 in erts_vdsprintf (dsbufp=dsbufp <at> entry=0x7f9c1d780078, format=format <at> entry=0x64830b "%T\n", arglist=arglist <at> entry=0x7f9c198fc640) at common/erl_printf.c:459
#8  0x00000000004a9696 in erts_print (to=to <at> entry=-4, arg=arg <at> entry=0x7f9c1d780078, format=format <at> entry=0x64830b "%T\n") at beam/utils.c:400
#9  0x00000000004ea8cf in stack_element_dump (yreg=2, sp=0x7f9c183ef258, to_arg=0x7f9c1d780078, to=-4) at beam/erl_process.c:12546
#10 erts_stack_dump (to=to <at> entry=-4, to_arg=to_arg <at> entry=0x7f9c1d780078, p=p <at> entry=0x7f9c1bb003d8) at beam/erl_process.c:12466
#11 0x000000000055b56d in print_process_info (to=to <at> entry=-4, to_arg=to_arg <at> entry=0x7f9c1d780078, p=p <at> entry=0x7f9c1bb003d8) at beam/break.c:339
#12 0x000000000052cc20 in db_prog_match (c_p=c_p <at> entry=0x7f9c1bb003d8, bprog=0x7f9c1bdc0b78, term=term <at> entry=18446744073709551611, base=base <at> entry=0x0, termp=termp <at> entry=0x7f9c198fca70, arity=arity <at> entry=1,
    in_flags=ERTS_PAM_TMP_RESULT, return_flags=0x7f9c198fca14) at beam/erl_db_util.c:2404
#13 0x000000000052e5ec in erts_match_set_run (p=p <at> entry=0x7f9c1bb003d8, mpsp=<optimised out>, args=args <at> entry=0x7f9c198fca70, num_args=num_args <at> entry=1, in_flags=in_flags <at> entry=ERTS_PAM_TMP_RESULT,
    return_flags=return_flags <at> entry=0x7f9c198fca14) at beam/erl_db_util.c:1243
#14 0x00000000004a0c55 in erts_call_trace (p=p <at> entry=0x7f9c1bb003d8, mfa=mfa <at> entry=0x7f9c1822f058, match_spec=<optimised out>, args=0x7f9c198fca70, args <at> entry=0x7f9c1bfc4180, local=local <at> entry=1,
    tracer_pid=0x7f9c1bb003e8, tracer_pid <at> entry=0x7f9c198fdcc8) at beam/erl_trace.c:1873
#15 0x0000000000455654 in do_call_trace (c_p=0x7f9c1bb003d8, I=0x7f9c1822f070, reg=0x7f9c1bfc4180, local=local <at> entry=1, ms=<optimised out>, tracer_pid=tracer_pid <at> entry=75) at beam/beam_bp.c:900
#16 0x0000000000459524 in erts_generic_breakpoint (c_p=0x7f9c1bb003d8, I=0x7f9c1822f070, reg=0x7f9c1bfc4180) at beam/beam_bp.c:626
#17 0x0000000000443f23 in process_main () at beam/beam_emu.c:4921
#18 0x00000000004d6415 in sched_thread_func (vesdp=0x7f9c1ae4bc40) at beam/erl_process.c:8021
#19 0x000000000062d0e3 in thr_wrapper (vtwd=0x7fff8a43d010) at pthread/ethread.c:114
#20 0x00007f9c1cb136aa in start_thread (arg=0x7f9c198fe700) at pthread_create.c:333
#21 0x00007f9c1c640eed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

A minimal example:

c("test.erl"),
dbg:tracer(),
dbg:p(self(), [call]),
dbg:tpl(test, identity, [{'_',[],[{message,{process_dump}}]}]),
test:sum(<<0>>, 0).

test.erl:

-module(test).

-export([sum/2]).

sum(<<Int, Rest/binary>>, Acc) ->
    sum(Rest, Acc + identity(Int));
sum(<<>>, Acc) -> Acc.

identity(Int) ->
    Int.
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Alex Hudich | 17 Jul 14:00 2015
Picon

bad certificate if trying to verify StartSsl certificate

I don’t know if it is an Erlang bug but still I don’t have any clue how to resolve this situation:


ubuntu 14.04 and OTP 18.0 # wget http://curl.haxx.se/ca/cacert.pem --2015-07-16 19:11:50-- http://curl.haxx.se/ca/cacert.pem Resolving curl.haxx.se (curl.haxx.se)... 2a00:1a28:1200:9::2, 80.67.6.50 Connecting to curl.haxx.se (curl.haxx.se)|2a00:1a28:1200:9::2|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 258424 (252K) Saving to: 'cacert.pem' 100%[=============================================================================================================================================================================================>] 258,424 1.62MB/s in 0.2s 2015-07-16 19:11:50 (1.62 MB/s) - 'cacert.pem' saved [258424/258424] # erl Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] Eshell V7.0 (abort with ^G) 1> application:ensure_all_started(ssl). {ok,[crypto,asn1,public_key,ssl]} 2> ssl:connect( "www.nicemine.ru", 443, [{verify,verify_peer},{server_name_indication,"www.nicemine.ru"},{depth,2},{cacertfile,"cacert.pem"}] ). =ERROR REPORT==== 16-Jul-2015::19:12:18 === SSL: certify: ssl_handshake.erl:1476:Fatal error: bad certificate {error,{tls_alert,"bad certificate"}} 3> and Mac OS X and OTP 17.4 $ wget http://curl.haxx.se/ca/cacert.pem --2015-07-16 22:09:02-- http://curl.haxx.se/ca/cacert.pem Resolving curl.haxx.se... 80.67.6.50, 2a00:1a28:1200:9::2 Connecting to curl.haxx.se|80.67.6.50|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 258424 (252K) Saving to: 'cacert.pem' 100%[=============================================================================================================================================================================================>] 258,424 --.-K/s in 0.1s 2015-07-16 22:09:02 (1.92 MB/s) - 'cacert.pem' saved [258424/258424] $ erl Erlang/OTP 17 [erts-6.3] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace] Eshell V6.3 (abort with ^G) 1> application:ensure_all_started(ssl). {ok,[crypto,asn1,public_key,ssl]} 2> ssl:connect( "www.nicemine.ru", 443, [{verify,verify_peer},{server_name_indication,"www.nicemine.ru"},{depth,2},{cacertfile,"cacert.pem"}] ). =ERROR REPORT==== 16-Jul-2015::22:09:23 === SSL: certify: ssl_handshake.erl:1389:Fatal error: bad certificate {error,{tls_alert,"bad certificate"}} 3>

Then Santiago Fernández reported that problem couldn’t be reproduced with OTP 17.5 and I tried it. Indeed connection was successful but I decided to dig it more and I found interesting things:

I prepared two files. cacert.pem.1 was just an empty file (with zero legth) and cacert.pem which I’d downloaded earlier. And there is an output of 17.5 which seems to me wrong. Line 2 and 3 is ok. Line 4 is ok. But why line 5 gave me no error?? Erlang/OTP 17 [erts-6.4] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false] Eshell V6.4 (abort with ^G) 1> application:ensure_all_started(ssl). {ok,[crypto,asn1,public_key,ssl]} 2> ssl:connect( "www.nicemine.ru", 443, [{verify,verify_peer},{server_name_indication,"www.nicemine.ru"},{depth,2},{cacertfile,"cacert.pem.1"}] ). =ERROR REPORT==== 17-Jul-2015::13:26:45 === SSL: certify: ssl_handshake.erl:1401:Fatal error: unknown ca {error,{tls_alert,"unknown ca"}} 3> ssl:connect( "www.nicemine.ru", 443, [{verify,verify_peer},{server_name_indication,"www.nicemine.ru"},{depth,2},{cacertfile,"cacert.pem.1"}] ). =ERROR REPORT==== 17-Jul-2015::13:26:48 === SSL: certify: ssl_handshake.erl:1401:Fatal error: unknown ca {error,{tls_alert,"unknown ca"}} 4> ssl:connect( "www.nicemine.ru", 443, [{verify,verify_peer},{server_name_indication,"www.nicemine.ru"},{depth,2},{cacertfile,"cacert.pem"}] ). {ok,{sslsocket,{gen_tcp,#Port<0.1236>,tls_connection, undefined}, <0.53.0>}} 5> ssl:connect( "www.nicemine.ru", 443, [{verify,verify_peer},{server_name_indication,"www.nicemine.ru"},{depth,2},{cacertfile,"cacert.pem.1"}] ). {ok,{sslsocket,{gen_tcp,#Port<0.1243>,tls_connection, undefined}, <0.55.0>}}




_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs

Gmane