<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-14136</id>
	<title>Nabble - Pike</title>
	<updated>2009-12-07T17:42:20Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/Pike-f14136.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Pike-f14136.html" />
	<subtitle type="html">Pike is a dynamic programming language with a syntax similar to Java and C. It is simple to learn, does not require long compilation passes and has powerful built-in data types allowing simple and really fast data manipulation. Pike home is &lt;a href=&quot;http://pike.ida.liu.se/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.</subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26687437</id>
	<title>2 segfaults</title>
	<published>2009-12-07T17:42:20Z</published>
	<updated>2009-12-07T17:42:20Z</updated>
	<author>
		<name>Arne Goedeke</name>
	</author>
	<content type="html">While playing around with Debug.locate_references i noticed that it
&lt;br&gt;fails on ({}). The problem seems to be that in
&lt;br&gt;print_short_svalue_compact the svalue is not completely initialized and
&lt;br&gt;at some later point s-&amp;gt;subtype is added to a pointer. 1-line patch attached.
&lt;br&gt;&lt;br&gt;There is another problem when the master is printed during a run of
&lt;br&gt;locate_references. As the one before it can be triggered by
&lt;br&gt;Debug.locate_references(({})) but only after fixing the first bug.
&lt;br&gt;The current_path variable inherited from the 7.4 compat master is type
&lt;br&gt;PIKE_T_FREE for some reason and describe_svalue doesnt like that. If
&lt;br&gt;pike is compiled with dmalloc, pike segfaults because the free location
&lt;br&gt;of current_path seems to be uninitialized, too. Not sure where to fix that.
&lt;br&gt;&lt;br&gt;arne
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;diff --git a/src/svalue.c b/src/svalue.c
&lt;br&gt;index a6b07d1..273fc61 100644
&lt;br&gt;--- a/src/svalue.c
&lt;br&gt;+++ b/src/svalue.c
&lt;br&gt;@@ -1871,6 +1871,7 @@ PMOD_EXPORT void print_short_svalue_compact (FILE *out, const union anything *a,
&lt;br&gt;&amp;nbsp; &amp;nbsp;else {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;struct svalue sval;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;sval.type = type;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;sval.subtype = 0;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;sval.u = *a;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print_svalue_compact (out, &amp;sval);
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/More-rtldebug-to-get-better-info-when-gc_mark-problems-happen.-tp26573568p26687437.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26677465</id>
	<title>Re: UNIX socket support broken</title>
	<published>2009-12-07T05:46:28Z</published>
	<updated>2009-12-07T05:46:28Z</updated>
	<author>
		<name>Henrik Grubbström-2</name>
	</author>
	<content type="html">On Mon, 7 Dec 2009, Pontus Rodling wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi!
&lt;br&gt;&amp;gt; It seems that some updates related to path length limits in 
&lt;br&gt;&amp;gt; modules/files/file.c and modules/files/socket.c broke the UNIX socket 
&lt;br&gt;&amp;gt; support.
&lt;br&gt;&amp;gt; More specifically Stdio.Port()-&amp;gt;bind_unix() and Stdio.File()-&amp;gt;connect_unix().
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; v1.416 in file.c and v1.104 in socket.c.
&lt;br&gt;&amp;gt; Commit message: &amp;quot;Fixed length-limit in bind_unix(). Added automatic retry on 
&lt;br&gt;&amp;gt; EINTR to bind_unix().&amp;quot;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Calling Stdio.Port()-&amp;gt;bind_unix(...) returned 0 and strerror(errno()) gave me 
&lt;br&gt;&amp;gt; &amp;quot;Invalid argument&amp;quot;, I didn't check the errno from Stdio.File()-&amp;gt;connect_unix 
&lt;br&gt;&amp;gt; but I'm guessing it returned the same thing.
&lt;/div&gt;&lt;/div&gt;Thanks, there was a trivial typo in bind_unix(), which caused it to 
&lt;br&gt;always fail.
&lt;br&gt;&lt;br&gt;I couldn't reproduce any problems with connect_unix().
&lt;br&gt;&lt;br&gt;&amp;gt; I tried reverting the code in those commits and it solved the problem.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; // Pontus Rodling
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Henrik Grubbström					&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26677465&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;grubba@...&lt;/a&gt;
&lt;br&gt;Roxen Internet Software AB&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/UNIX-socket-support-broken-tp26671464p26677465.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26671464</id>
	<title>UNIX socket support broken</title>
	<published>2009-12-06T17:54:32Z</published>
	<updated>2009-12-06T17:54:32Z</updated>
	<author>
		<name>Pontus Rodling</name>
	</author>
	<content type="html">Hi!
&lt;br&gt;It seems that some updates related to path length limits in 
&lt;br&gt;modules/files/file.c and modules/files/socket.c broke the UNIX socket 
&lt;br&gt;support.
&lt;br&gt;More specifically Stdio.Port()-&amp;gt;bind_unix() and 
&lt;br&gt;Stdio.File()-&amp;gt;connect_unix().
&lt;br&gt;&lt;br&gt;v1.416 in file.c and v1.104 in socket.c.
&lt;br&gt;Commit message: &amp;quot;Fixed length-limit in bind_unix(). Added automatic 
&lt;br&gt;retry on EINTR to bind_unix().&amp;quot;
&lt;br&gt;&lt;br&gt;Calling Stdio.Port()-&amp;gt;bind_unix(...) returned 0 and strerror(errno()) 
&lt;br&gt;gave me &amp;quot;Invalid argument&amp;quot;, I didn't check the errno from 
&lt;br&gt;Stdio.File()-&amp;gt;connect_unix but I'm guessing it returned the same thing.
&lt;br&gt;&lt;br&gt;I tried reverting the code in those commits and it solved the problem.
&lt;br&gt;&lt;br&gt;// Pontus Rodling
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/UNIX-socket-support-broken-tp26671464p26671464.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26649915</id>
	<title>Re: Pike crash</title>
	<published>2009-12-04T14:02:52Z</published>
	<updated>2009-12-04T14:02:52Z</updated>
	<author>
		<name>Dan Nelson</name>
	</author>
	<content type="html">In the last episode (Dec 04), Daniel Bengtsson said:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Thu, 03 Dec 2009 21:10:54 +0100, Dan Nelson &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26649915&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dnelson@...&lt;/a&gt;&amp;gt; &amp;nbsp;wrote:
&lt;br&gt;&amp;gt; &amp;gt; In the last episode (Dec 03), Daniel Bengtsson said:
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; I am having problem with a Pike script crashing Pike. The problem
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; happens on a windows machine (vista), the same script has never caused
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; any issues on linux. &amp;nbsp;Using pike 7.6 I saw no output at all when it
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; happened, but using 7.8.352 I get the following message in the console:
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;quot;This application has requested the Runtime to terminate it in an
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; unusual way. &amp;nbsp;Please contact the application's support team for more
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; information&amp;quot;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; According to log messages it suggests that the last operation might be
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; a call to mv on a directory.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; Any suggestions how to debug this or find out what the problem is ?
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Event Viewer might have more information regarding the location of the
&lt;br&gt;&amp;gt; &amp;gt; crash. &amp;nbsp;You could also install the Debugging Tools for Windows and use
&lt;br&gt;&amp;gt; &amp;gt; windbg to attach to the process and see what the call stack looks like.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &lt;a href=&quot;http://www.microsoft.com/whdc/devtools/debugging/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.microsoft.com/whdc/devtools/debugging/&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; In the event viewer I can see this at the same timestamp as the crash:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;quot;Faulting application pike.exe, version 0.0.0.0, time stamp 0x4aba8624,
&lt;br&gt;&amp;gt; faulting module pike.exe, version 0.0.0.0, time stamp 0x4aba8624,
&lt;br&gt;&amp;gt; exception code 0x40000015, fault offset 0x000faf4a, process id 0xf30,
&lt;br&gt;&amp;gt; application start time 0x01ca739c94dc9180.&amp;quot;
&lt;/div&gt;&lt;br&gt;Google says that 0x40000015 is STATUS_FATAL_APP_EXIT &amp;quot;Fatal Application
&lt;br&gt;Exit&amp;quot;, which doesn't say all that much. &amp;nbsp;Running pike from within windbg (or
&lt;br&gt;attaching windbg to a running pike before it crashes) will let you get the
&lt;br&gt;stacks for the faulting thread. &amp;nbsp;I think the &amp;quot;!analyze&amp;quot; command is all you
&lt;br&gt;have to run once it faults. &amp;nbsp;If &amp;quot;!analyze&amp;quot; doesn't print anything
&lt;br&gt;interesting, &amp;quot;~* kp&amp;quot; should at least print a stack trace for all threads. 
&lt;br&gt;The windows pike distribution includes a symbol file, so the stack trace
&lt;br&gt;should have function names and arguments in it.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dan Nelson
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26649915&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dnelson@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Pike-crash-tp26624428p26649915.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26643326</id>
	<title>eureka reinstall</title>
	<published>2009-12-04T06:30:10Z</published>
	<updated>2009-12-04T06:30:10Z</updated>
	<author>
		<name>Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum</name>
	</author>
	<content type="html">That got postponed dur to me getting sick during the planned service
&lt;br&gt;window, but there will be another try in an hour or so. This time I'll
&lt;br&gt;split the mirror try and prepare the new OS on the detached
&lt;br&gt;disk in another machine, so there should be very little downtime
&lt;br&gt;today.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/eureka-reinstall-tp26062988p26643326.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26641560</id>
	<title>Counting the indices of a mapping</title>
	<published>2009-12-04T04:00:04Z</published>
	<updated>2009-12-04T04:00:04Z</updated>
	<author>
		<name>Mirar @ Pike  importmöte för mailinglistan</name>
	</author>
	<content type="html">Apply sizeof() to each value of the top-level mapping and add the
&lt;br&gt;result together:
&lt;br&gt;&lt;br&gt;&amp;nbsp; `+(0, @map(values(foo), sizeof))
&lt;br&gt;&lt;br&gt;(I've added the extra 0 to handle the case of foo being empty.)
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/probably-a-small-bug-tp26099631p26641560.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26641541</id>
	<title>Re: Pike crash</title>
	<published>2009-12-04T03:57:26Z</published>
	<updated>2009-12-04T03:57:26Z</updated>
	<author>
		<name>Bugzilla from danielb@opera.com</name>
	</author>
	<content type="html">On Thu, 03 Dec 2009 21:10:54 +0100, Dan Nelson &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26641541&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dnelson@...&lt;/a&gt;&amp;gt; &amp;nbsp;
&lt;br&gt;wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; In the last episode (Dec 03), Daniel Bengtsson said:
&lt;br&gt;&amp;gt;&amp;gt; I am having problem with a Pike script crashing Pike. The problem &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; happens
&lt;br&gt;&amp;gt;&amp;gt; on a windows machine (vista), the same script has never caused any &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; issues
&lt;br&gt;&amp;gt;&amp;gt; on linux. &amp;nbsp;Using pike 7.6 I saw no output at all when it happened, but
&lt;br&gt;&amp;gt;&amp;gt; using 7.8.352 I get the following message in the console:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;This application has requested the Runtime to terminate it in an &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; unusual
&lt;br&gt;&amp;gt;&amp;gt; way. Please contact the application's support team for more information&amp;quot;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; According to log messages it suggests that the last operation might be a
&lt;br&gt;&amp;gt;&amp;gt; call to mv on a directory.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Any suggestions how to debug this or find out what the problem is ?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Event Viewer might have more information regarding the location of the
&lt;br&gt;&amp;gt; crash. &amp;nbsp;You could also install the Debugging Tools for Windows and use
&lt;br&gt;&amp;gt; windbg to attach to the process and see what the call stack looks like.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.microsoft.com/whdc/devtools/debugging/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.microsoft.com/whdc/devtools/debugging/&lt;/a&gt;&lt;/div&gt;&lt;br&gt;In the event viewer I can see this at the same timestamp as the crash:
&lt;br&gt;&lt;br&gt;&amp;quot;Faulting application pike.exe, version 0.0.0.0, time stamp 0x4aba8624, &amp;nbsp;
&lt;br&gt;faulting module pike.exe, version 0.0.0.0, time stamp 0x4aba8624, &amp;nbsp;
&lt;br&gt;exception code 0x40000015, fault offset 0x000faf4a, process id 0xf30, &amp;nbsp;
&lt;br&gt;application start time 0x01ca739c94dc9180.&amp;quot;
&lt;br&gt;&lt;br&gt;/Daniel
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Pike-crash-tp26624428p26641541.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26641358</id>
	<title>Counting the indices of a mapping</title>
	<published>2009-12-04T03:40:45Z</published>
	<updated>2009-12-04T03:40:45Z</updated>
	<author>
		<name>Michael Hartman-3</name>
	</author>
	<content type="html">I know you can easily get the indices of a mapping with indices( mapping 
&lt;br&gt;foo ).
&lt;br&gt;&lt;br&gt;Is there an east/fast way to get the second level of indices, or to just 
&lt;br&gt;count the number of indices of a nested mapping?
&lt;br&gt;&lt;br&gt;For example, assume the following:
&lt;br&gt;&lt;br&gt;mapping foo =
&lt;br&gt;([
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;quot;element a&amp;quot; :
&lt;br&gt;&amp;nbsp; &amp;nbsp; ([
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;foo&amp;quot; : 1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;bar&amp;quot; : 2
&lt;br&gt;&amp;nbsp; &amp;nbsp; ])
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;quot;element b&amp;quot; :
&lt;br&gt;&amp;nbsp; &amp;nbsp; ([
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;stuff&amp;quot; : 1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;more stuff&amp;quot; : 2
&lt;br&gt;&amp;nbsp; &amp;nbsp; ])
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;quot;element c&amp;quot; :
&lt;br&gt;&amp;nbsp; &amp;nbsp; ([
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;even more stuff&amp;quot; : 1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;mega stuff&amp;quot; : 2
&lt;br&gt;&amp;nbsp; &amp;nbsp; ])
&lt;br&gt;])
&lt;br&gt;&lt;br&gt;Is there a fast/easy way to count up the second level of indices, where 
&lt;br&gt;the result would be 6.
&lt;br&gt;&lt;br&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Michael A. Hartman, J.D.
&lt;br&gt;President and CEO, Frogdice, Inc.
&lt;br&gt;&lt;a href=&quot;http://www.frogdice.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.frogdice.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/probably-a-small-bug-tp26099631p26641358.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26637004</id>
	<title>sscanf parttern matching (was bug?)</title>
	<published>2009-12-03T18:27:45Z</published>
	<updated>2009-12-03T18:27:45Z</updated>
	<author>
		<name>Martin Baehr</name>
	</author>
	<content type="html">On Thu, Dec 03, 2009 at 10:55:02PM +0000, Martin Stjernholm, Roxen IS @ Pike &amp;nbsp;developers forum wrote:
&lt;br&gt;&amp;gt; If there was backtracking, the second case would return ({&amp;quot;abc-&amp;quot;})
&lt;br&gt;&amp;gt; since %d didn't parse &amp;quot;-&amp;quot; successfully. Now it's just lost.
&lt;br&gt;&lt;br&gt;on a related topic: is there a way to find out if the format has been
&lt;br&gt;parsed successfully? ie. in the above example, i'd like to get an error
&lt;br&gt;instead of an incomplete result. yes, i could check manually, but that
&lt;br&gt;implies that i understand or know the format, which is not aleays the
&lt;br&gt;case as it could come from somewhere else, even from user input.
&lt;br&gt;&lt;br&gt;i'd like to use sscanf as an alternative to regexp pattern matching
&lt;br&gt;&lt;br&gt;greetings, martin.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/sscanf-bug--tp26621991p26637004.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26634763</id>
	<title>sscanf bug?</title>
	<published>2009-12-03T14:55:02Z</published>
	<updated>2009-12-03T14:55:02Z</updated>
	<author>
		<name>Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum</name>
	</author>
	<content type="html">Yes, I guess it should. Wonder how much of a compatibility problem it
&lt;br&gt;would be to change that.
&lt;br&gt;&lt;br&gt;Personally I don't really like the dwim in %s in situations like that;
&lt;br&gt;I prefer to use %[...] instead. %s essentially becomes e.g.
&lt;br&gt;%[^0-9+-] if followed by %d, but there's no full backtracking if the
&lt;br&gt;following input specifier fails. Compare:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;gt; array_sscanf(&amp;quot;abc-123&amp;quot;, &amp;quot;%s%d&amp;quot;);
&lt;br&gt;&amp;nbsp; (2) Result: ({ /* 2 elements */
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;abc&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -123
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })
&lt;br&gt;&amp;nbsp; &amp;gt; array_sscanf(&amp;quot;abc-&amp;quot;, &amp;quot;%s%d&amp;quot;);
&lt;br&gt;&amp;nbsp; (3) Result: ({ /* 1 element */
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;abc&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })
&lt;br&gt;&lt;br&gt;If there was backtracking, the second case would return ({&amp;quot;abc-&amp;quot;})
&lt;br&gt;since %d didn't parse &amp;quot;-&amp;quot; successfully. Now it's just lost.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/sscanf-bug--tp26621991p26634763.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26632419</id>
	<title>Re: Pike crash</title>
	<published>2009-12-03T12:10:54Z</published>
	<updated>2009-12-03T12:10:54Z</updated>
	<author>
		<name>Dan Nelson</name>
	</author>
	<content type="html">In the last episode (Dec 03), Daniel Bengtsson said:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I am having problem with a Pike script crashing Pike. The problem happens
&lt;br&gt;&amp;gt; on a windows machine (vista), the same script has never caused any issues
&lt;br&gt;&amp;gt; on linux. &amp;nbsp;Using pike 7.6 I saw no output at all when it happened, but
&lt;br&gt;&amp;gt; using 7.8.352 I get the following message in the console:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;quot;This application has requested the Runtime to terminate it in an unusual &amp;nbsp;
&lt;br&gt;&amp;gt; way. Please contact the application's support team for more information&amp;quot;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; According to log messages it suggests that the last operation might be a &amp;nbsp;
&lt;br&gt;&amp;gt; call to mv on a directory.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Any suggestions how to debug this or find out what the problem is ?
&lt;/div&gt;&lt;br&gt;Event Viewer might have more information regarding the location of the
&lt;br&gt;crash. &amp;nbsp;You could also install the Debugging Tools for Windows and use
&lt;br&gt;windbg to attach to the process and see what the call stack looks like.
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.microsoft.com/whdc/devtools/debugging/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.microsoft.com/whdc/devtools/debugging/&lt;/a&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dan Nelson
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26632419&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dnelson@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Pike-crash-tp26624428p26632419.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26624428</id>
	<title>Pike crash</title>
	<published>2009-12-03T03:21:45Z</published>
	<updated>2009-12-03T03:21:45Z</updated>
	<author>
		<name>Bugzilla from danielb@opera.com</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;I am having problem with a Pike script crashing Pike. The problem happens &amp;nbsp;
&lt;br&gt;on a windows machine (vista), the same script has never caused any issues &amp;nbsp;
&lt;br&gt;on linux. Using pike 7.6 I saw no output at all when it happened, but &amp;nbsp;
&lt;br&gt;using 7.8.352 I get the following message in the console:
&lt;br&gt;&lt;br&gt;&amp;quot;This application has requested the Runtime to terminate it in an unusual &amp;nbsp;
&lt;br&gt;way. Please contact the application's support team for more information&amp;quot;
&lt;br&gt;&lt;br&gt;According to log messages it suggests that the last operation might be a &amp;nbsp;
&lt;br&gt;call to mv on a directory.
&lt;br&gt;&lt;br&gt;Any suggestions how to debug this or find out what the problem is ?
&lt;br&gt;&lt;br&gt;/Daniel
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Pike-crash-tp26624428p26624428.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26621991</id>
	<title>sscanf bug?</title>
	<published>2009-12-02T23:30:30Z</published>
	<updated>2009-12-02T23:30:30Z</updated>
	<author>
		<name>Martin Baehr</name>
	</author>
	<content type="html">hi, 
&lt;br&gt;&lt;br&gt;shouldn't those two examples be the same?
&lt;br&gt;&lt;br&gt;&amp;gt; array_sscanf(&amp;quot;124dsf134&amp;quot;, &amp;quot;%d%s%3d&amp;quot;);
&lt;br&gt;(5) Result: ({ /* 2 elements */
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 124,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;dsf134&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })
&lt;br&gt;&amp;gt; array_sscanf(&amp;quot;124dsf134&amp;quot;, &amp;quot;%d%s%d&amp;quot;);
&lt;br&gt;(6) Result: ({ /* 3 elements */
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 124,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;dsf&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 134
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })
&lt;br&gt;&lt;br&gt;greetings, martin.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/sscanf-bug--tp26621991p26621991.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26615923</id>
	<title>GTK2.FileChooserDialog missing in latest snapshot?</title>
	<published>2009-12-02T12:32:38Z</published>
	<updated>2009-12-02T12:32:38Z</updated>
	<author>
		<name>Yvan Vander Sanden</name>
	</author>
	<content type="html">Hey all.&lt;br&gt;&lt;br&gt;I can&amp;#39;t figure out why, but it seems that GTK2.FileChooserDialog is missing in the latest snapshot. I get this error when using it:&lt;br&gt;&lt;br&gt;Too many arguments to `() (function call) (expected 0 arguments)&lt;br&gt;
&lt;br&gt;and indeed, the commandline pike version does not suggest the FileChooserDialog either, when trying to autocomplete.&lt;br&gt;&lt;br&gt;I compiled the latest stable build again on the same computer, and it works again. (Perhaps I should learn to use stable builds as long as I&amp;#39;m a beginner...)&lt;br&gt;
&lt;br&gt;Regards,&lt;br&gt;&lt;br&gt;yvan&lt;br&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Copyright only exists in the imagination of those who do not have any.&lt;br&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/GTK2.FileChooserDialog-missing-in-latest-snapshot--tp26615923p26615923.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26574787</id>
	<title>Re: More rtldebug to get better info when gc_mark problems happen.</title>
	<published>2009-11-30T05:35:03Z</published>
	<updated>2009-11-30T05:35:03Z</updated>
	<author>
		<name>Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum</name>
	</author>
	<content type="html">Pikefarm spotted it form me; it broke 11 different builds. &amp;nbsp;;-)
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/More-rtldebug-to-get-better-info-when-gc_mark-problems-happen.-tp26573568p26574787.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26574520</id>
	<title>Re: More rtldebug to get better info when gc_mark problems happen.</title>
	<published>2009-11-30T05:14:35Z</published>
	<updated>2009-11-30T05:14:35Z</updated>
	<author>
		<name>Martin Stjernholm</name>
	</author>
	<content type="html">Quite right. Thanks for spotting it.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/More-rtldebug-to-get-better-info-when-gc_mark-problems-happen.-tp26573568p26574520.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26573568</id>
	<title>More rtldebug to get better info when gc_mark problems happen.</title>
	<published>2009-11-30T04:00:03Z</published>
	<updated>2009-11-30T04:00:03Z</updated>
	<author>
		<name>Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum</name>
	</author>
	<content type="html">Um, the latest commit to Makefile (by mast) was a mistake, no?
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/More-rtldebug-to-get-better-info-when-gc_mark-problems-happen.-tp26573568p26573568.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26572268</id>
	<title>Re: segfault when trying out embedding demo program</title>
	<published>2009-11-30T02:19:00Z</published>
	<updated>2009-11-30T02:19:00Z</updated>
	<author>
		<name>Henrik Grubbström-2</name>
	</author>
	<content type="html">On Fri, 27 Nov 2009, H. William Welliver III wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Oh, I should also probably mention 2 things: first, I'm actively using 
&lt;br&gt;&amp;gt; embedded pike with good success using the Objective-C OCPikeInterpreter class 
&lt;br&gt;&amp;gt; to build Native Mac OSX GUI applications and second, that I have difficulty 
&lt;br&gt;&amp;gt; getting pike to exit happily at times... usually things end with pike 
&lt;br&gt;&amp;gt; thinking a fatal error has occurred and that there is no error handling 
&lt;br&gt;&amp;gt; context, even though there isn't actually an error that I'm aware of. If you
&lt;br&gt;&lt;br&gt;Note that predef::exit() is implemented via a throw of an error with 
&lt;br&gt;severity THROW_EXIT, which won't be caught by normal catches. Take a look 
&lt;br&gt;at the code in pike_embed.c:init_pike_runtime() to see how to catch those.
&lt;br&gt;&lt;br&gt;&amp;gt; do see this problem, do post about it and maybe we can figure out what we're 
&lt;br&gt;&amp;gt; doing wrong. :)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Good luck!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Bill
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Henrik Grubbström					&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26572268&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;grubba@...&lt;/a&gt;
&lt;br&gt;Roxen Internet Software AB&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/segfault-when-trying-out-embedding-demo-program-tp26533156p26572268.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26572140</id>
	<title>patch for string_builder_vsprintf</title>
	<published>2009-11-30T02:10:03Z</published>
	<updated>2009-11-30T02:10:03Z</updated>
	<author>
		<name>Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum</name>
	</author>
	<content type="html">Applied similar patch (with a bugfix regarding handling of 0.0).
&lt;br&gt;Thanks.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/patch-for-string_builder_vsprintf-tp26482708p26572140.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26554092</id>
	<title>The OOB working test</title>
	<published>2009-11-28T07:30:02Z</published>
	<updated>2009-11-28T07:30:02Z</updated>
	<author>
		<name>Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum</name>
	</author>
	<content type="html">The difference is not between 7.6 and 7.8. I don't know what it is
&lt;br&gt;though; it doesn't seem just random either.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/The-OOB-working-test-tp26552722p26554092.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26554018</id>
	<title>patch for string_builder_vsprintf</title>
	<published>2009-11-28T07:20:03Z</published>
	<updated>2009-11-28T07:20:03Z</updated>
	<author>
		<name>Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum</name>
	</author>
	<content type="html">Looks ok to me, but I've only checked it superficially. Maybe Grubba
&lt;br&gt;who wrote that function should have a say.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/patch-for-string_builder_vsprintf-tp26482708p26554018.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26553723</id>
	<title>Protocols.DNS.server</title>
	<published>2009-11-28T06:44:08Z</published>
	<updated>2009-11-28T06:44:08Z</updated>
	<author>
		<name>Tobias S. Josefowitz</name>
	</author>
	<content type="html">I've added multi-port-functionality and the ability to reply to DNS
&lt;br&gt;queries asynchronously to Protocols.DNS.server.
&lt;br&gt;A diff file is attached.
&lt;br&gt;&lt;br&gt;Tobias
&lt;br&gt;&lt;br /&gt;diff --git a/modules/Protocols.pmod/DNS.pmod b/modules/Protocols.pmod/DNS.pmod
&lt;br&gt;index c63dec7..0f74b9f 100644
&lt;br&gt;--- a/modules/Protocols.pmod/DNS.pmod
&lt;br&gt;+++ b/modules/Protocols.pmod/DNS.pmod
&lt;br&gt;@@ -623,9 +623,9 @@ class server
&lt;br&gt;&amp;nbsp; &amp;nbsp;//!
&lt;br&gt;&amp;nbsp; &amp;nbsp;inherit protocol;
&lt;br&gt;&amp;nbsp;
&lt;br&gt;- &amp;nbsp;inherit Stdio.UDP : udp;
&lt;br&gt;+ &amp;nbsp;//inherit Stdio.UDP : udp;
&lt;br&gt;&amp;nbsp;
&lt;br&gt;- &amp;nbsp;protected void send_reply(mapping r, mapping q, mapping m)
&lt;br&gt;+ &amp;nbsp;protected void send_reply(mapping r, mapping q, mapping m, Stdio.UDP udp)
&lt;br&gt;&amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;// FIXME: Needs to handle truncation somehow.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if(!r)
&lt;br&gt;@@ -636,7 +636,7 @@ class server
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;r-&amp;gt;rd = q-&amp;gt;rd;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;r-&amp;gt;qd = r-&amp;gt;qd || q-&amp;gt;qd;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;string s = mkquery(r);
&lt;br&gt;- &amp;nbsp; &amp;nbsp;udp::send(m-&amp;gt;ip, m-&amp;gt;port, s);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;udp-&amp;gt;send(m-&amp;gt;ip, m-&amp;gt;port, s);
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp;//! Reply to a query (stub).
&lt;br&gt;@@ -647,6 +647,10 @@ class server
&lt;br&gt;&amp;nbsp; &amp;nbsp;//! @param udp_data
&lt;br&gt;&amp;nbsp; &amp;nbsp;//! &amp;nbsp; Raw UDP data.
&lt;br&gt;&amp;nbsp; &amp;nbsp;//!
&lt;br&gt;+ &amp;nbsp;//! @param cb
&lt;br&gt;+ &amp;nbsp;//!	Callback you can call with the result instead of returning it.
&lt;br&gt;+ &amp;nbsp;//!	In that case, return @expr{0@} (zero).
&lt;br&gt;+ &amp;nbsp;//!
&lt;br&gt;&amp;nbsp; &amp;nbsp;//! Overload this function to implement the proper lookup.
&lt;br&gt;&amp;nbsp; &amp;nbsp;//!
&lt;br&gt;&amp;nbsp; &amp;nbsp;//! @returns
&lt;br&gt;@@ -666,7 +670,8 @@ class server
&lt;br&gt;&amp;nbsp; &amp;nbsp;//! &amp;nbsp; &amp;nbsp; @member array|void &amp;quot;ns&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp;//! &amp;nbsp; &amp;nbsp; @member array|void &amp;quot;ar&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp;//! &amp;nbsp; @endmapping
&lt;br&gt;- &amp;nbsp;protected mapping reply_query(mapping query, mapping udp_data)
&lt;br&gt;+ &amp;nbsp;protected mapping reply_query(mapping query, mapping udp_data,
&lt;br&gt;+				function(mapping:void) cb)
&lt;br&gt;&amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;// Override this function.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;//
&lt;br&gt;@@ -676,18 +681,32 @@ class server
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;return 0;
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp;
&lt;br&gt;- &amp;nbsp;protected void handle_query(mapping q, mapping m)
&lt;br&gt;+ &amp;nbsp;protected void handle_query(mapping q, mapping m, Stdio.UDP udp)
&lt;br&gt;&amp;nbsp; &amp;nbsp;{
&lt;br&gt;- &amp;nbsp; &amp;nbsp;mapping r = reply_query(q, m);
&lt;br&gt;- &amp;nbsp; &amp;nbsp;send_reply(r, q, m);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;int(0..1) result_available = 0;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;void _cb(mapping r) {
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;if(result_available)
&lt;br&gt;+	error(&amp;quot;DNS: you can either use the callback OR return the reply, not &amp;quot;
&lt;br&gt;+	 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;both.\n&amp;quot;);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;result_available = 1;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;send_reply(r, q, m, udp);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;};
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;mapping r = reply_query(q, m, _cb);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;if(r &amp;&amp; result_available)
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;error(&amp;quot;DNS: you can either use the callback OR return the reply, not &amp;quot;
&lt;br&gt;+	 &amp;nbsp; &amp;nbsp;&amp;quot;both.\n&amp;quot;);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;if(r) {
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;result_available = 1;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;send_reply(r, q, m, udp);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp;
&lt;br&gt;- &amp;nbsp;protected void handle_response(mapping r, mapping m)
&lt;br&gt;+ &amp;nbsp;protected void handle_response(mapping r, mapping m, Stdio.UDP udp)
&lt;br&gt;&amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;// This is a stub intended to simplify servers which allow recursion
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp;
&lt;br&gt;- &amp;nbsp;protected private void rec_data(mapping m)
&lt;br&gt;+ &amp;nbsp;protected private void rec_data(mapping m, Stdio.UDP udp)
&lt;br&gt;&amp;nbsp; &amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;mixed err;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;mapping q;
&lt;br&gt;@@ -698,27 +717,40 @@ class server
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp; describe_backtrace(err));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(m &amp;&amp; m-&amp;gt;data &amp;&amp; sizeof(m-&amp;gt;data)&amp;gt;=2)
&lt;br&gt;&amp;nbsp;	send_reply(([&amp;quot;rcode&amp;quot;:1]),
&lt;br&gt;-		 &amp;nbsp; mkmapping(({&amp;quot;id&amp;quot;}), array_sscanf(m-&amp;gt;data, &amp;quot;%2c&amp;quot;)), m);
&lt;br&gt;+		 &amp;nbsp; mkmapping(({&amp;quot;id&amp;quot;}), array_sscanf(m-&amp;gt;data, &amp;quot;%2c&amp;quot;)), m, udp);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;else if(q-&amp;gt;qr)
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;handle_response(q, m);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;handle_response(q, m, udp);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;else
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;handle_query(q, m);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;handle_query(q, m, udp);
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp;
&lt;br&gt;- &amp;nbsp;void create(int|void port)
&lt;br&gt;+ &amp;nbsp;void create(int|string|void arg1, string|int ... args)
&lt;br&gt;&amp;nbsp; &amp;nbsp;{
&lt;br&gt;- &amp;nbsp; &amp;nbsp;if(!port)
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;port = 53;
&lt;br&gt;- &amp;nbsp; &amp;nbsp;if(!udp::bind(port))
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;error(&amp;quot;DNS: failed to bind port &amp;quot;+port+&amp;quot;.\n&amp;quot;);
&lt;br&gt;-#if 0
&lt;br&gt;- &amp;nbsp; &amp;nbsp;werror(&amp;quot;Protocols.DNS.server(%O)\n&amp;quot;
&lt;br&gt;-	 &amp;nbsp; &amp;quot;UDP Address: %s\n&amp;quot;
&lt;br&gt;-	 &amp;nbsp; &amp;quot;%s\n&amp;quot;, port, udp::query_address(),
&lt;br&gt;-	 &amp;nbsp; describe_backtrace(backtrace()));
&lt;br&gt;-#endif /* 0 */
&lt;br&gt;- &amp;nbsp; &amp;nbsp;udp::set_read_callback(rec_data);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;if(!arg1 &amp;&amp; !sizeof(args))
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;arg1 = 53;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;if(!sizeof(args))
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;if(stringp(arg1))
&lt;br&gt;+	args = ({ arg1, 53 });
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;else
&lt;br&gt;+	args = ({ 0, arg1 });
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;else
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;args = ({ arg1 }) + args;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;if(sizeof(args)&amp;1)
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;error(&amp;quot;DNS: if you specify more than one argument, the number of &amp;quot;
&lt;br&gt;+	 &amp;nbsp; &amp;nbsp;&amp;quot;arguments needs to be even (server(ip1, port1, ip2, port2, &amp;quot;
&lt;br&gt;+	 &amp;nbsp; &amp;nbsp;&amp;quot;...)).\n&amp;quot;);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;for(int i;i&amp;lt;sizeof(args);i+=2) {
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;Stdio.UDP udp = Stdio.UDP();
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;if(args[i]) {
&lt;br&gt;+	if (!udp-&amp;gt;bind(args[i+1],args[i]))
&lt;br&gt;+	 &amp;nbsp;error(&amp;quot;DNS: failed to bind host:port %s:%d.\n&amp;quot;, args[i],args[i+1]);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;} else {
&lt;br&gt;+	if(!udp-&amp;gt;bind(args[i+1]))
&lt;br&gt;+	 &amp;nbsp;error(&amp;quot;DNS: failed to bind port %d.\n&amp;quot;, args[i+1]);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;udp-&amp;gt;set_read_callback(rec_data, udp);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp;}
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Protocols.DNS.server-tp26553723p26553723.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26552979</id>
	<title>The OOB working test</title>
	<published>2009-11-28T05:05:03Z</published>
	<updated>2009-11-28T05:05:03Z</updated>
	<author>
		<name>Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum</name>
	</author>
	<content type="html">My guess is that the set of detected operating system features differs
&lt;br&gt;between the two. Try comparing the output from running just the
&lt;br&gt;preprocessor.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/The-OOB-working-test-tp26552722p26552979.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26552722</id>
	<title>The OOB working test</title>
	<published>2009-11-28T04:30:02Z</published>
	<updated>2009-11-28T04:30:02Z</updated>
	<author>
		<name>Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum</name>
	</author>
	<content type="html">I noticed that the OOB check fails with TIMEOUT in 7.8 on my linux
&lt;br&gt;box. It produces SEMIWORKING in 7.6, so something is different in the
&lt;br&gt;configure script, although the test itself is identical.
&lt;br&gt;&lt;br&gt;The log doesn't say much. Here's from 7.8:
&lt;br&gt;&lt;br&gt;&amp;nbsp; configure:70034: checking how well OOB handling works
&lt;br&gt;&amp;nbsp; configure:70366: /home/mast/Pike/no-changes-7.8/build/linux-x86_64/smartlink gcc -o conftest -g &amp;nbsp;-O3 -pipe -ggdb3 -m64 &amp;nbsp;-I/home/mast/Pike/no-changes-7.8/build/linux-x86_64/bundles/include -I/usr/local/include -I/home/mast/Pike/no-changes-7.8/src -I/home/mast/Pike/no-changes-7.8/build/linux-x86_64 &amp;nbsp;-L/home/mast/Pike/no-changes-7.8/build/linux-x86_64/bundles/lib64 -L/home/mast/Pike/no-changes-7.8/build/linux-x86_64/bundles/lib/64 -L/home/mast/Pike/no-changes-7.8/build/linux-x86_64/bundles/lib/. -L/usr/local/lib -L/usr/lib/gcc/x86_64-linux-gnu/4.4 -R/usr/lib/gcc/x86_64-linux-gnu/4.4 conftest.c -ldl -lrt -lnsl -lm &amp;nbsp;-lpthread -lcrypt &amp;gt;&amp;5
&lt;br&gt;&amp;nbsp; conftest.c: In function 'my_socketpair':
&lt;br&gt;&amp;nbsp; conftest.c:362: warning: incompatible implicit declaration of built-in function 'memset'
&lt;br&gt;&amp;nbsp; conftest.c: In function 'ping':
&lt;br&gt;&amp;nbsp; conftest.c:527: warning: incompatible implicit declaration of built-in function 'exit'
&lt;br&gt;&amp;nbsp; conftest.c:535: warning: incompatible implicit declaration of built-in function 'exit'
&lt;br&gt;&amp;nbsp; conftest.c: In function 'pong':
&lt;br&gt;&amp;nbsp; conftest.c:552: warning: incompatible implicit declaration of built-in function 'exit'
&lt;br&gt;&amp;nbsp; conftest.c: In function 'pang':
&lt;br&gt;&amp;nbsp; conftest.c:570: warning: incompatible implicit declaration of built-in function 'exit'
&lt;br&gt;&amp;nbsp; conftest.c: In function 'main':
&lt;br&gt;&amp;nbsp; conftest.c:591: warning: incompatible implicit declaration of built-in function 'exit'
&lt;br&gt;&amp;nbsp; configure:70366: $? = 0
&lt;br&gt;&amp;nbsp; configure:70366: ./conftest
&lt;br&gt;&amp;nbsp; my_socketpair: succeeded
&lt;br&gt;&amp;nbsp; configure:70366: $? = 0
&lt;br&gt;&amp;nbsp; configure:70381: result: TIMEOUT
&lt;br&gt;&lt;br&gt;Compared to 7.6:
&lt;br&gt;&lt;br&gt;&amp;nbsp; configure:50000: checking how well OOB handling works
&lt;br&gt;&amp;nbsp; configure:50342: /home/mast/Pike/frozen/build/linux-x86_64/smartlink gcc -o conftest -g -O2 -pipe -Wa,--execstack &amp;nbsp;-I/home/mast/Pike/frozen/build/linux-x86_64/bundles/include -I/usr/local/include -I/home/mast/Pike/frozen/src -I/home/mast/Pike/frozen/build/linux-x86_64 &amp;nbsp;-L/home/mast/Pike/frozen/build/linux-x86_64/bundles/lib -z execstack -R/usr/local/lib -L/usr/local/lib -R/usr/X11R6/lib -L/usr/X11R6/lib -R/usr/lib/gcc/x86_64-linux-gnu/4.4 -L/usr/lib/gcc/x86_64-linux-gnu/4.4 conftest.c -ldl -lrt -lnsl -lm &amp;nbsp;-lpthread -lcrypt &amp;gt;&amp;5
&lt;br&gt;&amp;nbsp; conftest.c: In function 'my_socketpair':
&lt;br&gt;&amp;nbsp; conftest.c:333: warning: incompatible implicit declaration of built-in function 'memset'
&lt;br&gt;&amp;nbsp; conftest.c: In function 'ping':
&lt;br&gt;&amp;nbsp; conftest.c:498: warning: incompatible implicit declaration of built-in function 'exit'
&lt;br&gt;&amp;nbsp; conftest.c:506: warning: incompatible implicit declaration of built-in function 'exit'
&lt;br&gt;&amp;nbsp; conftest.c: In function 'pong':
&lt;br&gt;&amp;nbsp; conftest.c:523: warning: incompatible implicit declaration of built-in function 'exit'
&lt;br&gt;&amp;nbsp; conftest.c: In function 'pang':
&lt;br&gt;&amp;nbsp; conftest.c:541: warning: incompatible implicit declaration of built-in function 'exit'
&lt;br&gt;&amp;nbsp; conftest.c: In function 'main':
&lt;br&gt;&amp;nbsp; conftest.c:562: warning: incompatible implicit declaration of built-in function 'exit'
&lt;br&gt;&amp;nbsp; configure:50345: $? = 0
&lt;br&gt;&amp;nbsp; configure:50351: ./conftest
&lt;br&gt;&amp;nbsp; my_socketpair: succeeded
&lt;br&gt;&amp;nbsp; configure:50354: $? = 0
&lt;br&gt;&amp;nbsp; configure:50375: result: SEMIWORKING
&lt;br&gt;&lt;br&gt;I've tried changing the compiler flags to match 7.6 (-O2 instead of
&lt;br&gt;-O3 etc), but it doesn't change anything. What could the problem be?
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/The-OOB-working-test-tp26552722p26552722.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26537973</id>
	<title>Re: segfault when trying out embedding demo program</title>
	<published>2009-11-26T21:05:34Z</published>
	<updated>2009-11-26T21:05:34Z</updated>
	<author>
		<name>Bill Welliver</name>
	</author>
	<content type="html">Oh, I should also probably mention 2 things: first, I'm actively using &amp;nbsp;
&lt;br&gt;embedded pike with good success using the Objective-C &amp;nbsp;
&lt;br&gt;OCPikeInterpreter class to build Native Mac OSX GUI applications and &amp;nbsp;
&lt;br&gt;second, that I have difficulty getting pike to exit happily at &amp;nbsp;
&lt;br&gt;times... usually things end with pike thinking a fatal error has &amp;nbsp;
&lt;br&gt;occurred and that there is no error handling context, even though &amp;nbsp;
&lt;br&gt;there isn't actually an error that I'm aware of. If you do see this &amp;nbsp;
&lt;br&gt;problem, do post about it and maybe we can figure out what we're doing &amp;nbsp;
&lt;br&gt;wrong. :)
&lt;br&gt;&lt;br&gt;Good luck!
&lt;br&gt;&lt;br&gt;Bill
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/segfault-when-trying-out-embedding-demo-program-tp26533156p26537973.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26537957</id>
	<title>Re: segfault when trying out embedding demo program</title>
	<published>2009-11-26T21:00:18Z</published>
	<updated>2009-11-26T21:00:18Z</updated>
	<author>
		<name>Bill Welliver</name>
	</author>
	<content type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body style=&quot;word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; &quot;&gt;I just verified that example 2 does work (on OSX 10.6). Note that in the examples, you have to set the PIKE_MASTER environment variable, otherwise you will get a segfault. I imagine that this may be the problem. Note that push_pike_env() is no longer present, so you should remove that line from the examples.&amp;nbsp;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I don't know if there's any very good docs on embedding; basically you'll be using the same API you'd use for building c-modules. You'll probably also need to become familiar with apply() and friends. I'd imagine that you would want to build a c-module to provide an interface in pike for anything in the embedding application that you'd want to access from pike. From there, it's up to you.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;You might want to look at OCPikeInterpreter.m in the src directory; it's Objective-C, but should give you some idea of how to run pike code from C (in particular the call -evalString:.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Bill&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;On Nov 26, 2009, at 1:13 PM, Yvan Vander Sanden wrote:&lt;/div&gt;&lt;br class=&quot;Apple-interchange-newline&quot;&gt;&lt;blockquote type=&quot;cite&quot;&gt;I got my pike library ready now, and had some time to try out the actual embedding.&lt;br&gt;&lt;br&gt;I took the example program at &lt;a href=&quot;http://hww3.riverweb.com/dist/pike_embedding/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://hww3.riverweb.com/dist/pike_embedding/&lt;/a&gt;&lt;br&gt;
&lt;br&gt;Compiling and linking went ok, but the test program just segfaults. this is how i compile:&lt;br&gt;&lt;br&gt;gcc -I src/ -I build/linux -c main.c -o main.o&lt;br&gt;gcc main.o -o testpike -Lbuild/linux -lpike&lt;br&gt;&lt;br&gt;libpike is build/linux as well as in /lib&lt;br&gt;
&lt;br&gt;I am using a recent code snapshot and pike itself does work.&lt;br&gt;&lt;br&gt;- Is the example program still current? &lt;br&gt;- Is there any good documentation for embedding pike, except from the link i mentioned above?&lt;br&gt;&lt;br&gt;Regards,&lt;br&gt;
&lt;br&gt;yvan&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Copyright only exists in the imagination of those who do not have any.&lt;br&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/segfault-when-trying-out-embedding-demo-program-tp26533156p26537957.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26533156</id>
	<title>segfault when trying out embedding demo program</title>
	<published>2009-11-26T10:13:05Z</published>
	<updated>2009-11-26T10:13:05Z</updated>
	<author>
		<name>Yvan Vander Sanden</name>
	</author>
	<content type="html">I got my pike library ready now, and had some time to try out the actual embedding.&lt;br&gt;&lt;br&gt;I took the example program at &lt;a href=&quot;http://hww3.riverweb.com/dist/pike_embedding/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://hww3.riverweb.com/dist/pike_embedding/&lt;/a&gt;&lt;br&gt;
