From raphael-langerhorst@REDACTED Sat Aug 2 22:18:57 2008 From: raphael-langerhorst@REDACTED (Raphael Langerhorst) Date: Sat, 02 Aug 2008 22:18:57 +0200 Subject: [erlang-patches] [PATCH] make os_mon compile on NetBSD 4.0 Message-ID: <20080802201857.257260@gmx.net> Hi all, I just registered to this list (and to -questions), so hello everyone. Today I compiled R12B-3 from source on NetBSD/evbarm 4.0 Attached a patch is not complete, but shows where to find the vmparam.h file. The location is architecture dependend, so there need to be a check in configure, or makefile or wherever (I haven't looked that far into things). The rule for the include file is as follows: use "uname -m" to detect the architecture and use the output for the include path: #include <__arch__/vmparam.h> where __arch__ is the output of uname -m. This was the only error that occured while compiling R12B-3 on NetBSD 4.0 (no extra options to configure). Best Regards, Raphael -- GMX Kostenlose Spiele: Einfach online spielen und Spa? haben mit Pastry Passion! http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196 -------------- next part -------------- --- lib/os_mon/c_src/memsup.c.orig 2008-08-02 22:09:50.000000000 +0200 +++ lib/os_mon/c_src/memsup.c 2008-08-02 20:16:47.000000000 +0200 @@ -99,8 +99,13 @@ #include #include #ifndef __OpenBSD__ +#ifndef __NetBSD__ #include #endif +#endif +#ifdef __NetBSD__ +#include +#endif #ifdef __FreeBSD__ #include #endif From per@REDACTED Sun Aug 3 00:47:02 2008 From: per@REDACTED (Per Hedeland) Date: Sun, 3 Aug 2008 00:47:02 +0200 (CEST) Subject: [erlang-patches] [PATCH] make os_mon compile on NetBSD 4.0 In-Reply-To: <20080802201857.257260@gmx.net> Message-ID: <200808022247.m72Ml2Ou052662@pluto.hedeland.org> "Raphael Langerhorst" wrote: > >Attached a patch is not complete, but shows where to find the vmparam.h >file. The location is architecture dependend, so there need to be a >check in configure, or makefile or wherever (I haven't looked that far >into things). > >The rule for the include file is as follows: > >use "uname -m" to detect the architecture and use the output for the >include path: > >#include <__arch__/vmparam.h> > >where __arch__ is the output of uname -m. No, you shouldn't need to modify such things depending on the host architecture on any Unix version. The correct directive for that file on NetBSD (I checked 3.1 and 4.0 i386) is #include Whether this actually makes memsup *work* on NetBSD is another thing - I haven't tried that, but from a quick look it seems that as-is, it will exit with "unsupported_os". --Per Hedeland From thehangedman@REDACTED Mon Aug 4 17:08:50 2008 From: thehangedman@REDACTED (Andrey Tsirulev) Date: Mon, 4 Aug 2008 19:08:50 +0400 Subject: [erlang-patches] SSH does not send SSH_MSG_CHANNEL_SUCCESS Message-ID: <200808041908.51015.thehangedman@tyndra.ru> Hello, According to RFC4254 (section 5.4), SSH_MSG_CHANNEL_REQUEST packet, sent e.g. to start shell or allocate pty, needs answer (SSH_MSG_CHANNEL_SUCCESS or SSH_MSG_CHANNEL_FAILURE) if request's 'want reply' field is set to true. ssh_cm module (R12B-3) never sends SSH_MSG_CHANNEL_SUCCESS packet. It results in hanging session after login, if ssh client sets 'want reply' in its 'shell' or 'pty-req' request, and waits for reply. The bug is reproducible with putty 0.60 windows client. -------------- next part -------------- A non-text attachment was scrubbed... Name: ssh_cm.erl.diff Type: text/x-diff Size: 2859 bytes Desc: not available URL: From ingela@REDACTED Thu Aug 7 10:40:37 2008 From: ingela@REDACTED (Ingela Anderton Andin) Date: Thu, 07 Aug 2008 10:40:37 +0200 Subject: [erlang-patches] SSH does not send SSH_MSG_CHANNEL_SUCCESS In-Reply-To: <200808041908.51015.thehangedman@tyndra.ru> References: <200808041908.51015.thehangedman@tyndra.ru> Message-ID: <489AB505.6000809@erix.ericsson.se> Hi Andrey, thank you for your patch suggstion. I am just in the middel of remodeling the ssh-code to fit it into a OTP-supervison tree so the code has changed quite a lot, but I will take this aspect into the equation. Regards Ingela, Erlang/OTP -Ericsson Andrey Tsirulev wrote: > Hello, > > According to RFC4254 (section 5.4), SSH_MSG_CHANNEL_REQUEST packet, sent e.g. to start shell or allocate pty, needs answer (SSH_MSG_CHANNEL_SUCCESS or > SSH_MSG_CHANNEL_FAILURE) if request's 'want reply' field is set to true. > > ssh_cm module (R12B-3) never sends SSH_MSG_CHANNEL_SUCCESS packet. It results in hanging session after login, if ssh client sets 'want reply' in its 'shell' or 'pty-req' request, and > waits for reply. > > The bug is reproducible with putty 0.60 windows client. > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-patches From matthew@REDACTED Tue Aug 12 08:11:49 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Tue, 12 Aug 2008 01:11:49 -0500 Subject: [erlang-patches] [erlang-bugs] xmerl_xpath doesn't handle "//@*" correctly? In-Reply-To: References: Message-ID: Here is a patch for a handful of XPath bugs I found while trying to track down the previous issue. The first four hunks and the seventh hunk fix the handling of 'preceding', 'preceding-sibling', 'following', and 'following-sibling' to handle when the context nodeset includes a text node. E.g., "//text()/preceding::*" or "//b/following::text()" against "xx". The fifth hunk fixes match_attribute to not throw away any accumulated context nodes just because a non-element node was tested. E.g., "//@*" against "x". The sixth hunk fixes xmerl_xpath.erl to compile correctly when -Ddebug=true is given. (I'm not an xpath guru, so someone should double check that my test cases aren't bogus. I just used http://www.whitebeam.org/library/guide/TechNotes/xpathtestbed.rhtm as a sanity check.) --- xmerl_xpath.erl.orig 2008-08-12 00:28:54.000000000 -0500 +++ xmerl_xpath.erl 2008-08-12 00:50:16.000000000 -0500 @@ -525,7 +525,7 @@ match_following_sibling(Tok, N, Acc, Con case Ps of [#xmlNode{type = element, node = #xmlElement{} = PNode}|_] -> - FollowingSiblings = lists:nthtail(Node#xmlElement.pos, + FollowingSiblings = lists:nthtail(get_position(Node), get_content(PNode)), lists:foldr( fun(E, AccX) -> @@ -553,7 +553,7 @@ match_following(Tok, N, Acc, Context) -> case Ps of [#xmlNode{type = element, node = #xmlElement{} = PNode}|_] -> - FollowingSiblings = lists:nthtail(Node#xmlElement.pos, + FollowingSiblings = lists:nthtail(get_position(Node), get_content(PNode)), lists:foldr( fun(E, AccX) -> @@ -588,7 +588,7 @@ match_preceding_sibling(Tok, N, Acc, Con [#xmlNode{type = element, node = #xmlElement{} = PNode}|_] -> PrecedingSiblings = lists:sublist(get_content(PNode), 1, - Node#xmlElement.pos-1), + get_position(Node) - 1), lists:foldr( fun(E, AccX) -> ThisN = #xmlNode{type = node_type(E), @@ -616,7 +616,7 @@ match_preceding(Tok, N, Acc, Context) -> [#xmlNode{type = element, node = #xmlElement{} = PNode}|_] -> PrecedingSiblings = lists:sublist(get_content(PNode), 1, - Node#xmlElement.pos-1), + get_position(Node) - 1), lists:foldr( fun(E, AccX) -> ThisN = #xmlNode{type = node_type(E), @@ -655,7 +655,7 @@ match_attribute(Tok, N, Acc, Context) -> end end, Acc, E#xmlElement.attributes); _Other -> - [] + Acc end. node_type(#xmlAttribute{}) -> attribute; @@ -736,12 +736,12 @@ node_test({name, {_Tag, Prefix, Local}}, case expanded_name(Prefix, Local, Context) of [] -> ?dbg("node_test(~p, ~p) -> ~p.~n", - [{Tag, Prefix, Local}, write_node(Name), false]), + [{_Tag, Prefix, Local}, write_node(Name), false]), false; ExpName -> Res = (ExpName == {NS#xmlNamespace.default,Name}), ?dbg("node_test(~p, ~p) -> ~p.~n", - [{Tag, Prefix, Local}, write_node(Name), Res]), + [{_Tag, Prefix, Local}, write_node(Name), Res]), Res end; node_test({name, {Tag,_Prefix,_Local}}, @@ -811,4 +811,11 @@ get_content(#xmlElement{content = F} = E get_content(#xmlDocument{content = C}) when list(C) -> C; get_content(#xmlDocument{content = C}) -> - [C]. + [C]; +get_content(#xmlText{}) -> + []. + +get_position(#xmlElement{pos = N}) -> + N; +get_position(#xmlText{pos = N}) -> + N. From bertil.karlsson@REDACTED Tue Aug 12 12:58:00 2008 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Tue, 12 Aug 2008 12:58:00 +0200 Subject: [erlang-patches] [erlang-bugs] xmerl_xpath doesn't handle "//@*" correctly? In-Reply-To: References: Message-ID: <48A16CB8.5030606@ericsson.com> Matthew, thanks for this. It will be included in the next patch. /Bertil Matthew Dempsky wrote: > Here is a patch for a handful of XPath bugs I found while trying to > track down the previous issue. > > The first four hunks and the seventh hunk fix the handling of > 'preceding', 'preceding-sibling', 'following', and 'following-sibling' > to handle when the context nodeset includes a text node. E.g., > "//text()/preceding::*" or "//b/following::text()" against > "xx". > > The fifth hunk fixes match_attribute to not throw away any accumulated > context nodes just because a non-element node was tested. E.g., > "//@*" against "x". > > The sixth hunk fixes xmerl_xpath.erl to compile correctly when > -Ddebug=true is given. > > (I'm not an xpath guru, so someone should double check that my test > cases aren't bogus. I just used > http://www.whitebeam.org/library/guide/TechNotes/xpathtestbed.rhtm as > a sanity check.) > > --- xmerl_xpath.erl.orig 2008-08-12 00:28:54.000000000 -0500 > +++ xmerl_xpath.erl 2008-08-12 00:50:16.000000000 -0500 > @@ -525,7 +525,7 @@ match_following_sibling(Tok, N, Acc, Con > case Ps of > [#xmlNode{type = element, > node = #xmlElement{} = PNode}|_] -> > - FollowingSiblings = lists:nthtail(Node#xmlElement.pos, > + FollowingSiblings = lists:nthtail(get_position(Node), > get_content(PNode)), > lists:foldr( > fun(E, AccX) -> > @@ -553,7 +553,7 @@ match_following(Tok, N, Acc, Context) -> > case Ps of > [#xmlNode{type = element, > node = #xmlElement{} = PNode}|_] -> > - FollowingSiblings = lists:nthtail(Node#xmlElement.pos, > + FollowingSiblings = lists:nthtail(get_position(Node), > get_content(PNode)), > lists:foldr( > fun(E, AccX) -> > @@ -588,7 +588,7 @@ match_preceding_sibling(Tok, N, Acc, Con > [#xmlNode{type = element, > node = #xmlElement{} = PNode}|_] -> > PrecedingSiblings = lists:sublist(get_content(PNode), 1, > - Node#xmlElement.pos-1), > + get_position(Node) - 1), > lists:foldr( > fun(E, AccX) -> > ThisN = #xmlNode{type = node_type(E), > @@ -616,7 +616,7 @@ match_preceding(Tok, N, Acc, Context) -> > [#xmlNode{type = element, > node = #xmlElement{} = PNode}|_] -> > PrecedingSiblings = lists:sublist(get_content(PNode), 1, > - Node#xmlElement.pos-1), > + get_position(Node) - 1), > lists:foldr( > fun(E, AccX) -> > ThisN = #xmlNode{type = node_type(E), > @@ -655,7 +655,7 @@ match_attribute(Tok, N, Acc, Context) -> > end > end, Acc, E#xmlElement.attributes); > _Other -> > - [] > + Acc > end. > > node_type(#xmlAttribute{}) -> attribute; > @@ -736,12 +736,12 @@ node_test({name, {_Tag, Prefix, Local}}, > case expanded_name(Prefix, Local, Context) of > [] -> > ?dbg("node_test(~p, ~p) -> ~p.~n", > - [{Tag, Prefix, Local}, write_node(Name), false]), > + [{_Tag, Prefix, Local}, write_node(Name), false]), > false; > ExpName -> > Res = (ExpName == {NS#xmlNamespace.default,Name}), > ?dbg("node_test(~p, ~p) -> ~p.~n", > - [{Tag, Prefix, Local}, write_node(Name), Res]), > + [{_Tag, Prefix, Local}, write_node(Name), Res]), > Res > end; > node_test({name, {Tag,_Prefix,_Local}}, > @@ -811,4 +811,11 @@ get_content(#xmlElement{content = F} = E > get_content(#xmlDocument{content = C}) when list(C) -> > C; > get_content(#xmlDocument{content = C}) -> > - [C]. > + [C]; > +get_content(#xmlText{}) -> > + []. > + > +get_position(#xmlElement{pos = N}) -> > + N; > +get_position(#xmlText{pos = N}) -> > + N. > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-patches > > From blaine.whittle@REDACTED Wed Aug 13 04:50:55 2008 From: blaine.whittle@REDACTED (Blaine Whittle) Date: Tue, 12 Aug 2008 19:50:55 -0700 Subject: [erlang-patches] fix for the win32 filename with space execution bug Message-ID: <65f40dd0808121950ge532195q368f7ceb92d57c9d@mail.gmail.com> This patch is for $ER_TOP/erts/emulator/sys/win32 and fixes a bug affecting os:cmd and open_port + spawn on winnt systems that prevents execution of child processes containing spaces in the filename or path string. It appears that the original code allowed for the file name and / or path to be enclosed in double quotes. For instance parse_command searches for the first occurrence of a space outside an opening closing pair of double quotes. The location of that space is used to split the application and its path from any command line arguments. The actual bug occurs when the applications' file name and path are passed to the windows API GetFileAttributes with the quotes still intact in the function ApplicationType. Since ApplicationType does some file searching by appending .com, .exe, .bat to the filename, I figured it would be best to strip the quotes from the command string before calling ApplicationType, however the code could just as easily be placed in ApplicationType. On a side note, it appears that GetFileAttributes is called in places and it's possible that the same kind of quote scrubbing may be required in other source files. While I'm sure there is a easier way to strip characters from a string, I removed the characters using strtok within a loop using double quotes character as the token delimited and then appended the results using strncat into a new string. As for a test case, I have Visual Studio 2005 installed at C:\Program Files\Microsoft Visual Studio 8\ (its default location, however the actual installed location can be found in the registry.) In order to fetch the build number for Visual Stuudio 2005, execute the following command line C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com /? and grab the version number from the first line. To execute devenv.com (assuming that it is NOT in your path) via command.comthe application and file path need to be wrapped in double quotes. cmd /c "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com" /? It's important that the command line options (in this case /?) are located outside the double quotes. Without this patch, the following erlang expression fails however should work after patching and building os:cmd("\"C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\IDE\\ devenv.com\" /?"). The following two erlang expressions should always fail (with or without patch) No double quotes -- C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ devenv.com /? os:cmd("C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\IDE\\ devenv.com /?"). Command line parameters inside the quotes used for the filename - "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com/?" os:cmd("\"C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\IDE\\ devenv.com /?\""). --- sys-orig.c 2008-06-10 05:47:26.000000000 -0700 +++ sys.c 2008-08-11 15:17:56.052245700 -0700 @@ -1186,6 +1186,8 @@ char execPath[MAX_PATH]; int cmdlength; char* thecommand; + char* fixedcommand; + char * pch; HANDLE hProcess = GetCurrentProcess(); siStartInfo.cb = sizeof(STARTUPINFO); @@ -1200,13 +1202,29 @@ */ cmdlength = parse_command(origcmd); thecommand = (char *) erts_alloc(ERTS_ALC_T_TMP, cmdlength+1); + strncpy(thecommand, origcmd, cmdlength); thecommand[cmdlength] = '\0'; - DEBUGF(("spawn command: %s\n", thecommand)); + + fixedcommand = (char *) erts_alloc(ERTS_ALC_T_TMP, cmdlength+1); + fixedcommand[0] = '\0'; + pch = strtok(thecommand,"\""); + if (pch == NULL) { + strncpy(fixedcommand, origcmd, cmdlength); + fixedcommand[cmdlength] = '\0'; + } + else { + while (pch != NULL) { + strncat(fixedcommand, pch, strlen(pch)); + pch = strtok(NULL, "\""); + } + } - applType = ApplicationType(thecommand, execPath); - DEBUGF(("ApplicationType returned for (%s) is %d\n", thecommand, applType)); + DEBUGF(("spawn command: %s\n", thecommand)); + applType = ApplicationType(fixedcommand, execPath); + DEBUGF(( "ApplicationType returned for (%s) is %d\n", fixedcommand, applType)); erts_free(ERTS_ALC_T_TMP, (void *) thecommand); + erts_free(ERTS_ALC_T_TMP, (void *) fixedcommand); if (applType == APPL_NONE) { return FALSE; } -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Fri Aug 15 20:57:44 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 15 Aug 2008 13:57:44 -0500 Subject: [erlang-patches] More xpath issues: following and preceding axes not correct Message-ID: The comments in xmerl_xpath explain that the 'following' and 'preceding' axes are interpreted as "following (resp. preceding) siblings and their descendants", but the XPath spec implies that they should include *all* following and preceding nodes when it states that The ancestor, descendant, following, preceding and self axes partition a document (ignoring attribute and namespace nodes): they do not overlap and together they contain all the nodes in the document. E.g., against the XML document below, "//g/preceding::*" should include elements b, c, d, and e; and "//g/following::*" should include h, i, j, and k (both in order): The patch below corrects this. However, I'm afraid of silly white space conflicts (particularly with my last patch), so I just want to make sure to point out that the calls to match_desc() in match_following() and match_preceding() had the argument ordering for Tok and Ps swapped. --- xmerl_xpath.erl 2008-08-15 13:37:13.000000000 -0500 +++ xmerl_xpath.erl.patched 2008-08-15 13:43:40.000000000 -0500 @@ -547,12 +547,12 @@ %% "The 'following' axis contains all nodes in the same document as the %% context node that are after the context node in document order, excluding %% any descendants and excluding attribute nodes and namespace nodes." -%% (UW: I interpret this as "following siblings and their descendants") match_following(Tok, N, Acc, Context) -> #xmlNode{parents = Ps, node = Node} = N, case Ps of [#xmlNode{type = element, - node = #xmlElement{} = PNode}|_] -> + node = #xmlElement{} = PNode} = P|_] -> + Acc0 = match_following(Tok, P, Acc, Context), FollowingSiblings = lists:nthtail(get_position(Node), get_content(PNode)), lists:foldr( @@ -560,15 +560,14 @@ ThisN = #xmlNode{type = node_type(E), node = E, parents = Ps}, - Acc1 = - case node_test(Tok, ThisN, Context) of - true -> - [ThisN|AccX]; - false -> - AccX - end, - match_desc(get_content(E), Tok, Ps, Acc1, Context) - end, Acc, FollowingSiblings); + Acc1 = match_desc(get_content(E), Ps, Tok, AccX, Context), + case node_test(Tok, ThisN, Context) of + true -> + [ThisN|Acc1]; + false -> + Acc1 + end + end, Acc0, FollowingSiblings); _Other -> Acc end. @@ -609,30 +608,29 @@ %% "The 'preceding' axis contains all nodes in the same document as the context %% node that are before the context node in document order, exluding any %% ancestors and excluding attribute nodes and namespace nodes." -%% (UW: I interpret this as "preceding siblings and their descendants".) match_preceding(Tok, N, Acc, Context) -> #xmlNode{parents = Ps, node = Node} = N, case Ps of [#xmlNode{type = element, - node = #xmlElement{} = PNode}|_] -> + node = #xmlElement{} = PNode} = P|_] -> + Acc0 = match_preceding(Tok, P, Acc, Context), PrecedingSiblings = lists:sublist(get_content(PNode), 1, get_position(Node)-1), - lists:foldr( + lists:foldl( fun(E, AccX) -> ThisN = #xmlNode{type = node_type(E), node = E, parents = Ps}, - Acc1 = - case node_test(Tok, ThisN, Context) of - true -> - [ThisN|AccX]; - false -> - AccX - end, - match_desc(get_content(E), Tok, Ps, Acc1, Context) - end, Acc, PrecedingSiblings); + Acc1 = case node_test(Tok, ThisN, Context) of + true -> + [ThisN|AccX]; + false -> + AccX + end, + match_desc(get_content(E), Ps, Tok, Acc1, Context) + end, Acc0, PrecedingSiblings); _Other -> - [] + Acc end. From matthew@REDACTED Fri Aug 15 21:13:40 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 15 Aug 2008 14:13:40 -0500 Subject: [erlang-patches] patch for xmerl_xpath_parse: 'mod' operator not parsed correctly Message-ID: The patch below fixes a typo in the XPath yecc grammar for parsing 'mod' expressions: --- xmerl_xpath_parse.yrl~ 2006-05-04 10:38:38.000000000 -0500 +++ xmerl_xpath_parse.yrl 2008-08-15 14:05:40.000000000 -0500 @@ -259,10 +259,10 @@ 'MultiplicativeExpr' -> 'UnaryExpr' : '$1' . 'MultiplicativeExpr' -> 'MultiplicativeExpr' 'MultiplyOperator' 'UnaryExpr' : {arith, '$2', '$1', '$3'} . -'MultiplicativeExpr' -> 'MultiplicativeExpr' 'div' 'UnaryExpr' +'MultiplicativeExpr' -> 'MultiplicativeExpr' 'div' 'UnaryExpr' : {arith, 'div', '$1', '$3'} . -'MultiplicativeExpr' -> 'MultiplicativeExpr' 'mod' 'UnaryExpr' : - {arith, 'mod', '$1', '$2'} . +'MultiplicativeExpr' -> 'MultiplicativeExpr' 'mod' 'UnaryExpr' + : {arith, 'mod', '$1', '$3'} . %% [27] From matthew@REDACTED Fri Aug 15 22:10:18 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 15 Aug 2008 15:10:18 -0500 Subject: [erlang-patches] Another xmerl_xpath patch: 'descendant' axis should return nodes in document order Message-ID: The XPath spec (implicitly) states that the descendants axis is a forward axis and therefore it should return nodes in document order: An axis is either a forward axis or a reverse axis. An axis that only ever contains the context node or nodes that are after the context node in document order is a forward axis. An axis that only ever contains the context node or nodes that are before the context node in document order is a reverse axis. Thus, the ancestor, ancestor-or-self, preceding, and preceding-sibling axes are reverse axes; all other axes are forward axes. Document order places elements before their children: There is an ordering, document order, defined on all the nodes in the document corresponding to the order in which the first character of the XML representation of each node occurs in the XML representation of the document after expansion of general entities. Thus, the root node will be the first node. Element nodes occur before their children. Therefore, "/descendant-or-self::*" applied to "" should return a, b, c, d, e, f, and g in that order. The patch below corrects this. Also, it corrects ancestor-or-self to be properly recognized as a reverse axis. --- xmerl_xpath.erl.patched 2008-08-15 13:43:40.000000000 -0500 +++ xmerl_xpath.erl 2008-08-15 15:07:24.000000000 -0500 @@ -365,6 +365,8 @@ fwd_or_reverse(ancestor, Context) -> reverse_axis(Context); +fwd_or_reverse(ancestor_or_self, Context) -> + reverse_axis(Context); fwd_or_reverse(preceding_sibling, Context) -> reverse_axis(Context); fwd_or_reverse(preceding, Context) -> @@ -408,25 +410,25 @@ node = E, parents = Parents}, NewParents = [N|Parents], - Acc1 = case node_test(Tok, N, Context) of - true -> - [N|Acc]; - false -> - Acc - end, + Acc1 = match_desc(T, Parents, Tok, Acc, Context), Acc2 = match_desc(get_content(E), NewParents, Tok, Acc1, Context), - match_desc(T, Parents, Tok, Acc2, Context); + case node_test(Tok, N, Context) of + true -> + [N|Acc2]; + false -> + Acc2 + end; match_desc([E|T], Parents, Tok, Acc, Context) -> N = #xmlNode{node = E, type = node_type(E), parents = Parents}, - Acc1 = case node_test(Tok, N, Context) of - true -> - [N|Acc]; - false -> - Acc - end, - match_desc(T, Parents, Tok, Acc1, Context); + Acc1 = match_desc(T, Parents, Tok, Acc, Context), + case node_test(Tok, N, Context) of + true -> + [N|Acc1]; + false -> + Acc1 + end; match_desc([], _Parents, _Tok, Acc, _Context) -> Acc. @@ -435,13 +437,13 @@ %% "The 'descendant-or-self' axis contains the context node and the %% descendants of the context node." match_descendant_or_self(Tok, N, Acc, Context) -> - Acc1 = case node_test(Tok, N, Context) of - true -> - [N|Acc]; - false -> - Acc - end, - match_descendant(Tok, N, Acc1, Context). + Acc1 = match_descendant(Tok, N, Acc, Context), + case node_test(Tok, N, Context) of + true -> + [N|Acc1]; + false -> + Acc1 + end. match_child(Tok, N, Acc, Context) -> From matthew@REDACTED Fri Aug 15 22:53:19 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 15 Aug 2008 15:53:19 -0500 Subject: [erlang-patches] xmerl_xpath does not handle "/" Message-ID: The xpath parser has special support for handling the expression "/", but the xpath interpreter doesn't handle the resulting parse tree. "/" against "" should return the entire xmlDocument. (I feel this patch is slightly hackish, but it's the least intrusive way to handle this, and this is the only way the path expression can be '/'.) --- xmerl_xpath.erl.patched 2008-08-15 13:43:40.000000000 -0500 +++ xmerl_xpath.erl 2008-08-15 15:22:55.000000000 -0500 @@ -236,7 +236,9 @@ acc = Acc}) -> ?dbg("PredExpr = ~p~n", [PredExpr]), NewContext = axis(Axis, NodeTest, C, Acc), - pred_expr(PredExpr, S#state{context = NewContext}). + pred_expr(PredExpr, S#state{context = NewContext}); +path_expr('/', S) -> + S. From matthew@REDACTED Fri Aug 15 23:02:45 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 15 Aug 2008 16:02:45 -0500 Subject: [erlang-patches] Another xmerl_xpath patch: 'descendant' axis should return nodes in document order In-Reply-To: References: Message-ID: I just realized this patch causes regressions with my earlier patch for the 'preceding' axis. I'm currently looking for a comprehensive XPath test suite, and I'll try to instead submit one large patch (or at least a handful at once) once I've been able to do that. From klacke@REDACTED Fri Aug 15 23:06:48 2008 From: klacke@REDACTED (Claes Wikstrom) Date: Fri, 15 Aug 2008 23:06:48 +0200 Subject: [erlang-patches] ssh pty client Message-ID: <48A5EFE8.8020805@hyber.org> Don't know if this is fixed in R12 - we're still at R11. Anyway the code that allocates a pty from the client side is broken. This is need for all shell ssh clients. The OTP code has never run. Here is the patch for R11. /klacke Index: ssh_cm.erl =================================================================== --- ssh_cm.erl (revision 18567) +++ ssh_cm.erl (working copy) @@ -1336,8 +1336,12 @@ [{Op, Value} | decode_pty_opts2(Tail)]. - -encode_pty_opts([{Opt,Value} | Opts]) -> +encode_pty_opts(Opts) -> + B = list_to_binary(encode_pty_opts2(Opts)), + Len = size(B), + <>. + +encode_pty_opts2([{Opt,Value} | Opts]) -> Code = case Opt of vintr -> ?VINTR; vquit -> ?VQUIT; @@ -1395,8 +1399,8 @@ tty_op_ispeed -> ?TTY_OP_ISPEED; tty_op_ospeed -> ?TTY_OP_OSPEED end, - [Code, ?uint32(Value) | encode_pty_opts(Opts)]; -encode_pty_opts([]) -> + [Code, ?uint32(Value) | encode_pty_opts2(Opts)]; +encode_pty_opts2([]) -> [?TTY_OP_END]. From matthew@REDACTED Sat Aug 16 06:22:40 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Fri, 15 Aug 2008 23:22:40 -0500 Subject: [erlang-patches] Comprehensive xmerl_xpath patch Message-ID: Below is a comprehensive patch including all of the changes I've made based on pristine R12B-3 (the get_content() change in my first patch isn't actually needed). Also included is a small test suite covering a handful of basic cases. Issues fixed: - fixes matching against attributes when the context node set includes non-element nodes (from original patch) - fixes a compile error when using -Ddebug=true (from original patch) - fixes handling of 'following', 'following-sibling', 'preceding', and 'preceding-sibling' axes when the context node set includes a text node (from original patch) - fixes parse error for expressions using the 'mod' operator - fixes "/" to evaluate to the document node - fixes "[N]" short-circuit logic to work correctly when using a reverse axis - fixes the "ancestor-or-self" axis to be recognized as a reverse axis - fixes axis handling to consistently return nodes in document order The code is also refactored a bit to reuse match_self() and match_descendant_or_self() where possible rather than reimplementing them for other axes. (Assuming I can refrain from digging into the code more, hopefully this is my last email to erlang-patches@ about this. ;-) test() -> [begin {Doc, _} = xmerl_scan:string(XML), [test(XML, Doc, XPath, Exp) || {XPath, Exp} <- Tests] end || {XML, Tests} <- tests()], ok. test(XML, Doc, XPath, Exp) -> Result = xmerl_xpath:string(XPath, Doc), Got = [Name || #xmlElement{name = Name} <- Result], if Exp =:= Got -> ok; true -> io:format("XML = ~s.~nXPath = ~s.~nExp = ~p.~nGot = ~p.~n~n", [XML, XPath, Exp, Got]) end. tests() -> [{" ", [{"//b/following::*", [c, d, e]}, {"//b/following::*[1]", [c]}, {"//b/following::*[position()=1]", [c]}, {"//b/following::*[3]", [e]}, {"//b/following::*[position()=3]", [e]}, {"//e/preceding::*", [b, c, d]}, {"//e/preceding::*[1]", [d]}, {"//e/preceding::*[position()=1]", [d]}, {"//e/preceding::*[3]", [b]}, {"//e/preceding::*[position()=3]", [b]}, {"//b/following::*[position() mod 2=0]", [d]}, {"//b/self::*", [b]} ]}, {" ", [{"//g/preceding::*", [b, c, d, e]}, {"//g/following::*", [h, i, j, k]}, {"//g/ancestor::*", [a, f]}, {"//g/ancestor::*[1]", [f]}, {"//g/ancestor::*[2]", [a]}, {"//g/ancestor-or-self::*", [a, f, g]}, {"//g/ancestor-or-self::*[1]", [g]}, {"//g/ancestor-or-self::*[2]", [f]}, {"//g/ancestor-or-self::*[3]", [a]}, {"/descendant::*", [a, b, c, d, e, f, g, h, i, j, k]}, {"//f/preceding-sibling::*", [b, c, e]}, {"//f/following-sibling::*", [h, i, k]}, {"//f/self::*", [f]}, {"//f/ancestor::*", [a]}, {"//f/descendant::*", [g]}, {"//f/preceding::*", [b, c, d, e]}, {"//f/following::*", [h, i, j, k]}, {"//text()[1]/following-sibling::*", [c, e, f, h, i, k]} ]} ]. --- xmerl_xpath_parse.yrl~ 2006-05-04 10:38:38.000000000 -0500 +++ xmerl_xpath_parse.yrl 2008-08-15 14:05:40.000000000 -0500 @@ -259,10 +259,10 @@ 'MultiplicativeExpr' -> 'UnaryExpr' : '$1' . 'MultiplicativeExpr' -> 'MultiplicativeExpr' 'MultiplyOperator' 'UnaryExpr' : {arith, '$2', '$1', '$3'} . -'MultiplicativeExpr' -> 'MultiplicativeExpr' 'div' 'UnaryExpr' +'MultiplicativeExpr' -> 'MultiplicativeExpr' 'div' 'UnaryExpr' : {arith, 'div', '$1', '$3'} . -'MultiplicativeExpr' -> 'MultiplicativeExpr' 'mod' 'UnaryExpr' : - {arith, 'mod', '$1', '$2'} . +'MultiplicativeExpr' -> 'MultiplicativeExpr' 'mod' 'UnaryExpr' + : {arith, 'mod', '$1', '$3'} . %% [27] --- xmerl_xpath.erl~ 2008-08-15 22:36:56.000000000 -0500 +++ xmerl_xpath.erl 2008-08-15 22:59:37.000000000 -0500 @@ -148,7 +148,7 @@ Context=(new_context(Options))#xmlContext{context_node = ContextNode, whole_document = WholeDoc}, %io:format("string Context=~p~n",[Context]), - #state{context = NewContext} = match(Str, #state{context = Context}), + #state{context = NewContext} = match(Str, #state{context = Context}), %io:format("string NewContext=~p~n",[NewContext]), [N || #xmlNode{node = N} <- NewContext#xmlContext.nodeset]. @@ -236,7 +236,9 @@ acc = Acc}) -> ?dbg("PredExpr = ~p~n", [PredExpr]), NewContext = axis(Axis, NodeTest, C, Acc), - pred_expr(PredExpr, S#state{context = NewContext}). + pred_expr(PredExpr, S#state{context = NewContext}); +path_expr('/', S) -> + S. @@ -250,9 +252,16 @@ %% simple case: the predicate is a number, e.g. para[5]. %% No need to iterate over all nodes in the nodeset; we know what to do. %% -eval_pred({number, N}, S = #state{context = C = #xmlContext{nodeset = NS}}) -> - case length(NS)>=N of +eval_pred({number, N0}, S = #state{context = C = #xmlContext{nodeset = NS, axis_type = AxisType}}) -> + Len = length(NS), + case Len>=N0 of true -> + N = case AxisType of + forward -> + N0; + reverse -> + Len + 1 - N0 + end, NewNodeSet = [lists:nth(N, NS)], NewContext = C#xmlContext{nodeset = NewNodeSet}, S#state{context = NewContext}; @@ -365,6 +374,8 @@ fwd_or_reverse(ancestor, Context) -> reverse_axis(Context); +fwd_or_reverse(ancestor_or_self, Context) -> + reverse_axis(Context); fwd_or_reverse(preceding_sibling, Context) -> reverse_axis(Context); fwd_or_reverse(preceding, Context) -> @@ -378,11 +389,9 @@ Context#xmlContext{axis_type = forward}. - match_self(Tok, N, Acc, Context) -> case node_test(Tok, N, Context) of true -> - %io:format("node_test -> true.~n", []), [N|Acc]; false -> Acc @@ -393,7 +402,6 @@ #xmlNode{parents = Ps, node = Node, type = Type} = N, case Type of El when El == element; El == root_node -> -% element -> NewPs = [N|Ps], match_desc(get_content(Node), NewPs, Tok, Acc, Context); _Other -> @@ -404,44 +412,29 @@ % match_desc(Content, Parents, Tok, [], Context). match_desc([E = #xmlElement{}|T], Parents, Tok, Acc, Context) -> + Acc1 = match_desc(T, Parents, Tok, Acc, Context), N = #xmlNode{type = node_type(E), node = E, parents = Parents}, NewParents = [N|Parents], - Acc1 = case node_test(Tok, N, Context) of - true -> - [N|Acc]; - false -> - Acc - end, Acc2 = match_desc(get_content(E), NewParents, Tok, Acc1, Context), - match_desc(T, Parents, Tok, Acc2, Context); + match_self(Tok, N, Acc2, Context); match_desc([E|T], Parents, Tok, Acc, Context) -> + Acc1 = match_desc(T, Parents, Tok, Acc, Context), N = #xmlNode{node = E, type = node_type(E), parents = Parents}, - Acc1 = case node_test(Tok, N, Context) of - true -> - [N|Acc]; - false -> - Acc - end, - match_desc(T, Parents, Tok, Acc1, Context); + match_self(Tok, N, Acc1, Context); match_desc([], _Parents, _Tok, Acc, _Context) -> Acc. - + %% "The 'descendant-or-self' axis contains the context node and the %% descendants of the context node." match_descendant_or_self(Tok, N, Acc, Context) -> - Acc1 = case node_test(Tok, N, Context) of - true -> - [N|Acc]; - false -> - Acc - end, - match_descendant(Tok, N, Acc1, Context). + Acc1 = match_descendant(Tok, N, Acc, Context), + match_self(Tok, N, Acc1, Context). match_child(Tok, N, Acc, Context) -> @@ -455,12 +448,7 @@ ThisN = #xmlNode{type = node_type(E), node = E, parents = NewPs}, - case node_test(Tok, ThisN, Context) of - true -> - [ThisN|AccX]; - false -> - AccX - end + match_self(Tok, ThisN, AccX, Context) end, Acc, get_content(Node)); _Other -> Acc @@ -474,12 +462,7 @@ [] -> Acc; [PN|_] -> - case node_test(Tok, PN, Context) of - true -> - [PN|Acc]; - false -> - Acc - end + match_self(Tok, PN, Acc, Context) end. @@ -489,14 +472,9 @@ %% always include the root node, unless the context node is the root node." match_ancestor(Tok, N, Acc, Context) -> Parents = N#xmlNode.parents, - lists:foldr( + lists:foldl( fun(PN, AccX) -> - case node_test(Tok, PN, Context) of - true -> - [PN|AccX]; - false -> - AccX - end + match_self(Tok, PN, AccX, Context) end, Acc, Parents). @@ -506,12 +484,7 @@ %% of the context node; thus, the acestor axis will always include the %% root node." match_ancestor_or_self(Tok, N, Acc, Context) -> - Acc1 = case node_test(Tok, N, Context) of - true -> - [N|Acc]; - false -> - Acc - end, + Acc1 = match_self(Tok, N, Acc, Context), match_ancestor(Tok, N, Acc1, Context). @@ -525,19 +498,14 @@ case Ps of [#xmlNode{type = element, node = #xmlElement{} = PNode}|_] -> - FollowingSiblings = lists:nthtail(Node#xmlElement.pos, + FollowingSiblings = lists:nthtail(get_position(Node), get_content(PNode)), lists:foldr( fun(E, AccX) -> ThisN = #xmlNode{type = node_type(E), node = E, parents = Ps}, - case node_test(Tok, ThisN, Context) of - true -> - [ThisN|AccX]; - false -> - AccX - end + match_self(Tok, ThisN, AccX, Context) end, Acc, FollowingSiblings); _Other -> Acc @@ -547,28 +515,21 @@ %% "The 'following' axis contains all nodes in the same document as the %% context node that are after the context node in document order, excluding %% any descendants and excluding attribute nodes and namespace nodes." -%% (UW: I interpret this as "following siblings and their descendants") match_following(Tok, N, Acc, Context) -> #xmlNode{parents = Ps, node = Node} = N, case Ps of [#xmlNode{type = element, - node = #xmlElement{} = PNode}|_] -> - FollowingSiblings = lists:nthtail(Node#xmlElement.pos, + node = #xmlElement{} = PNode} = P|_] -> + Acc0 = match_following(Tok, P, Acc, Context), + FollowingSiblings = lists:nthtail(get_position(Node), get_content(PNode)), lists:foldr( fun(E, AccX) -> ThisN = #xmlNode{type = node_type(E), node = E, parents = Ps}, - Acc1 = - case node_test(Tok, ThisN, Context) of - true -> - [ThisN|AccX]; - false -> - AccX - end, - match_desc(get_content(E), Tok, Ps, Acc1, Context) - end, Acc, FollowingSiblings); + match_descendant_or_self(Tok, ThisN, AccX, Context) + end, Acc0, FollowingSiblings); _Other -> Acc end. @@ -588,51 +549,39 @@ [#xmlNode{type = element, node = #xmlElement{} = PNode}|_] -> PrecedingSiblings = lists:sublist(get_content(PNode), 1, - Node#xmlElement.pos-1), + get_position(Node) - 1), lists:foldr( fun(E, AccX) -> ThisN = #xmlNode{type = node_type(E), node = E, parents = Ps}, - case node_test(Tok, ThisN, Context) of - true -> - [ThisN|AccX]; - false -> - AccX - end + match_self(Tok, ThisN, AccX, Context) end, Acc, PrecedingSiblings); _Other -> - [] + Acc end. %% "The 'preceding' axis contains all nodes in the same document as the context %% node that are before the context node in document order, exluding any %% ancestors and excluding attribute nodes and namespace nodes." -%% (UW: I interpret this as "preceding siblings and their descendants".) match_preceding(Tok, N, Acc, Context) -> #xmlNode{parents = Ps, node = Node} = N, case Ps of [#xmlNode{type = element, - node = #xmlElement{} = PNode}|_] -> + node = #xmlElement{} = PNode} = P|_] -> PrecedingSiblings = lists:sublist(get_content(PNode), 1, - Node#xmlElement.pos-1), - lists:foldr( - fun(E, AccX) -> - ThisN = #xmlNode{type = node_type(E), - node = E, - parents = Ps}, - Acc1 = - case node_test(Tok, ThisN, Context) of - true -> - [ThisN|AccX]; - false -> - AccX - end, - match_desc(get_content(E), Tok, Ps, Acc1, Context) - end, Acc, PrecedingSiblings); + get_position(Node) - 1), + Acc0 = lists:foldr( + fun(E, AccX) -> + ThisN = #xmlNode{type = node_type(E), + node = E, + parents = Ps}, + match_descendant_or_self(Tok, ThisN, AccX, Context) + end, Acc, PrecedingSiblings), + match_preceding(Tok, P, Acc0, Context); _Other -> - [] + Acc end. @@ -642,20 +591,15 @@ case N#xmlNode.type of element -> #xmlNode{parents = Ps, node = E} = N, - lists:foldl( + lists:foldr( fun(A, AccX) -> ThisN = #xmlNode{type = attribute, node = A, parents = [N|Ps]}, - case node_test(Tok, ThisN, Context) of - true -> - [ThisN|AccX]; - false -> - AccX - end + match_self(Tok, ThisN, AccX, Context) end, Acc, E#xmlElement.attributes); _Other -> - [] + Acc end. node_type(#xmlAttribute{}) -> attribute; @@ -672,27 +616,20 @@ % erlang:fault(not_yet_implemented). -update_nodeset(Context = #xmlContext{axis_type = reverse}, NodeSet) -> - Context#xmlContext{nodeset = reverse(NodeSet)}; -update_nodeset(Context, NodeSet) -> - Context#xmlContext{nodeset = forward(NodeSet)}. - -reverse(NodeSet) -> - reverse(NodeSet, 1, []). - -reverse([H|T], Pos, Acc) -> - reverse(T, Pos+1, [H#xmlNode{pos = Pos}|Acc]); -reverse([], _Pos, Acc) -> - Acc. - -forward(NodeSet) -> - forward(NodeSet, 1). - -forward([H|T], Pos) -> - [H#xmlNode{pos = Pos}|forward(T, Pos+1)]; -forward([], _Pos) -> - []. +update_nodeset(Context = #xmlContext{axis_type = AxisType}, NodeSet) -> + MapFold = + case AxisType of + forward -> + mapfoldl; + reverse -> + mapfoldr + end, + {Result, _N} = + lists:MapFold(fun(Node, N) -> + {Node#xmlNode{pos = N}, N + 1} + end, 1, NodeSet), + Context#xmlContext{nodeset = Result}. node_test(F, N, Context) when function(F) -> @@ -736,12 +673,12 @@ case expanded_name(Prefix, Local, Context) of [] -> ?dbg("node_test(~p, ~p) -> ~p.~n", - [{Tag, Prefix, Local}, write_node(Name), false]), + [{_Tag, Prefix, Local}, write_node(Name), false]), false; ExpName -> Res = (ExpName == {NS#xmlNamespace.default,Name}), ?dbg("node_test(~p, ~p) -> ~p.~n", - [{Tag, Prefix, Local}, write_node(Name), Res]), + [{_Tag, Prefix, Local}, write_node(Name), Res]), Res end; node_test({name, {Tag,_Prefix,_Local}}, @@ -812,3 +749,8 @@ C; get_content(#xmlDocument{content = C}) -> [C]. + +get_position(#xmlElement{pos = N}) -> + N; +get_position(#xmlText{pos = N}) -> + N. From egil@REDACTED Wed Aug 20 12:19:16 2008 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Wed, 20 Aug 2008 12:19:16 +0200 Subject: [erlang-patches] [PATCH] make os_mon compile on NetBSD 4.0 In-Reply-To: <20080802201857.257260@gmx.net> References: <20080802201857.257260@gmx.net> Message-ID: <48ABEFA4.1050208@erix.ericsson.se> Hi Raphael, os_mon is not supported for NetBSD nor is it prioritized at the moment. Regarding compiling error. I have compiled r12b-3 on NetBSD 3.0 and there was no errors. I do not have any 4.0 machines available so i cannot reproduce this build error. Regards, Bj?rn-Egil Erlang/OTP Raphael Langerhorst wrote: > Hi all, > > I just registered to this list (and to -questions), so hello everyone. > > Today I compiled R12B-3 from source on NetBSD/evbarm 4.0 > > Attached a patch is not complete, but shows where to find the vmparam.h file. The location is architecture dependend, so there need to be a check in configure, or makefile or wherever (I haven't looked that far into things). > > The rule for the include file is as follows: > > use "uname -m" to detect the architecture and use the output for the include path: > > #include <__arch__/vmparam.h> > > where __arch__ is the output of uname -m. > > This was the only error that occured while compiling R12B-3 on NetBSD 4.0 (no extra options to configure). > > Best Regards, > Raphael > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-patches From nc@REDACTED Thu Aug 21 10:07:45 2008 From: nc@REDACTED (Nicolas Charpentier) Date: Thu, 21 Aug 2008 10:07:45 +0200 Subject: [erlang-patches] Patch submission for httpd authentication file location Message-ID: <48AD2251.3070109@charpi.net> Hi, There is a fix proposal for the problem I reported few days ago. Context: In the httpd service, for each directory you can configure the authentication mode. For plain and dets mode, 2 others parameters have to configured auth_user_file and auth_group_file. The documention says that their value could be either an absolute path name either a path relative to the server_root. Unfortunately there is a bug because if the value is a relative path name it will be relative to the current working directory of the VM. My patch is based on R12-B3 sources. To apply it: * change to directory $ERL_ROOT/lib/inets/src/http_server * then execute patch -p0 < bug_auth_files_location.patch Regards, Nicolas Charpentier -------------- next part -------------- A non-text attachment was scrubbed... Name: bug_auth_files_location.patch Type: text/x-diff Size: 4967 bytes Desc: not available URL: From roques@REDACTED Thu Aug 21 19:21:17 2008 From: roques@REDACTED (Christian von Roques) Date: Thu, 21 Aug 2008 13:21:17 -0400 Subject: [erlang-patches] binary matching optimization error Message-ID: <87od3ml1wy.fsf@cayenne.mti.ag> Using R12B-3 I recently wrote code similar to the following: -module(bug). -export([foo/2]). %% foo(<<1,2>>, 2) should evaluate to <<1,2>>, but evaluates to <<2>> %% when compiled without no_bsm_opt foo(Bin, 0) -> foo(Bin, 42); foo(<<_A, Rest/bitstring>>, 1) -> foo(Rest, 43); foo(Bin, _I) -> Bin. beam_bsm "optimizes" foo/2 to the following: {function, foo, 2, 2}. {label,1}. {func_info,{atom,bug},{atom,foo},2}. {label,2}. {test,is_eq_exact,{f,3},[{x,1},{integer,0}]}. {bs_context_to_binary,{x,0}}. {move,{integer,42},{x,1}}. {call_only,2,{f,2}}. {label,3}. {test,bs_start_match2,{f,4},[{x,0},2,0,{x,0}]}. {test,bs_skip_bits2, {f,4}, [{x,0}, {integer,8}, 1, {field_flags,[{anno,[7,{file,"./bug.erl"}]},unsigned,big]}]}. {'%',{bin_opt,[7,{file,"./bug.erl"}]}}. {bs_save2,{x,0},{atom,start}}. {move,{x,0},{x,2}}. {test,is_eq_exact,{f,4},[{x,1},{integer,1}]}. {move,{integer,43},{x,1}}. {move,{x,2},{x,0}}. {call_only,2,{f,2}}. {label,4}. {bs_context_to_binary,{x,0}}. return. The problem seems to be, that the match state needs to be saved so that after a tail-recursive call to foo(Rest, 43) the bs_context_to_binary at {label 2} results in shortened binary and at the same time the match state must not be saved so that bs_context_to_binary at {label 4} yields the unshortened binary. I've come up with a minor modification of beam_bsm, which detects cases like these and disables "optimizing" them. Another possible solution could be to push the bs_save2 downwards until after the match is complete. Christian. -------------- next part -------------- A non-text attachment was scrubbed... Name: beam_bsm.erl.patch Type: text/x-diff Size: 2163 bytes Desc: not available URL: From roques@REDACTED Thu Aug 21 22:08:56 2008 From: roques@REDACTED (Christian von Roques) Date: Thu, 21 Aug 2008 16:08:56 -0400 Subject: [erlang-patches] binary matching optimization error In-Reply-To: <87od3ml1wy.fsf@cayenne.mti.ag> (Christian von Roques's message of "Thu, 21 Aug 2008 13:21:17 -0400") References: <87od3ml1wy.fsf@cayenne.mti.ag> Message-ID: <87k5eaceqv.fsf@cayenne.mti.ag> Christian von Roques writes: > Using R12B-3 I recently wrote code similar to the following: > > -module(bug). > -export([foo/2]). > > %% foo(<<1,2>>, 2) should evaluate to <<1,2>>, but evaluates to <<2>> > %% when compiled without no_bsm_opt > foo(Bin, 0) -> > foo(Bin, 42); > foo(<<_A, Rest/bitstring>>, 1) -> > foo(Rest, 43); > foo(Bin, _I) -> > Bin. Unfortunately this is not the whole problem. bar(<<1,2>>, 3) should evaluate to <<1,2>> as well: bar(Bin, 0) -> bar(Bin, 42); bar(<<_A, Rest/bitstring>>, 1) -> bar(Rest, 43); bar(<<>>, 2) -> bar(<<>>, 44); bar(Bin, _I) -> Bin. Here the problem is with bs_restore2. I've amended my patch, but still hope for a more complete solution from the Erlang team e.g. by placing the bs_save2 only in those control flow paths where they are needed and not modifying the original match context where it is still needed. Christian. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: beam_bsm.erl.patch URL: From per@REDACTED Fri Aug 22 00:11:22 2008 From: per@REDACTED (Per Hedeland) Date: Fri, 22 Aug 2008 00:11:22 +0200 (CEST) Subject: [erlang-patches] [erlang-questions] max timeout In-Reply-To: <1219209960.3739.1.camel@piko.site> Message-ID: <200808212211.m7LMBMkF099407@pluto.hedeland.org> Alp?r J?ttner wrote: > >As I recall, someone noted on that thread that timer:sleep() works well >for arbitrarily large numbers. I thought that might have been me:-( - but I see now that I just said "the timer module" and gave an example using timer:send_after/2, so I was almost right... >Now I looked at the source and found that this is _not_ true. Strangely >enough, all the functions of the timer modules seem to work correctly >with large numbers _except_ timer:sleep() which has a definition as >simple as this: > >sleep(T) -> > receive > after T -> ok > end. Ouch. But no-one will ever need to sleep for 50 days or more, right?:-) >It might be worth fixing. And I guess I half-owe the fix - the problem is (as I discovered...) that there may be (is) code, um, "out there", that relies on being able to use timer:sleep/1 without having the timer_server running *or* getting "auto-started". Below is what I believe to be a backwards- compatible fix (against R12B-3), but it's pretty ugly - would probably be better to e.g. define a new function long_sleep/1 or somesuch for the "unlimited" case. --Per Hedeland --- lib/stdlib/src/timer.erl.orig 2007-11-26 19:55:44.000000000 +0100 +++ lib/stdlib/src/timer.erl 2008-08-21 23:00:45.000000000 +0200 @@ -75,9 +75,14 @@ cancel(BRef) -> req(cancel, BRef). -sleep(T) -> - receive - after T -> ok +sleep(Time) -> + case whereis(timer_server) of + undefined -> + receive + after Time -> ok + end; + _ -> + req(sleep, Time) end. %% @@ -176,6 +181,13 @@ {reply, {error, badarg}, [], next_timeout()} end; +handle_call({sleep, Time, Started}, From, Ts) -> + Req = {apply_after, {Time, {gen_server, reply, [From, ok]}}, Started}, + case handle_call(Req, From, Ts) of + {reply, {ok, _}, _, Timeout} -> {noreply, [], Timeout}; + Reply -> Reply + end; + handle_call({cancel, BRef = {_Time, Ref}, _}, _From, Ts) when is_reference(Ref) -> delete_ref(BRef), From per@REDACTED Fri Aug 22 00:31:22 2008 From: per@REDACTED (Per Hedeland) Date: Fri, 22 Aug 2008 00:31:22 +0200 (CEST) Subject: [erlang-patches] [PATCH] make os_mon compile on NetBSD 4.0 In-Reply-To: <48ABEFA4.1050208@erix.ericsson.se> Message-ID: <200808212231.m7LMVMfb099870@pluto.hedeland.org> Bj?rn-Egil Dahlberg wrote: > >os_mon is not supported for NetBSD nor is it prioritized at the moment. > >Regarding compiling error. I have compiled r12b-3 on NetBSD 3.0 and >there was no errors. I do not have any 4.0 machines available so i >cannot reproduce this build error. The problem is that NetBSD had apparently forgotten its heritage in 3.x, but has remembered it again in 4.0 and now pre-#define's __unix__ as it should. This leads to the BSD4_4 #define getting pulled in from and subsequently the #include breaking the compile, since there is no /usr/include/vm directory on NetBSD. Below is a very minimal fix that allows the compile to succeed on NetBSD 4.0 - I don't think anyone will construe it as a commitment from the OTP group to support os_mon on NetBSD, in particular since any attempt to actually use it will just result in {error,{unsupported_os,{unix,netbsd}}} - but it's annoying to have the default build break because of this. --Per Hedeland --- lib/os_mon/c_src/memsup.c.orig 2007-11-26 19:55:46.000000000 +0100 +++ lib/os_mon/c_src/memsup.c 2008-08-21 17:07:22.000000000 +0200 @@ -98,7 +98,7 @@ #ifdef BSD4_4 #include #include -#ifndef __OpenBSD__ +#if !defined(__OpenBSD__) && !defined(__NetBSD__) #include #endif #ifdef __FreeBSD__ From bgustavsson@REDACTED Fri Aug 22 10:22:59 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Fri, 22 Aug 2008 10:22:59 +0200 Subject: [erlang-patches] binary matching optimization error In-Reply-To: <87k5eaceqv.fsf@cayenne.mti.ag> References: <87od3ml1wy.fsf@cayenne.mti.ag> <87k5eaceqv.fsf@cayenne.mti.ag> Message-ID: <6672d0160808220122v71da46b7oa5d0fe1a30a5bd50@mail.gmail.com> 2008/8/21 Christian von Roques Thanks for the bug report and patch. I have added your examples to the test suite. > I've amended my patch, but still hope for a more complete solution > from the Erlang team e.g. by placing the bs_save2 only in those > control flow paths where they are needed and not modifying the > original match context where it is still needed. > Placing the bs_save2 instructions only in the control flow paths where they are needed does seem to be the best solution. I will try to implement that for R12B-4 (if it turns out to be too involved to implement correctly, I will probably use your patch). /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From bertil.karlsson@REDACTED Fri Aug 22 12:49:35 2008 From: bertil.karlsson@REDACTED (Bertil Karlsson) Date: Fri, 22 Aug 2008 12:49:35 +0200 Subject: [erlang-patches] Comprehensive xmerl_xpath patch In-Reply-To: References: Message-ID: <48AE99BF.9000308@ericsson.com> Thanks, I have added those corrections. /Bertil Matthew Dempsky wrote: > Below is a comprehensive patch including all of the changes I've made > based on pristine R12B-3 (the get_content() change in my first patch > isn't actually needed). Also included is a small test suite covering > a handful of basic cases. > > Issues fixed: > > - fixes matching against attributes when the context node set > includes non-element nodes (from original patch) > > - fixes a compile error when using -Ddebug=true (from original > patch) > > - fixes handling of 'following', 'following-sibling', 'preceding', > and 'preceding-sibling' axes when the context node set includes a > text node (from original patch) > > - fixes parse error for expressions using the 'mod' operator > > - fixes "/" to evaluate to the document node > > - fixes "[N]" short-circuit logic to work correctly when using a > reverse axis > > - fixes the "ancestor-or-self" axis to be recognized as a reverse > axis > > - fixes axis handling to consistently return nodes in document order > > The code is also refactored a bit to reuse match_self() and > match_descendant_or_self() where possible rather than reimplementing > them for other axes. > > (Assuming I can refrain from digging into the code more, hopefully > this is my last email to erlang-patches@ about this. ;-) > > > test() -> > [begin > {Doc, _} = xmerl_scan:string(XML), > [test(XML, Doc, XPath, Exp) || {XPath, Exp} <- Tests] > end || {XML, Tests} <- tests()], > ok. > > test(XML, Doc, XPath, Exp) -> > Result = xmerl_xpath:string(XPath, Doc), > Got = [Name || #xmlElement{name = Name} <- Result], > if > Exp =:= Got -> > ok; > true -> > io:format("XML = ~s.~nXPath = ~s.~nExp = ~p.~nGot = > ~p.~n~n", [XML, XPath, Exp, Got]) > end. > > tests() -> > [{" ", > [{"//b/following::*", [c, d, e]}, > {"//b/following::*[1]", [c]}, > {"//b/following::*[position()=1]", [c]}, > {"//b/following::*[3]", [e]}, > {"//b/following::*[position()=3]", [e]}, > > {"//e/preceding::*", [b, c, d]}, > {"//e/preceding::*[1]", [d]}, > {"//e/preceding::*[position()=1]", [d]}, > {"//e/preceding::*[3]", [b]}, > {"//e/preceding::*[position()=3]", [b]}, > > {"//b/following::*[position() mod 2=0]", [d]}, > {"//b/self::*", [b]} > ]}, > > {" ", > [{"//g/preceding::*", [b, c, d, e]}, > {"//g/following::*", [h, i, j, k]}, > {"//g/ancestor::*", [a, f]}, > {"//g/ancestor::*[1]", [f]}, > {"//g/ancestor::*[2]", [a]}, > {"//g/ancestor-or-self::*", [a, f, g]}, > {"//g/ancestor-or-self::*[1]", [g]}, > {"//g/ancestor-or-self::*[2]", [f]}, > {"//g/ancestor-or-self::*[3]", [a]}, > {"/descendant::*", [a, b, c, d, e, f, g, h, i, j, k]}, > {"//f/preceding-sibling::*", [b, c, e]}, > {"//f/following-sibling::*", [h, i, k]}, > > {"//f/self::*", [f]}, > {"//f/ancestor::*", [a]}, > {"//f/descendant::*", [g]}, > {"//f/preceding::*", [b, c, d, e]}, > {"//f/following::*", [h, i, j, k]}, > > {"//text()[1]/following-sibling::*", [c, e, f, h, i, k]} > ]} > ]. > > > > --- xmerl_xpath_parse.yrl~ 2006-05-04 10:38:38.000000000 -0500 > +++ xmerl_xpath_parse.yrl 2008-08-15 14:05:40.000000000 -0500 > @@ -259,10 +259,10 @@ > 'MultiplicativeExpr' -> 'UnaryExpr' : '$1' . > 'MultiplicativeExpr' -> 'MultiplicativeExpr' 'MultiplyOperator' 'UnaryExpr' > : {arith, '$2', '$1', '$3'} . > -'MultiplicativeExpr' -> 'MultiplicativeExpr' 'div' 'UnaryExpr' > +'MultiplicativeExpr' -> 'MultiplicativeExpr' 'div' 'UnaryExpr' > : {arith, 'div', '$1', '$3'} . > -'MultiplicativeExpr' -> 'MultiplicativeExpr' 'mod' 'UnaryExpr' : > - {arith, 'mod', '$1', '$2'} . > +'MultiplicativeExpr' -> 'MultiplicativeExpr' 'mod' 'UnaryExpr' > + : {arith, 'mod', '$1', '$3'} . > > > %% [27] > --- xmerl_xpath.erl~ 2008-08-15 22:36:56.000000000 -0500 > +++ xmerl_xpath.erl 2008-08-15 22:59:37.000000000 -0500 > @@ -148,7 +148,7 @@ > Context=(new_context(Options))#xmlContext{context_node = ContextNode, > whole_document = WholeDoc}, > %io:format("string Context=~p~n",[Context]), > - #state{context = NewContext} = match(Str, #state{context = Context}), > + #state{context = NewContext} = match(Str, #state{context = Context}), > %io:format("string NewContext=~p~n",[NewContext]), > [N || #xmlNode{node = N} <- NewContext#xmlContext.nodeset]. > > @@ -236,7 +236,9 @@ > acc = Acc}) -> > ?dbg("PredExpr = ~p~n", [PredExpr]), > NewContext = axis(Axis, NodeTest, C, Acc), > - pred_expr(PredExpr, S#state{context = NewContext}). > + pred_expr(PredExpr, S#state{context = NewContext}); > +path_expr('/', S) -> > + S. > > > > @@ -250,9 +252,16 @@ > %% simple case: the predicate is a number, e.g. para[5]. > %% No need to iterate over all nodes in the nodeset; we know what to do. > %% > -eval_pred({number, N}, S = #state{context = C = #xmlContext{nodeset = NS}}) -> > - case length(NS)>=N of > +eval_pred({number, N0}, S = #state{context = C = #xmlContext{nodeset > = NS, axis_type = AxisType}}) -> > + Len = length(NS), > + case Len>=N0 of > true -> > + N = case AxisType of > + forward -> > + N0; > + reverse -> > + Len + 1 - N0 > + end, > NewNodeSet = [lists:nth(N, NS)], > NewContext = C#xmlContext{nodeset = NewNodeSet}, > S#state{context = NewContext}; > @@ -365,6 +374,8 @@ > > fwd_or_reverse(ancestor, Context) -> > reverse_axis(Context); > +fwd_or_reverse(ancestor_or_self, Context) -> > + reverse_axis(Context); > fwd_or_reverse(preceding_sibling, Context) -> > reverse_axis(Context); > fwd_or_reverse(preceding, Context) -> > @@ -378,11 +389,9 @@ > Context#xmlContext{axis_type = forward}. > > > - > match_self(Tok, N, Acc, Context) -> > case node_test(Tok, N, Context) of > true -> > - %io:format("node_test -> true.~n", []), > [N|Acc]; > false -> > Acc > @@ -393,7 +402,6 @@ > #xmlNode{parents = Ps, node = Node, type = Type} = N, > case Type of > El when El == element; El == root_node -> > -% element -> > NewPs = [N|Ps], > match_desc(get_content(Node), NewPs, Tok, Acc, Context); > _Other -> > @@ -404,44 +412,29 @@ > % match_desc(Content, Parents, Tok, [], Context). > > match_desc([E = #xmlElement{}|T], Parents, Tok, Acc, Context) -> > + Acc1 = match_desc(T, Parents, Tok, Acc, Context), > N = #xmlNode{type = node_type(E), > node = E, > parents = Parents}, > NewParents = [N|Parents], > - Acc1 = case node_test(Tok, N, Context) of > - true -> > - [N|Acc]; > - false -> > - Acc > - end, > Acc2 = match_desc(get_content(E), NewParents, Tok, Acc1, Context), > - match_desc(T, Parents, Tok, Acc2, Context); > + match_self(Tok, N, Acc2, Context); > match_desc([E|T], Parents, Tok, Acc, Context) -> > + Acc1 = match_desc(T, Parents, Tok, Acc, Context), > N = #xmlNode{node = E, > type = node_type(E), > parents = Parents}, > - Acc1 = case node_test(Tok, N, Context) of > - true -> > - [N|Acc]; > - false -> > - Acc > - end, > - match_desc(T, Parents, Tok, Acc1, Context); > + match_self(Tok, N, Acc1, Context); > match_desc([], _Parents, _Tok, Acc, _Context) -> > Acc. > - > + > > > %% "The 'descendant-or-self' axis contains the context node and the > %% descendants of the context node." > match_descendant_or_self(Tok, N, Acc, Context) -> > - Acc1 = case node_test(Tok, N, Context) of > - true -> > - [N|Acc]; > - false -> > - Acc > - end, > - match_descendant(Tok, N, Acc1, Context). > + Acc1 = match_descendant(Tok, N, Acc, Context), > + match_self(Tok, N, Acc1, Context). > > > match_child(Tok, N, Acc, Context) -> > @@ -455,12 +448,7 @@ > ThisN = #xmlNode{type = node_type(E), > node = E, > parents = NewPs}, > - case node_test(Tok, ThisN, Context) of > - true -> > - [ThisN|AccX]; > - false -> > - AccX > - end > + match_self(Tok, ThisN, AccX, Context) > end, Acc, get_content(Node)); > _Other -> > Acc > @@ -474,12 +462,7 @@ > [] -> > Acc; > [PN|_] -> > - case node_test(Tok, PN, Context) of > - true -> > - [PN|Acc]; > - false -> > - Acc > - end > + match_self(Tok, PN, Acc, Context) > end. > > > @@ -489,14 +472,9 @@ > %% always include the root node, unless the context node is the root node." > match_ancestor(Tok, N, Acc, Context) -> > Parents = N#xmlNode.parents, > - lists:foldr( > + lists:foldl( > fun(PN, AccX) -> > - case node_test(Tok, PN, Context) of > - true -> > - [PN|AccX]; > - false -> > - AccX > - end > + match_self(Tok, PN, AccX, Context) > end, Acc, Parents). > > > @@ -506,12 +484,7 @@ > %% of the context node; thus, the acestor axis will always include the > %% root node." > match_ancestor_or_self(Tok, N, Acc, Context) -> > - Acc1 = case node_test(Tok, N, Context) of > - true -> > - [N|Acc]; > - false -> > - Acc > - end, > + Acc1 = match_self(Tok, N, Acc, Context), > match_ancestor(Tok, N, Acc1, Context). > > > @@ -525,19 +498,14 @@ > case Ps of > [#xmlNode{type = element, > node = #xmlElement{} = PNode}|_] -> > - FollowingSiblings = lists:nthtail(Node#xmlElement.pos, > + FollowingSiblings = lists:nthtail(get_position(Node), > get_content(PNode)), > lists:foldr( > fun(E, AccX) -> > ThisN = #xmlNode{type = node_type(E), > node = E, > parents = Ps}, > - case node_test(Tok, ThisN, Context) of > - true -> > - [ThisN|AccX]; > - false -> > - AccX > - end > + match_self(Tok, ThisN, AccX, Context) > end, Acc, FollowingSiblings); > _Other -> > Acc > @@ -547,28 +515,21 @@ > %% "The 'following' axis contains all nodes in the same document as the > %% context node that are after the context node in document order, excluding > %% any descendants and excluding attribute nodes and namespace nodes." > -%% (UW: I interpret this as "following siblings and their descendants") > match_following(Tok, N, Acc, Context) -> > #xmlNode{parents = Ps, node = Node} = N, > case Ps of > [#xmlNode{type = element, > - node = #xmlElement{} = PNode}|_] -> > - FollowingSiblings = lists:nthtail(Node#xmlElement.pos, > + node = #xmlElement{} = PNode} = P|_] -> > + Acc0 = match_following(Tok, P, Acc, Context), > + FollowingSiblings = lists:nthtail(get_position(Node), > get_content(PNode)), > lists:foldr( > fun(E, AccX) -> > ThisN = #xmlNode{type = node_type(E), > node = E, > parents = Ps}, > - Acc1 = > - case node_test(Tok, ThisN, Context) of > - true -> > - [ThisN|AccX]; > - false -> > - AccX > - end, > - match_desc(get_content(E), Tok, Ps, Acc1, Context) > - end, Acc, FollowingSiblings); > + match_descendant_or_self(Tok, ThisN, AccX, Context) > + end, Acc0, FollowingSiblings); > _Other -> > Acc > end. > @@ -588,51 +549,39 @@ > [#xmlNode{type = element, > node = #xmlElement{} = PNode}|_] -> > PrecedingSiblings = lists:sublist(get_content(PNode), 1, > - Node#xmlElement.pos-1), > + get_position(Node) - 1), > lists:foldr( > fun(E, AccX) -> > ThisN = #xmlNode{type = node_type(E), > node = E, > parents = Ps}, > - case node_test(Tok, ThisN, Context) of > - true -> > - [ThisN|AccX]; > - false -> > - AccX > - end > + match_self(Tok, ThisN, AccX, Context) > end, Acc, PrecedingSiblings); > _Other -> > - [] > + Acc > end. > > > %% "The 'preceding' axis contains all nodes in the same document as the context > %% node that are before the context node in document order, exluding any > %% ancestors and excluding attribute nodes and namespace nodes." > -%% (UW: I interpret this as "preceding siblings and their descendants".) > match_preceding(Tok, N, Acc, Context) -> > #xmlNode{parents = Ps, node = Node} = N, > case Ps of > [#xmlNode{type = element, > - node = #xmlElement{} = PNode}|_] -> > + node = #xmlElement{} = PNode} = P|_] -> > PrecedingSiblings = lists:sublist(get_content(PNode), 1, > - Node#xmlElement.pos-1), > - lists:foldr( > - fun(E, AccX) -> > - ThisN = #xmlNode{type = node_type(E), > - node = E, > - parents = Ps}, > - Acc1 = > - case node_test(Tok, ThisN, Context) of > - true -> > - [ThisN|AccX]; > - false -> > - AccX > - end, > - match_desc(get_content(E), Tok, Ps, Acc1, Context) > - end, Acc, PrecedingSiblings); > + get_position(Node) - 1), > + Acc0 = lists:foldr( > + fun(E, AccX) -> > + ThisN = #xmlNode{type = node_type(E), > + node = E, > + parents = Ps}, > + match_descendant_or_self(Tok, ThisN, AccX, Context) > + end, Acc, PrecedingSiblings), > + match_preceding(Tok, P, Acc0, Context); > _Other -> > - [] > + Acc > end. > > > @@ -642,20 +591,15 @@ > case N#xmlNode.type of > element -> > #xmlNode{parents = Ps, node = E} = N, > - lists:foldl( > + lists:foldr( > fun(A, AccX) -> > ThisN = #xmlNode{type = attribute, > node = A, > parents = [N|Ps]}, > - case node_test(Tok, ThisN, Context) of > - true -> > - [ThisN|AccX]; > - false -> > - AccX > - end > + match_self(Tok, ThisN, AccX, Context) > end, Acc, E#xmlElement.attributes); > _Other -> > - [] > + Acc > end. > > node_type(#xmlAttribute{}) -> attribute; > @@ -672,27 +616,20 @@ > % erlang:fault(not_yet_implemented). > > > -update_nodeset(Context = #xmlContext{axis_type = reverse}, NodeSet) -> > - Context#xmlContext{nodeset = reverse(NodeSet)}; > -update_nodeset(Context, NodeSet) -> > - Context#xmlContext{nodeset = forward(NodeSet)}. > - > -reverse(NodeSet) -> > - reverse(NodeSet, 1, []). > - > -reverse([H|T], Pos, Acc) -> > - reverse(T, Pos+1, [H#xmlNode{pos = Pos}|Acc]); > -reverse([], _Pos, Acc) -> > - Acc. > - > -forward(NodeSet) -> > - forward(NodeSet, 1). > - > -forward([H|T], Pos) -> > - [H#xmlNode{pos = Pos}|forward(T, Pos+1)]; > -forward([], _Pos) -> > - []. > > +update_nodeset(Context = #xmlContext{axis_type = AxisType}, NodeSet) -> > + MapFold = > + case AxisType of > + forward -> > + mapfoldl; > + reverse -> > + mapfoldr > + end, > + {Result, _N} = > + lists:MapFold(fun(Node, N) -> > + {Node#xmlNode{pos = N}, N + 1} > + end, 1, NodeSet), > + Context#xmlContext{nodeset = Result}. > > > node_test(F, N, Context) when function(F) -> > @@ -736,12 +673,12 @@ > case expanded_name(Prefix, Local, Context) of > [] -> > ?dbg("node_test(~p, ~p) -> ~p.~n", > - [{Tag, Prefix, Local}, write_node(Name), false]), > + [{_Tag, Prefix, Local}, write_node(Name), false]), > false; > ExpName -> > Res = (ExpName == {NS#xmlNamespace.default,Name}), > ?dbg("node_test(~p, ~p) -> ~p.~n", > - [{Tag, Prefix, Local}, write_node(Name), Res]), > + [{_Tag, Prefix, Local}, write_node(Name), Res]), > Res > end; > node_test({name, {Tag,_Prefix,_Local}}, > @@ -812,3 +749,8 @@ > C; > get_content(#xmlDocument{content = C}) -> > [C]. > + > +get_position(#xmlElement{pos = N}) -> > + N; > +get_position(#xmlText{pos = N}) -> > + N. > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-patches > > From per@REDACTED Sun Aug 24 21:25:44 2008 From: per@REDACTED (Per Hedeland) Date: Sun, 24 Aug 2008 21:25:44 +0200 (CEST) Subject: [erlang-patches] [erlang-questions] max timeout In-Reply-To: <4d08db370808220119o1d79ffe8t809e6baaee2db194@mail.gmail.com> Message-ID: <200808241925.m7OJPi6h093180@pluto.hedeland.org> "Hynek Vychodil" wrote: > > {ok, _} = send_after(Time, Ref), >> It should be much more simpler to do it without modify timer_server: >> >> sleep(Time) -> >> case whereis(timer_server) of >> undefined -> receive after Time -> ok end; >> _ -> >> Ref = make_ref(), >> send_after(Time, Ref), >> receive Ref -> ok end >> end. Matter of taste perhaps, whether you prefer the absolute minimum of change vs regularity of implementation. One thing that often falls out of the latter is consistency in API, such that you don't end up with one API function doing a badmatch crash on erroneous input, while all the others return {error, badarg}. And of course one could ask why create an unneeded ref, or why require two messages from the server when you only need one, but that's more in the nitpicking area. --Per Hedeland From bgustavsson@REDACTED Mon Aug 25 09:18:18 2008 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Mon, 25 Aug 2008 09:18:18 +0200 Subject: [erlang-patches] [erlang-questions] max timeout In-Reply-To: <200808241925.m7OJPi6h093180@pluto.hedeland.org> References: <4d08db370808220119o1d79ffe8t809e6baaee2db194@mail.gmail.com> <200808241925.m7OJPi6h093180@pluto.hedeland.org> Message-ID: <6672d0160808250018u386808bar7971eccbe3da8c3a@mail.gmail.com> On Sun, Aug 24, 2008 at 9:25 PM, Per Hedeland wrote: > "Hynek Vychodil" wrote: > > > > {ok, _} = send_after(Time, Ref), > > >> It should be much more simpler to do it without modify timer_server: > >> > >> sleep(Time) -> > >> case whereis(timer_server) of > >> undefined -> receive after Time -> ok end; > >> _ -> > >> Ref = make_ref(), > >> send_after(Time, Ref), > >> receive Ref -> ok end > >> end. > > Matter of taste perhaps, whether you prefer the absolute minimum of > change vs regularity of implementation. One thing that often falls out > of the latter is consistency in API, such that you don't end up with one > API function doing a badmatch crash on erroneous input, while all the > others return {error, badarg}. And of course one could ask why create an > unneeded ref, or why require two messages from the server when you only > need one, but that's more in the nitpicking area. > We have had problems with the timer server becoming seriously overloaded. See: http://erlang.org/doc/efficiency_guide/commoncaveats.html#3.2 Therefore, I think that the proper way is to do "receive after" in a try/catch, and only call the timer server if the timeout value is invalid. If anyone submits a patch like that, we'll try to include it in R12B-4. /Bjorn > > --Per Hedeland > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From egil@REDACTED Mon Aug 25 11:48:08 2008 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Mon, 25 Aug 2008 11:48:08 +0200 Subject: [erlang-patches] [PATCH] make os_mon compile on NetBSD 4.0 In-Reply-To: <200808212231.m7LMVMfb099870@pluto.hedeland.org> References: <200808212231.m7LMVMfb099870@pluto.hedeland.org> Message-ID: <48B27FD8.2040006@erix.ericsson.se> Hi Per, I will include your patch, hopefully in the upcoming release, for memsup. Regards, Bj?rn-Egil Dahlberg Erlang/OTP Per Hedeland wrote: > Bj?rn-Egil Dahlberg wrote: >> os_mon is not supported for NetBSD nor is it prioritized at the moment. >> >> Regarding compiling error. I have compiled r12b-3 on NetBSD 3.0 and >> there was no errors. I do not have any 4.0 machines available so i >> cannot reproduce this build error. > > The problem is that NetBSD had apparently forgotten its heritage in 3.x, > but has remembered it again in 4.0 and now pre-#define's __unix__ as it > should. This leads to the BSD4_4 #define getting pulled in from > and subsequently the #include breaking the > compile, since there is no /usr/include/vm directory on NetBSD. > > Below is a very minimal fix that allows the compile to succeed on NetBSD > 4.0 - I don't think anyone will construe it as a commitment from the OTP > group to support os_mon on NetBSD, in particular since any attempt to > actually use it will just result in > {error,{unsupported_os,{unix,netbsd}}} - but it's annoying to have the > default build break because of this. > > --Per Hedeland > > --- lib/os_mon/c_src/memsup.c.orig 2007-11-26 19:55:46.000000000 +0100 > +++ lib/os_mon/c_src/memsup.c 2008-08-21 17:07:22.000000000 +0200 > @@ -98,7 +98,7 @@ > #ifdef BSD4_4 > #include > #include > -#ifndef __OpenBSD__ > +#if !defined(__OpenBSD__) && !defined(__NetBSD__) > #include > #endif > #ifdef __FreeBSD__ From twoggle@REDACTED Tue Aug 26 15:48:36 2008 From: twoggle@REDACTED (Tim Fletcher) Date: Tue, 26 Aug 2008 14:48:36 +0100 Subject: [erlang-patches] crypto man page error Message-ID: At the bottom of the crypto man page there is a section titled "DES in CBC mode", which contains some example code which appears to be wrong. "Key" and "IVec" are defined variables, but then the call to crypto:des_cbc_encrypt/3 uses "K" and "I", which don't exist. Also, the parameter list in the call to crypto:des_cbc_decrypt/3 doesn't contain any spaces, which is inconsistent (if not generally, at least with the previous function call). More subjectively, I think the surrounding text has a few minor grammatical errors and is generally a bit unclear, so it might be worth checking the whole section through. Hope that helps. Tim From ingela@REDACTED Tue Aug 26 16:49:20 2008 From: ingela@REDACTED (Ingela Anderton Andin) Date: Tue, 26 Aug 2008 16:49:20 +0200 Subject: [erlang-patches] Patch submission for httpd authentication file location In-Reply-To: <48AD2251.3070109@charpi.net> References: <48AD2251.3070109@charpi.net> Message-ID: <48B417F0.3060500@erix.ericsson.se> Hi, thank you for the patch I have now included it for the next release. Regards Ingela Erlang/OTP, Ericsson Nicolas Charpentier wrote: > Hi, > There is a fix proposal for the problem I reported few days ago. > > Context: > In the httpd service, for each directory you can configure the > authentication mode. For plain and dets mode, 2 others parameters have > to configured auth_user_file and auth_group_file. > The documention says that their value could be either an absolute path > name either a path relative to the server_root. Unfortunately there is > a bug because if the value is a relative path name it will be relative > to the current working directory of the VM. > > > My patch is based on R12-B3 sources. To apply it: > * change to directory $ERL_ROOT/lib/inets/src/http_server > * then execute patch -p0 < bug_auth_files_location.patch > > > Regards, > Nicolas Charpentier > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-patches From rvirding@REDACTED Tue Aug 26 17:28:34 2008 From: rvirding@REDACTED (Robert Virding) Date: Tue, 26 Aug 2008 17:28:34 +0200 Subject: [erlang-patches] Patch for user_drv.erl Message-ID: <3dbc6d1c0808260828w2c5e332dhff1e1ffc35d719c8@mail.gmail.com> This is a patch for user_drv.erl which allows the user to specify which shell/program to start when starting a new job, both local and remote. The patch includes a modified help text. It is completely backwards compatible. It has been tested in LFE with no problems. Robert -- *** user_drv.erl.orig Tue Jun 10 21:16:10 2008 --- user_drv.erl Thu Apr 24 04:17:35 2008 *************** *** 335,340 **** --- 335,344 ---- switch_cmd({ok,[{atom,_,j}],_}, Iport, Oport, Gr) -> io_requests(gr_list(Gr), Iport, Oport), switch_loop(Iport, Oport, Gr); + switch_cmd({ok,[{atom,_,s},{atom,_,Shell}],_}, Iport, Oport, Gr0) -> + Pid = group:start(self(), {Shell,start,[]}), + Gr = gr_add_cur(Gr0, Pid, {Shell,start,[]}), + switch_loop(Iport, Oport, Gr); switch_cmd({ok,[{atom,_,s}],_}, Iport, Oport, Gr0) -> Pid = group:start(self(), {shell,start,[]}), Gr = gr_add_cur(Gr0, Pid, {shell,start,[]}), *************** *** 354,359 **** --- 358,368 ---- Pid = group:start(self(), {Node,shell,start,[]}), Gr = gr_add_cur(Gr0, Pid, {Node,shell,start,[]}), switch_loop(Iport, Oport, Gr); + switch_cmd({ok,[{atom,_,r},{atom,_,Node},{atom,_,Shell}],_}, + Iport, Oport, Gr0) -> + Pid = group:start(self(), {Node,Shell,start,[]}), + Gr = gr_add_cur(Gr0, Pid, {Node,Shell,start,[]}), + switch_loop(Iport, Oport, Gr); switch_cmd({ok,[{atom,_,q}],_}, Iport, Oport, Gr) -> case erlang:system_info(break_ignored) of true -> % noop *************** *** 386,401 **** true -> []; false -> ! [{put_chars," q - quit erlang\n"}] end, ! io_requests([{put_chars," c [nn] - connect to job\n"}, ! {put_chars," i [nn] - interrupt job\n"}, ! {put_chars," k [nn] - kill job\n"}, ! {put_chars," j - list all jobs\n"}, ! {put_chars," s - start local shell\n"}, ! {put_chars," r [node] - start remote shell\n"}] ++ QuitReq ++ ! [{put_chars," ? | h - this message\n"}], Iport, Oport). get_line({done,Line,_Rest,Rs}, Iport, Oport) -> io_requests(Rs, Iport, Oport), --- 395,411 ---- true -> []; false -> ! [{put_chars," q - quit erlang\n"}] end, ! io_requests([{put_chars," c [nn] - connect to job\n"}, ! {put_chars," i [nn] - interrupt job\n"}, ! {put_chars," k [nn] - kill job\n"}, ! {put_chars," j - list all jobs\n"}, ! {put_chars," s [shell] - start local shell\n"}, ! {put_chars," r [node [shell]] - start remote shell\n"}] ++ QuitReq ++ ! [{put_chars," ? | h - this message\n"}], ! Iport, Oport). get_line({done,Line,_Rest,Rs}, Iport, Oport) -> io_requests(Rs, Iport, Oport), -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: diff Type: application/octet-stream Size: 2531 bytes Desc: not available URL: From ingela@REDACTED Thu Aug 28 16:23:53 2008 From: ingela@REDACTED (Ingela Anderton Andin) Date: Thu, 28 Aug 2008 16:23:53 +0200 Subject: [erlang-patches] ssh pty client In-Reply-To: <48A5EFE8.8020805@hyber.org> References: <48A5EFE8.8020805@hyber.org> Message-ID: <48B6B4F9.6050701@erix.ericsson.se> Hi and thank you for your patch. ssh in r12 has undergone a quite big rewrite to put the ssh-processes into a supervision-tree so that ssh is now a true OTP-application. The encode_pty_opts now looks like this, which I think corresponds to your patch. We still are in a need of more test cases for ssh, but everything is a matter of time and priorities. encode_pty_opts(Opts) -> Bin = list_to_binary(encode_pty_opts2(Opts)), Len = size(Bin), <>. encode_pty_opts2([]) -> [?TTY_OP_END]; encode_pty_opts2([{vintr,Value} | Opts]) -> [?VINTR, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vquit,Value} | Opts]) -> [?VQUIT, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{verase,Value} | Opts]) -> [?VERASE, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vkill,Value} | Opts]) -> [?VKILL, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{veof,Value} | Opts]) -> [?VEOF, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{veol,Value} | Opts]) -> [?VEOL, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{veol2,Value} | Opts]) -> [?VEOL2, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vstart,Value} | Opts]) -> [?VSTART, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vstop,Value} | Opts]) -> [?VSTOP, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vsusp,Value} | Opts]) -> [?VSUSP, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vdsusp,Value} | Opts]) -> [?VDSUSP, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vreprint,Value} | Opts]) -> [?VREPRINT, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vwerase,Value} | Opts]) -> [ ?VWERASE, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vlnext,Value} | Opts]) -> [?VLNEXT, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vflush,Value} | Opts]) -> [?VFLUSH, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vswtch,Value} | Opts]) -> [?VSWTCH, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vstatus,Value} | Opts]) -> [?VSTATUS, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{vdiscard,Value} | Opts]) -> [?VDISCARD, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{ignpar,Value} | Opts]) -> [?IGNPAR, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{parmrk,Value} | Opts]) -> [?PARMRK, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{inpck,Value} | Opts]) -> [?INPCK, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{istrip,Value} | Opts]) -> [?ISTRIP, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{inlcr,Value} | Opts]) -> [?INLCR, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{igncr,Value} | Opts]) -> [?IGNCR, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{icrnl,Value} | Opts]) -> [?ICRNL, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{iuclc,Value} | Opts]) -> [?IUCLC, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{ixon,Value} | Opts]) -> [?IXON, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{ixany,Value} | Opts]) -> [?IXANY, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{ixoff,Value} | Opts]) -> [?IXOFF, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{imaxbel,Value} | Opts]) -> [?IMAXBEL, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{isig,Value} | Opts]) -> [?ISIG, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{icanon,Value} | Opts]) -> [?ICANON, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{xcase,Value} | Opts]) -> [?XCASE, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{echo,Value} | Opts]) -> [?ECHO, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{echoe,Value} | Opts]) -> [?ECHOE, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{echok,Value} | Opts]) -> [?ECHOK, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{echonl,Value} | Opts]) -> [?ECHONL, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{noflsh,Value} | Opts]) -> [?NOFLSH, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{tostop,Value} | Opts]) -> [?TOSTOP, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{iexten,Value} | Opts]) -> [?IEXTEN, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{echoctl,Value} | Opts]) -> [?ECHOCTL, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{echoke,Value} | Opts]) -> [?ECHOKE, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{pendin,Value} | Opts]) -> [?PENDIN, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{opost,Value} | Opts]) -> [?OPOST, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{olcuc,Value} | Opts]) -> [?OLCUC, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{onlcr,Value} | Opts]) -> [?ONLCR, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{ocrnl,Value} | Opts]) -> [?OCRNL, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{onocr,Value} | Opts]) -> [?ONOCR, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{onlret,Value} | Opts]) -> [?ONLRET, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{cs7,Value} | Opts]) -> [?CS7, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{cs8,Value} | Opts]) -> [?CS8, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{parenb,Value} | Opts]) -> [?PARENB, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{parodd,Value} | Opts]) -> [?PARODD, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{tty_op_ispeed,Value} | Opts]) -> [?TTY_OP_ISPEED, ?uint32(Value) | encode_pty_opts2(Opts)]; encode_pty_opts2([{tty_op_ospeed,Value} | Opts]) -> [?TTY_OP_OSPEED, ?uint32(Value) | encode_pty_opts2(Opts)] Regards Ingela Erlang/OTP - Ericsson Claes Wikstrom wrote: > Don't know if this is fixed in R12 - we're still at R11. Anyway > the code that allocates a pty from the client side is broken. > This is need for all shell ssh clients. The OTP code has never run. > Here is the patch for R11. > > > /klacke > > > > > > Index: ssh_cm.erl > =================================================================== > --- ssh_cm.erl (revision 18567) > +++ ssh_cm.erl (working copy) > @@ -1336,8 +1336,12 @@ > [{Op, Value} | decode_pty_opts2(Tail)]. > > > - > -encode_pty_opts([{Opt,Value} | Opts]) -> > +encode_pty_opts(Opts) -> > + B = list_to_binary(encode_pty_opts2(Opts)), > + Len = size(B), > + <>. > + > +encode_pty_opts2([{Opt,Value} | Opts]) -> > Code = case Opt of > vintr -> ?VINTR; > vquit -> ?VQUIT; > @@ -1395,8 +1399,8 @@ > tty_op_ispeed -> ?TTY_OP_ISPEED; > tty_op_ospeed -> ?TTY_OP_OSPEED > end, > - [Code, ?uint32(Value) | encode_pty_opts(Opts)]; > -encode_pty_opts([]) -> > + [Code, ?uint32(Value) | encode_pty_opts2(Opts)]; > +encode_pty_opts2([]) -> > [?TTY_OP_END]. > > > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-patches > > From pfisher@REDACTED Fri Aug 29 00:59:20 2008 From: pfisher@REDACTED (Paul Fisher) Date: Thu, 28 Aug 2008 17:59:20 -0500 Subject: [erlang-patches] [PATCH] 64-bit solaris builds Message-ID: <48B72DC8.4030507@alertlogic.net> This patch allows 64-bit builds when the target system supports both 32-bit and 64-bit in the same system environment. Specifically, this works on Solaris 10/Opensolaris, and adjusts the --enable-darwin-64-bit configure flag to be simply --enable-64bit so that it can be used for the same purpose on both darwin and solaris (building 64-bit target environment) without having to introduce another system specific configure flag. This cleanly builds with the following configure command line: ~/bld/otp_src_R12B-3$ CC=gcc ./configure --enable-threads \ --enable-smp-support --enable-kernel-poll --enable-hipe \ --disable-megaco-flex-scanner-drvlineno --without-odbc \ --enable-64bit on: ~/bld/otp_src_R12B-3$ uname -a SunOS pfisher-laptop 5.11 snv_94 i86pc i386 i86pc Solaris This does not fix common_test, which seems to be in its own world, and I'll send another patch for that. For now I just set it to SKIP. --- otp_src_R12B-3/erts/configure.in 2008-06-10 07:47:31.000000000 -0500 +++ otp_src_R12B-3/erts/configure.in.new 2008-08-28 17:42:13.703840610 -0500 @@ -162,13 +162,13 @@ ],enable_darwin_universal=no) -AC_ARG_ENABLE(darwin-64bit, -[ --enable-darwin-64bit build 64bit binaries on darwin], +AC_ARG_ENABLE(-64bit, +[ --enable-64bit build 64bit on a system that can run both], [ case "$enableval" in - no) enable_darwin_64bit=no ;; - *) enable_darwin_64bit=yes ;; + no) enable_64bit=no ;; + *) enable_64bit=yes ;; esac -],enable_darwin_64bit=no) +],enable_64bit=no) AC_ARG_ENABLE(fixalloc, @@ -229,8 +229,8 @@ dnl check it all before continuing. TMPSYS=`uname -s`-`uname -m` if test X${enable_darwin_universal} = Xyes; then - if test X${enable_darwin_64bit} = Xyes; then - AC_MSG_ERROR([--enable-darwin-universal and --enable-darwin-64bit mutually exclusive]) + if test X${enable_64bit} = Xyes; then + AC_MSG_ERROR([--enable-darwin-universal and --enable-64bit mutually exclusive]) fi enable_hipe=no case $CFLAGS in @@ -248,18 +248,33 @@ ;; esac fi -if test X${enable_darwin_64bit} = Xyes; then - if test X"$TMPSYS" '!=' X"Darwin-i386"; then - AC_MSG_ERROR([--enable-darwin-64bit only supported on x86 host]) - fi - enable_hipe=no - case $CFLAGS in +if test X${enable_64bit} = Xyes; then + case $TMPSYS in + Darwin-i386) + enable_hipe=no + case $CFLAGS in *-m64*) ;; *) CFLAGS="-m64 $CFLAGS" ;; - esac + esac + ;; + SunOS-i86pc) + case $CFLAGS in + *-m64*) + ;; + *) + CFLAGS="-m64 $CFLAGS" + ;; + esac + ;; + + *) + echo "$as_me: error: --enable-64bit only supported on x86 host" + exit 1 + ;; + esac fi @@ -516,6 +531,17 @@ esac fi ;; + amd64-sol2*) + { echo "$as_me:$LINENO: Adjusting LDFLAGS to cope with 64bit SunOS" >&5 +echo "$as_me: Adjusting LDFLAGS to cope with 64bit SunOS" >&6;} + case $LDFLAGS in + *-m64*) + ;; + *) + LDFLAGS="-m64 $LDFLAGS" + ;; + esac + ;; esac @@ -2716,7 +2742,19 @@ DED_LD_FLAG_RUNTIME_LIBRARY_PATH= ;; solaris2*|sysv4*) + DED_LD=$CC DED_LDFLAGS="-G" + case $CC in + gcc) + DED_LDFLAGS="-shared $DED_LDFLAGS" + ;; + esac + case $ARCH in + amd64) + DED_LDFLAGS="-m64 $DED_LDFLAGS" + DED_CFLAGS="-m64 $DED_CFLAGS" + ;; + esac ;; aix4*) DED_LDFLAGS="-G -bnoentry -bexpall" -- paul From nc@REDACTED Fri Aug 29 06:48:41 2008 From: nc@REDACTED (Nicolas Charpentier) Date: Fri, 29 Aug 2008 06:48:41 +0200 Subject: [erlang-patches] erl_script_alias enhancement proposal Message-ID: <48B77FA9.6090709@charpi.net> Hi, I don't know if it's the correct mailing list to send such patch. Let me know if I'm doing 'bad things'. * Purpose of the evolution. Right now if you have a httpd configuration containing {erl_script_alias, "/my_dir", [ mod1, mod2]}, you'll be able to execute erlang module hitting urls like http://myhost/my_dir/mod1:any_function and http://myhost/my_dir/mod2:anyfunction I'd like to be able to omit the module and the function name in the url. (put http://myhost/my_dir or http://myhost/my_dir/ in my broswer) and get some erlang code executed. * Enhancement proposal Add the possibiity to configure httpd with something like {erl_script_alias, {"my_dir",{{Module,Function}, Authorized_modules}}}, Where Module:Function will be the function called for the url "/my_dir" Regards, ---- Nicolas Charpentier http://charpi.net -------------- next part -------------- A non-text attachment was scrubbed... Name: erl_script_alias_proposal.patch Type: text/x-diff Size: 811 bytes Desc: not available URL: