|
From: | emacstheviking |
Subject: | Re: gprolog blows on OSX with segmentation violation (bad address: 0x0) |
Date: | Thu, 21 Nov 2013 09:42:24 +0000 |
Dear Sean,
as you noted the final ~ is wrong, it should be ~n. I have anyway fixed the implementation to report an error on such case.
The fix is available in the git.
Daniel
Le 17/11/2013 16:00, Sean Charles a écrit :
--Hi,
I was refactoring some code for a Redis client I am writing (INFO, KEYS and SET/GET currently working) and I managed to do something that made gprolog blow. It happens every time with this code:
gpredis_exec(Req) :-Req =.. [Cmd|Args],format('Command: ~a~n', [Cmd]),format(' Args: ~w~n', [Args]),gpredis_cmdargs(Args, Args2),flatten(Args2, Args3),format('Flatted: ~s~n', [Args3]).
gpredis_cmdargs([], []).gpredis_cmdargs([Arg|Args], [Term|Output]) :-gpredis_stringify(Arg,X),format_to_codes(Term, 'term: ~w ', [X]),gpredis_cmdargs(Args, Output).
gpredis_stringify(X,Y) :- is_list(X), format_to_codes(Y, '~s~', [X]).gpredis_stringify(X,Y) :- format_to_codes(Y, '~w', [X]).
and the session:Seans-iMac:gprolog-redis seancharles$ gprologGNU Prolog 1.4.4 (64 bits)Compiled Oct 13 2013, 17:19:55 with ccBy Daniel DiazCopyright (C) 1999-2013 Daniel Diaz| ?- [exec].compiling /Users/seancharles/Documents/github/gprolog-redis/exec.pl for byte code.../Users/seancharles/Documents/github/gprolog-redis/exec.pl compiled, 17 lines read - 2455 bytes written, 4 ms
(1 ms) yes| ?- gpredis_exec(test(100,'tonne',"century")).Command: testArgs: [100,tonne,[99,101,110,116,117,114,121]]
Fatal Error: Segmentation Violation (bad address: 0x0)
and my machine:Darwin Seans-iMac.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64Presumably that 0x0 is a null pointer somewhere!
I don’t have the capabilities to debug this level of problem, sorry but at least if/when this is fixed GNU Prolog will be all the better for a bit more Nietzsche-fication!
Thanks again,Sean.
Ce message a été vérifié par MailScanner pour des virus ou des polluriels et rien de suspect n'a été trouvé.
_______________________________________________ Users-prolog mailing list address@hidden https://lists.gnu.org/mailman/listinfo/users-prolog
--
Ce message a été vérifié par MailScanner pour des virus ou des polluriels et rien de suspect n'a été trouvé.
[Prev in Thread] | Current Thread | [Next in Thread] |