&lt;br&gt;Compiling and linking went ok, but the test program just segfaults. this is how i compile:&lt;br&gt;&lt;br&gt;gcc -I src/ -I build/linux -c main.c -o main.o&lt;br&gt;gcc main.o -o testpike -Lbuild/linux -lpike&lt;br&gt;&lt;br&gt;libpike is build/linux as well as in /lib&lt;br&gt;
&lt;br&gt;I am using a recent code snapshot and pike itself does work.&lt;br&gt;&lt;br&gt;- Is the example program still current? &lt;br&gt;- Is there any good documentation for embedding pike, except from the link i mentioned above?&lt;br&gt;&lt;br&gt;Regards,&lt;br&gt;
&lt;br&gt;yvan&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Copyright only exists in the imagination of those who do not have any.&lt;br&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---User-f14137.html&quot; embed=&quot;fixTarget[14137]&quot; target=&quot;_top&quot; &gt;Pike - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/segfault-when-trying-out-embedding-demo-program-tp26533156p26533156.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26482708</id>
	<title>patch for string_builder_vsprintf</title>
	<published>2009-11-23T09:24:36Z</published>
	<updated>2009-11-23T09:24:36Z</updated>
	<author>
		<name>Arne Goedeke</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;I noticed that only %f is supported in string_builder_vsprintf(). I
&lt;br&gt;would like to use something else in JSON2, so it would be nice if
&lt;br&gt;someone could review this and maybe commit.
&lt;br&gt;&lt;br&gt;arne
&lt;br&gt;&lt;br /&gt;diff --git a/src/stralloc.c b/src/stralloc.c
&lt;br&gt;index eb60b8b..e75d45b 100644
&lt;br&gt;--- a/src/stralloc.c
&lt;br&gt;+++ b/src/stralloc.c
&lt;br&gt;@@ -2945,13 +2945,17 @@ PMOD_EXPORT void string_builder_vsprintf(struct string_builder *s,
&lt;br&gt;&amp;nbsp;					flags, min_width, precision);
&lt;br&gt;&amp;nbsp;	 &amp;nbsp;break;
&lt;br&gt;&amp;nbsp;
&lt;br&gt;-	 &amp;nbsp;/* FIMXE: TODO: Doubles (ie 'a', 'e', 'E', 'g', 'G'). */
&lt;br&gt;-
&lt;br&gt;&amp;nbsp;	 &amp;nbsp;/* %f used in modules/Image/colors.c. */
&lt;br&gt;+	case 'a':
&lt;br&gt;+	case 'g':
&lt;br&gt;+	case 'G':
&lt;br&gt;+	case 'e':
&lt;br&gt;+	case 'E':
&lt;br&gt;&amp;nbsp;	case 'f':
&lt;br&gt;&amp;nbsp;	 &amp;nbsp;{
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp;double val = va_arg(args, double);
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp;size_t bytes;
&lt;br&gt;+	 &amp;nbsp; &amp;nbsp;char nfmt[] = { '%', *(fmt-1), 0 };
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp;if (PIKE_ISNAN(val)) {
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp; &amp;nbsp;/* NaN */
&lt;br&gt;@@ -2974,9 +2978,9 @@ PMOD_EXPORT void string_builder_vsprintf(struct string_builder *s,
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp; &amp;nbsp;break;
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp;/* FIXME: Field lengths and precision. */
&lt;br&gt;-	 &amp;nbsp; &amp;nbsp;if ((bytes = SNPRINTF(NULL, 0, &amp;quot;%f&amp;quot;, val))) {
&lt;br&gt;+	 &amp;nbsp; &amp;nbsp;if ((bytes = SNPRINTF(NULL, 0, nfmt, val))) {
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp; &amp;nbsp;p_wchar0 *p = string_builder_allocate(s, bytes, 0);
&lt;br&gt;-	 &amp;nbsp; &amp;nbsp; &amp;nbsp;size_t check = SNPRINTF((char*)p, bytes+1, &amp;quot;%f&amp;quot;, val);
&lt;br&gt;+	 &amp;nbsp; &amp;nbsp; &amp;nbsp;size_t check = SNPRINTF((char*)p, bytes+1, nfmt, val);
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp; &amp;nbsp;if (check != bytes) {
&lt;br&gt;&amp;nbsp;		Pike_fatal(&amp;quot;string_builder_vsprintf(): snprintf(%f) is not &amp;quot;
&lt;br&gt;&amp;nbsp;			 &amp;nbsp; &amp;quot;trustworthy: %&amp;quot;PRINTSIZET&amp;quot;u != %&amp;quot;PRINTSIZET&amp;quot;u\n&amp;quot;,
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/patch-for-string_builder_vsprintf-tp26482708p26482708.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26355512</id>
	<title>Re: mysql charset issue</title>
	<published>2009-11-14T17:10:12Z</published>
	<updated>2009-11-14T17:10:12Z</updated>
	<author>
		<name>Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum</name>
	</author>
	<content type="html">&amp;gt; Great, seems to work.
&lt;br&gt;&lt;br&gt;Ok, good. Fix is committed to 7.4, 7.6 and 7.8.
&lt;br&gt;&lt;br&gt;&amp;gt; For me the charset is going into the connect options (i.e.
&lt;br&gt;&amp;gt; RECONNECT_CHARSET_IS_SET), i guess
&lt;br&gt;&lt;br&gt;That's right, I changed that too.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/mysql-charset-issue-tp26309332p26355512.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26354345</id>
	<title>Re: do_async_method_url ignoring content-type</title>
	<published>2009-11-14T14:10:02Z</published>
	<updated>2009-11-14T14:10:02Z</updated>
	<author>
		<name>Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum</name>
	</author>
	<content type="html">&amp;gt; So i guess it would be better to do a set_write_callback(0) after
&lt;br&gt;&amp;gt; write if !sizeof(out_buffer) and to reinstall the callback when more
&lt;br&gt;&amp;gt; data is available?
&lt;br&gt;&lt;br&gt;..and remove the initial callback install in create(). Yes, that is
&lt;br&gt;what I'd do too.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/do_async_method_url-ignoring-content-type-tp26128060p26354345.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26354199</id>
	<title>Re: do_async_method_url ignoring content-type</title>
	<published>2009-11-14T13:54:14Z</published>
	<updated>2009-11-14T13:54:14Z</updated>
	<author>
		<name>Arne Goedeke</name>
	</author>
	<content type="html">Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
&lt;br&gt;&amp;gt;&amp;gt; The send_output method which writes to the buffer triggers a write
&lt;br&gt;&amp;gt;&amp;gt; attempt. So that should not be a problem.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I see. Then I guess it works, although personally I think it's a bit
&lt;br&gt;&amp;gt; obscure to rely on the internal write cb blocker. Anyway, I've applied
&lt;br&gt;&amp;gt; your patch. Thanks.
&lt;br&gt;&lt;br&gt;Its what I usually do. So i guess it would be better to do a
&lt;br&gt;set_write_callback(0) after write if !sizeof(out_buffer) and to
&lt;br&gt;reinstall the callback when more data is available?
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/do_async_method_url-ignoring-content-type-tp26128060p26354199.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26354186</id>
	<title>Re: mysql charset issue</title>
	<published>2009-11-14T13:52:03Z</published>
	<updated>2009-11-14T13:52:03Z</updated>
	<author>
		<name>Arne Goedeke</name>
	</author>
	<content type="html">Martin Stjernholm wrote:
&lt;br&gt;&amp;gt; Aha, I somehow thought the setting would survive the reconnect if
&lt;br&gt;&amp;gt; mysql_set_character_set is used. Of course it doesn't. Then the
&lt;br&gt;&amp;gt; approach is a bit different. Please try this patch instead.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;br&gt;Great, seems to work. For me the charset is going into the connect
&lt;br&gt;options (i.e. RECONNECT_CHARSET_IS_SET), i guess, so i am not seeing any
&lt;br&gt;SET NAMES magic after reconnect.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/mysql-charset-issue-tp26309332p26354186.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26354073</id>
	<title>Re: do_async_method_url ignoring content-type</title>
	<published>2009-11-14T13:35:02Z</published>
	<updated>2009-11-14T13:35:02Z</updated>
	<author>
		<name>Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum</name>
	</author>
	<content type="html">&amp;gt; The send_output method which writes to the buffer triggers a write
&lt;br&gt;&amp;gt; attempt. So that should not be a problem.
&lt;br&gt;&lt;br&gt;I see. Then I guess it works, although personally I think it's a bit
&lt;br&gt;obscure to rely on the internal write cb blocker. Anyway, I've applied
&lt;br&gt;your patch. Thanks.
&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/do_async_method_url-ignoring-content-type-tp26128060p26354073.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26354209</id>
	<title>Re: mysql charset issue</title>
	<published>2009-11-14T13:22:38Z</published>
	<updated>2009-11-14T13:22:38Z</updated>
	<author>
		<name>Martin Stjernholm</name>
	</author>
	<content type="html">Aha, I somehow thought the setting would survive the reconnect if
&lt;br&gt;mysql_set_character_set is used. Of course it doesn't. Then the
&lt;br&gt;approach is a bit different. Please try this patch instead.
&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;tt&gt;Index: src/modules/Mysql/mysql.c
&lt;br&gt;===================================================================
&lt;br&gt;RCS file: /pike/data/cvsroot/Pike/7.8/src/modules/Mysql/mysql.c,v
&lt;br&gt;retrieving revision 1.119
&lt;br&gt;diff -u -r1.119 mysql.c
&lt;br&gt;--- src/modules/Mysql/mysql.c	5 Nov 2009 14:15:15 -0000	1.119
&lt;br&gt;+++ src/modules/Mysql/mysql.c	14 Nov 2009 21:15:35 -0000
&lt;br&gt;@@ -157,6 +157,9 @@
&lt;br&gt;&amp;nbsp;#define MYSQL_DISALLOW()
&lt;br&gt;&amp;nbsp;#endif /* _REENTRANT */
&lt;br&gt;&amp;nbsp;
&lt;br&gt;+#define PIKE_MYSQL_FLAG_STORE_RESULT	1
&lt;br&gt;+#define PIKE_MYSQL_FLAG_TYPED_RESULT	2
&lt;br&gt;+
&lt;br&gt;&amp;nbsp;#define CHECK_8BIT_NONBINARY_STRING(FUNC, ARG) do {			\
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (sp[ARG-1-args].type != T_STRING ||				\
&lt;br&gt;&amp;nbsp;	sp[ARG-1-args].u.string-&amp;gt;size_shift ||				\
&lt;br&gt;@@ -214,12 +217,10 @@
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;free_mapping (PIKE_MYSQL-&amp;gt;options);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;PIKE_MYSQL-&amp;gt;options = NULL;
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;-#ifndef HAVE_MYSQL_SET_CHARACTER_SET
&lt;br&gt;&amp;nbsp; &amp;nbsp;if (PIKE_MYSQL-&amp;gt;conn_charset) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;free_string (PIKE_MYSQL-&amp;gt;conn_charset);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;PIKE_MYSQL-&amp;gt;conn_charset = NULL;
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;-#endif
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp;MYSQL_ALLOW();
&lt;br&gt;&amp;nbsp;
&lt;br&gt;@@ -347,14 +348,48 @@
&lt;br&gt;&amp;nbsp;		 &amp;nbsp;val-&amp;gt;u.string-&amp;gt;str);
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp;#endif /* MYSQL_SET_CHARSET_DIR */
&lt;br&gt;-#ifdef HAVE_MYSQL_SET_CHARSET_NAME
&lt;br&gt;+#endif /* HAVE_MYSQL_OPTIONS */
&lt;br&gt;+
&lt;br&gt;&amp;nbsp; &amp;nbsp;if ((val = simple_mapping_string_lookup(options, &amp;quot;mysql_charset_name&amp;quot;)) &amp;&amp;
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;(val-&amp;gt;type == T_STRING) &amp;&amp; (!val-&amp;gt;u.string-&amp;gt;size_shift)) {
&lt;br&gt;- &amp;nbsp; &amp;nbsp;mysql_options(PIKE_MYSQL-&amp;gt;mysql, MYSQL_SET_CHARSET_NAME,
&lt;br&gt;-		 &amp;nbsp;val-&amp;gt;u.string-&amp;gt;str);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;(val-&amp;gt;type == T_STRING) &amp;&amp; (!val-&amp;gt;u.string-&amp;gt;size_shift) &amp;&amp;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;!string_has_null (val-&amp;gt;u.string)) {
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;if (PIKE_MYSQL-&amp;gt;conn_charset)
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;free (PIKE_MYSQL-&amp;gt;conn_charset);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;copy_shared_string (PIKE_MYSQL-&amp;gt;conn_charset, val-&amp;gt;u.string);
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;-#endif /* MYSQL_SET_CHARSET_NAME */
&lt;br&gt;-#endif /* HAVE_MYSQL_OPTIONS */
&lt;br&gt;+}
&lt;br&gt;+
&lt;br&gt;+static void low_query(INT32 args, char *name, int flags);
&lt;br&gt;+
&lt;br&gt;+static void connection_set_charset()
&lt;br&gt;+{
&lt;br&gt;+#ifdef HAVE_MYSQL_SET_CHARACTER_SET
&lt;br&gt;+ &amp;nbsp;int res;
&lt;br&gt;+ &amp;nbsp;MYSQL *mysql = PIKE_MYSQL-&amp;gt;mysql;
&lt;br&gt;+ &amp;nbsp;struct pike_string *charset = PIKE_MYSQL-&amp;gt;conn_charset;
&lt;br&gt;+ &amp;nbsp;MYSQL_ALLOW();
&lt;br&gt;+ &amp;nbsp;res = mysql_set_character_set (mysql, charset-&amp;gt;str);
&lt;br&gt;+ &amp;nbsp;MYSQL_DISALLOW();
&lt;br&gt;+ &amp;nbsp;if (res) {
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;const char *err;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;MYSQL_ALLOW();
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;err = mysql_error(mysql);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;MYSQL_DISALLOW();
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;Pike_error(&amp;quot;Setting the charset failed: %s\n&amp;quot;, err);
&lt;br&gt;+ &amp;nbsp;}
&lt;br&gt;+
&lt;br&gt;+#else
&lt;br&gt;+ &amp;nbsp;/* Old libs (&amp;lt; 4.1.13) doesn't support changing the connection
&lt;br&gt;+ &amp;nbsp; * charset. We emulate it by setting the charset ourselves. Note
&lt;br&gt;+ &amp;nbsp; * that this doesn't work with mysql_real_escape_string, but that
&lt;br&gt;+ &amp;nbsp; * function isn't used. */
&lt;br&gt;+ &amp;nbsp;push_constant_text (&amp;quot;SET NAMES '&amp;quot;);
&lt;br&gt;+ &amp;nbsp;ref_push_string (PIKE_MYSQL-&amp;gt;conn_charset);
&lt;br&gt;+ &amp;nbsp;push_constant_text (&amp;quot;'&amp;quot;);
&lt;br&gt;+ &amp;nbsp;f_add (3);
&lt;br&gt;+ &amp;nbsp;low_query (1, &amp;quot;set_charset&amp;quot;, PIKE_MYSQL_FLAG_STORE_RESULT);
&lt;br&gt;+ &amp;nbsp;pop_stack();
&lt;br&gt;+#endif
&lt;br&gt;&amp;nbsp;}
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp;static void pike_mysql_reconnect (int reconnect)
&lt;br&gt;@@ -404,10 +439,11 @@
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;options = (unsigned int)val-&amp;gt;u.integer;
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp;
&lt;br&gt;-#if !defined (HAVE_MYSQL_SET_CHARACTER_SET) &amp;&amp; defined (HAVE_MYSQL_OPTIONS) &amp;&amp; defined (HAVE_MYSQL_SET_CHARSET_NAME)
&lt;br&gt;+#if defined (HAVE_MYSQL_OPTIONS) &amp;&amp; defined (HAVE_MYSQL_SET_CHARSET_NAME)
&lt;br&gt;&amp;nbsp; &amp;nbsp;if (PIKE_MYSQL-&amp;gt;conn_charset)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;mysql_options (mysql, MYSQL_SET_CHARSET_NAME,
&lt;br&gt;&amp;nbsp;		 &amp;nbsp; PIKE_MYSQL-&amp;gt;conn_charset-&amp;gt;str);
&lt;br&gt;+#define RECONNECT_CHARSET_IS_SET
&lt;br&gt;&amp;nbsp;#endif
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp;MYSQL_ALLOW();
&lt;br&gt;@@ -488,6 +524,11 @@
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;+
&lt;br&gt;+#ifndef RECONNECT_CHARSET_IS_SET
&lt;br&gt;+ &amp;nbsp;if (PIKE_MYSQL-&amp;gt;conn_charset)
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;connection_set_charset();
&lt;br&gt;+#endif
&lt;br&gt;&amp;nbsp;}
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp;/*
&lt;br&gt;@@ -642,24 +683,13 @@
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp;pike_mysql_reconnect (0);
&lt;br&gt;&amp;nbsp;
&lt;br&gt;-#ifndef HAVE_MYSQL_SET_CHARACTER_SET
&lt;br&gt;&amp;nbsp;#ifdef HAVE_MYSQL_CHARACTER_SET_NAME
&lt;br&gt;- &amp;nbsp;{
&lt;br&gt;+ &amp;nbsp;if (!PIKE_MYSQL-&amp;gt;conn_charset) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;const char *charset = mysql_character_set_name (PIKE_MYSQL-&amp;gt;mysql);
&lt;br&gt;- &amp;nbsp; &amp;nbsp;if (PIKE_MYSQL-&amp;gt;conn_charset)
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;free_string (PIKE_MYSQL-&amp;gt;conn_charset);
&lt;br&gt;- &amp;nbsp; &amp;nbsp;if (charset)
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;if (charset) /* Just paranoia; mysql_character_set_name should
&lt;br&gt;+		 &amp;nbsp;* always return a string. */
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PIKE_MYSQL-&amp;gt;conn_charset = make_shared_string (charset);
&lt;br&gt;- &amp;nbsp; &amp;nbsp;else
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;/* Just paranoia; mysql_character_set_name should always return
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; * a string. */
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;PIKE_MYSQL-&amp;gt;conn_charset = NULL;
&lt;br&gt;&amp;nbsp; &amp;nbsp;}
&lt;br&gt;-#else
&lt;br&gt;- &amp;nbsp;if (PIKE_MYSQL-&amp;gt;conn_charset)
&lt;br&gt;- &amp;nbsp; &amp;nbsp;free_string (PIKE_MYSQL-&amp;gt;conn_charset);
&lt;br&gt;- &amp;nbsp;PIKE_MYSQL-&amp;gt;conn_charset = NULL;
&lt;br&gt;-#endif
&lt;br&gt;&amp;nbsp;#endif
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp;pop_n_elems(args);
&lt;br&gt;@@ -861,9 +891,6 @@
&lt;br&gt;&amp;nbsp; &amp;nbsp;pop_n_elems(args);
&lt;br&gt;&amp;nbsp;}
&lt;br&gt;&amp;nbsp;
&lt;br&gt;-#define PIKE_MYSQL_FLAG_STORE_RESULT	1
&lt;br&gt;-#define PIKE_MYSQL_FLAG_TYPED_RESULT	2
&lt;br&gt;-
&lt;br&gt;&amp;nbsp;static void low_query(INT32 args, char *name, int flags)
&lt;br&gt;&amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp;MYSQL *mysql = PIKE_MYSQL-&amp;gt;mysql;
&lt;br&gt;@@ -1771,58 +1798,20 @@
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SIMPLE_ARG_ERROR (&amp;quot;set_charset&amp;quot;, 0,
&lt;br&gt;&amp;nbsp;		 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;The charset name cannot contain a NUL character.&amp;quot;);
&lt;br&gt;&amp;nbsp;
&lt;br&gt;-#ifdef HAVE_MYSQL_SET_CHARACTER_SET
&lt;br&gt;- &amp;nbsp;{
&lt;br&gt;- &amp;nbsp; &amp;nbsp;int res;
&lt;br&gt;- &amp;nbsp; &amp;nbsp;MYSQL *mysql = PIKE_MYSQL-&amp;gt;mysql;
&lt;br&gt;- &amp;nbsp; &amp;nbsp;MYSQL_ALLOW();
&lt;br&gt;- &amp;nbsp; &amp;nbsp;res = mysql_set_character_set (mysql, charset-&amp;gt;str);
&lt;br&gt;- &amp;nbsp; &amp;nbsp;MYSQL_DISALLOW();
&lt;br&gt;- &amp;nbsp; &amp;nbsp;if (res) {
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;const char *err;
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;MYSQL_ALLOW();
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;err = mysql_error(mysql);
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;MYSQL_DISALLOW();
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;Pike_error(&amp;quot;Setting the charset failed: %s\n&amp;quot;, err);
&lt;br&gt;- &amp;nbsp; &amp;nbsp;}
&lt;br&gt;- &amp;nbsp;}
&lt;br&gt;-
&lt;br&gt;-#else &amp;nbsp;/* !HAVE_MYSQL_SET_CHARACTER_SET */
&lt;br&gt;- &amp;nbsp;push_constant_text (&amp;quot;SET NAMES '&amp;quot;);
&lt;br&gt;- &amp;nbsp;ref_push_string (charset);
&lt;br&gt;- &amp;nbsp;push_constant_text (&amp;quot;'&amp;quot;);
&lt;br&gt;- &amp;nbsp;f_add (3);
&lt;br&gt;- &amp;nbsp;low_query (1, &amp;quot;set_charset&amp;quot;, PIKE_MYSQL_FLAG_STORE_RESULT);
&lt;br&gt;- &amp;nbsp;args++;
&lt;br&gt;&amp;nbsp; &amp;nbsp;if (PIKE_MYSQL-&amp;gt;conn_charset)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;free_string (PIKE_MYSQL-&amp;gt;conn_charset);
&lt;br&gt;&amp;nbsp; &amp;nbsp;copy_shared_string (PIKE_MYSQL-&amp;gt;conn_charset, charset);
&lt;br&gt;-#endif
&lt;br&gt;-
&lt;br&gt;+ &amp;nbsp;connection_set_charset();
&lt;br&gt;&amp;nbsp; &amp;nbsp;pop_n_elems (args);
&lt;br&gt;&amp;nbsp;}
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp;static void f_get_charset (INT32 args)
&lt;br&gt;&amp;nbsp;{
&lt;br&gt;&amp;nbsp; &amp;nbsp;pop_n_elems (args);
&lt;br&gt;-#ifdef HAVE_MYSQL_SET_CHARACTER_SET
&lt;br&gt;- &amp;nbsp;{
&lt;br&gt;- &amp;nbsp; &amp;nbsp;/* mysql_character_set_name should always exist if
&lt;br&gt;- &amp;nbsp; &amp;nbsp; * mysql_set_character_set exists. */
&lt;br&gt;- &amp;nbsp; &amp;nbsp;const char *charset = mysql_character_set_name (PIKE_MYSQL-&amp;gt;mysql);
&lt;br&gt;- &amp;nbsp; &amp;nbsp;if (charset)
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;push_text (charset);
&lt;br&gt;- &amp;nbsp; &amp;nbsp;else
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;/* Just paranoia; mysql_character_set_name should always return
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp; * a string. */
&lt;br&gt;- &amp;nbsp; &amp;nbsp; &amp;nbsp;push_constant_text (&amp;quot;latin1&amp;quot;);
&lt;br&gt;- &amp;nbsp;}
&lt;br&gt;-#else
&lt;br&gt;&amp;nbsp; &amp;nbsp;if (PIKE_MYSQL-&amp;gt;conn_charset)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;ref_push_string (PIKE_MYSQL-&amp;gt;conn_charset);
&lt;br&gt;&amp;nbsp; &amp;nbsp;else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;push_constant_text (&amp;quot;latin1&amp;quot;);
&lt;br&gt;-#endif
&lt;br&gt;&amp;nbsp;}
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp;static void f__can_send_as_latin1 (INT32 args)
&lt;br&gt;Index: src/modules/Mysql/precompiled_mysql.h
&lt;br&gt;===================================================================
&lt;br&gt;RCS file: /pike/data/cvsroot/Pike/7.8/src/modules/Mysql/precompiled_mysql.h,v
&lt;br&gt;retrieving revision 1.20
&lt;br&gt;diff -u -r1.20 precompiled_mysql.h
&lt;br&gt;--- src/modules/Mysql/precompiled_mysql.h	5 Nov 2009 13:49:31 -0000	1.20
&lt;br&gt;+++ src/modules/Mysql/precompiled_mysql.h	14 Nov 2009 21:15:35 -0000
&lt;br&gt;@@ -59,13 +59,7 @@
&lt;br&gt;&amp;nbsp; &amp;nbsp;MYSQL		*mysql;
&lt;br&gt;&amp;nbsp; &amp;nbsp;struct pike_string	*host, *database, *user, *password;	/* Reconnect */
&lt;br&gt;&amp;nbsp; &amp;nbsp;struct mapping &amp;nbsp; *options;
&lt;br&gt;-#ifndef HAVE_MYSQL_SET_CHARACTER_SET
&lt;br&gt;- &amp;nbsp;/* Old libs (&amp;lt; 4.1.13) doesn't support changing the connection
&lt;br&gt;- &amp;nbsp; * charset. We emulate it by storing the charset ourselves. Note
&lt;br&gt;- &amp;nbsp; * that this doesn't work with mysql_real_escape_string, but that
&lt;br&gt;- &amp;nbsp; * function isn't used. */
&lt;br&gt;&amp;nbsp; &amp;nbsp;struct pike_string *conn_charset;
&lt;br&gt;-#endif
&lt;br&gt;&amp;nbsp;};
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp;struct precompiled_mysql_result {
&lt;br&gt;&lt;/tt&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/mysql-charset-issue-tp26309332p26354209.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26353323</id>
	<title>Re: mysql charset issue</title>
	<published>2009-11-14T11:52:53Z</published>
	<updated>2009-11-14T11:52:53Z</updated>
	<author>
		<name>Arne Goedeke</name>
	</author>
	<content type="html">Hm... confusion. the PIKE_MYSQL-&amp;gt;conn_charset is used only in case
&lt;br&gt;mysql_set_charset is not available. So maybe instead add it to the mysql
&lt;br&gt;options as if it was given to create? Just speculating here, dont really
&lt;br&gt;know the code. Tell me if there is anything I can do to help you debug.
&lt;br&gt;&lt;br&gt;arne
&lt;br&gt;&lt;br&gt;Arne Goedeke wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; The patch doesnt change anything for me right now. the &amp;quot;old&amp;quot; mysql i was
&lt;br&gt;&amp;gt; running was 5.0.70, not 5.0.7 ;-). So I do have mysql_set_character_set
&lt;br&gt;&amp;gt; and pike is using it. The library sends an SET NAMES utf8 when using
&lt;br&gt;&amp;gt; set_charset(&amp;quot;unicode&amp;quot;). After the reconnect it sends a
&lt;br&gt;&amp;gt; SET character_set_client=latin1.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I think the reason for this is, that set_charset() does not change
&lt;br&gt;&amp;gt; PIKE_MYSQL-&amp;gt;conn_charset accordingly. I guess its different when I
&lt;br&gt;&amp;gt; create the sql object with the appropriate options without changing the
&lt;br&gt;&amp;gt; charset later on.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; arne
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hmm, ok. Could you please try this patch without upgrading instead?
&lt;br&gt;&amp;gt;&amp;gt; That way I can verify that it fixes the problem.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Index: src/modules/Mysql/mysql.c
&lt;br&gt;&amp;gt;&amp;gt; ===================================================================
&lt;br&gt;&amp;gt;&amp;gt; RCS file: /pike/data/cvsroot/Pike/7.8/src/modules/Mysql/mysql.c,v
&lt;br&gt;&amp;gt;&amp;gt; retrieving revision 1.119
&lt;br&gt;&amp;gt;&amp;gt; diff -u -r1.119 mysql.c
&lt;br&gt;&amp;gt;&amp;gt; --- src/modules/Mysql/mysql.c	5 Nov 2009 14:15:15 -0000	1.119
&lt;br&gt;&amp;gt;&amp;gt; +++ src/modules/Mysql/mysql.c	14 Nov 2009 18:26:17 -0000
&lt;br&gt;&amp;gt;&amp;gt; @@ -157,6 +157,9 @@
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;#define MYSQL_DISALLOW()
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;#endif /* _REENTRANT */
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; +#define PIKE_MYSQL_FLAG_STORE_RESULT	1
&lt;br&gt;&amp;gt;&amp;gt; +#define PIKE_MYSQL_FLAG_TYPED_RESULT	2
&lt;br&gt;&amp;gt;&amp;gt; +
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;#define CHECK_8BIT_NONBINARY_STRING(FUNC, ARG) do {			\
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (sp[ARG-1-args].type != T_STRING ||				\
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;	sp[ARG-1-args].u.string-&amp;gt;size_shift ||				\
&lt;br&gt;&amp;gt;&amp;gt; @@ -357,6 +360,8 @@
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;#endif /* HAVE_MYSQL_OPTIONS */
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; +static void low_query(INT32 args, char *name, int flags);
&lt;br&gt;&amp;gt;&amp;gt; +
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;static void pike_mysql_reconnect (int reconnect)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;{
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;MYSQL *mysql = PIKE_MYSQL-&amp;gt;mysql;
&lt;br&gt;&amp;gt;&amp;gt; @@ -488,6 +493,17 @@
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt; +
&lt;br&gt;&amp;gt;&amp;gt; +#ifndef HAVE_MYSQL_SET_CHARACTER_SET
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp;if (PIKE_MYSQL-&amp;gt;conn_charset) {
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp; &amp;nbsp;push_constant_text (&amp;quot;SET NAMES '&amp;quot;);
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp; &amp;nbsp;ref_push_string (PIKE_MYSQL-&amp;gt;conn_charset);
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp; &amp;nbsp;push_constant_text (&amp;quot;'&amp;quot;);
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp; &amp;nbsp;f_add (3);
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp; &amp;nbsp;low_query (1, &amp;quot;reconnect&amp;quot;, PIKE_MYSQL_FLAG_STORE_RESULT);
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp; &amp;nbsp;pop_stack();
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt; +#endif
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;/*
&lt;br&gt;&amp;gt;&amp;gt; @@ -861,9 +877,6 @@
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;pop_n_elems(args);
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; -#define PIKE_MYSQL_FLAG_STORE_RESULT	1
&lt;br&gt;&amp;gt;&amp;gt; -#define PIKE_MYSQL_FLAG_TYPED_RESULT	2
&lt;br&gt;&amp;gt;&amp;gt; -
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;static void low_query(INT32 args, char *name, int flags)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;{
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;MYSQL *mysql = PIKE_MYSQL-&amp;gt;mysql;
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://old.nabble.com/Pike---Dev-f14138.html&quot; embed=&quot;fixTarget[14138]&quot; target=&quot;_top&quot; &gt;Pike - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/mysql-charset-issue-tp26309332p26353323.html" />
</entry>

</feed>
