Erlang/OTP Forums

Author Message

<  Erlang bugs mailing list  ~  Bug in qlc

Luna
Posted: Fri Dec 01, 2006 1:29 pm Reply with quote
User Joined: 27 Feb 2005 Posts: 23
I'm wasting a really good obfuscated Erlang contribution here...

See code below.

qlc "A" works if you remove ", true".

Both work if you remove disc_only_copies.

This error occurs in R11B-2, but not in R11B-1.

/Daniel Luna

%% -*- erlang-indent-level: 2 -*-
-module(qlc_bug).
-compile(export_all).

-include_lib("stdlib/include/qlc.hrl").

provoke_error()->
application:set_env(mnesia,dir,"/tmp/"),
mnesia:create_schema([node()]),
ok = mnesia:start(),
case mnesia:create_table(blah,
[{disc_only_copies,[node()]},
{type,set}]) of
{atomic,ok} -> ok; {aborted,{already_exists,blah}} -> ok
end,

A= qlc:q([F || F <-mnesia:table(blah), (F band ((1 bsl 0)) =/= 0), true]),
{atomic,Result} = mnesia:transaction(fun() -> qlc:eval(A)end),
case is_list(Result) of
true -> io:format("List~n",[]);
false -> io:format("This should not happen!~nResult = ~p~n",[Result])
end,

B = qlc:q(["" || I <- mnesia:table(blah), any:function_call(I)]),
{atomic,BR} = mnesia:transaction(fun()->qlc:eval(B)end),
case is_list(BR) of
true -> io:format("List~n",[]);
false -> io:format("This should not happen!~nResult = ~p~n",[BR])
end.

_______________________________________________
erlang-bugs mailing list
erlang-bugs@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-bugs
Post recived from mailinglist
View user's profile Send private message Send e-mail
Guest
Posted: Fri Dec 08, 2006 7:48 am Reply with quote
Guest
[Daniel Luna:]
> See code below.
>
> qlc "A" works if you remove ", true".
>
> Both work if you remove disc_only_copies.
>
> This error occurs in R11B-2, but not in R11B-1.

Thanks for the bug report.

It seems that a modification in R11B-2 exposed a bug that has been
present for quite some time. The bug was triggered by the empty Dets
table, but could also show up when no object matches a given match
specification.

The following patch ensures that dets:match{_object}() and
dets:select() never return {[],Cont} which should solve the problem at
hand.

*** /usr/local/otp/releases/otp_beam_solaris8_r11b_patched/lib/stdlib-1.14.2/src/dets.erl Thu Nov 16 17:40:35 2006
--- dets.erl Wed Dec 6 12:43:19 2006
***************
*** 718,723 ****
--- 718,725 ----
false ->
badarg
end;
+ [] ->
+ chunk_match(NewState);
Terms ->
{Terms, NewState}
end;

The patch erl_898_otp_beam is available at the Licencees' Area
(http://www.erlang.se/lic_area/index.shtml).

Best regards,

Hans Bolinder, Erlang/OTP
_______________________________________________
erlang-bugs mailing list
erlang-bugs@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-bugs
Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum