<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>jjongsma &#187; Linux</title>
	<atom:link href="http://blogs.gnome.org/jjongsma/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.gnome.org/jjongsma</link>
	<description>Hacking on GNOME, but with a healthy dose of C++</description>
	<lastBuildDate>Thu, 18 Aug 2011 14:47:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license>		<item>
		<title>How to waste an evening debugging the internals of glib&#8217;s qsort implementation</title>
		<link>http://blogs.gnome.org/jjongsma/2009/12/08/qsort-segfault/</link>
		<comments>http://blogs.gnome.org/jjongsma/2009/12/08/qsort-segfault/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 03:49:34 +0000</pubDate>
		<dc:creator>jonner</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[gtkmm]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/jjongsma/?p=79</guid>
		<description><![CDATA[Working on a personal itch-scratching project, I found myself wanting a sortable treeview. So I stuffed my treemodel into a TreeModelSort and set up my sort functions, and everything was happy. Except, when running my application, I kept getting strange segfaults within glib&#8217;s qsort implementation. I had set the following function as my sort_func (yes, [...]]]></description>
			<content:encoded><![CDATA[<p>Working on a personal itch-scratching project, I found myself wanting a sortable treeview.  So I stuffed my treemodel into a TreeModelSort and set up my sort functions, and everything was happy.  Except, when running my application, I kept getting strange segfaults within glib&#8217;s qsort implementation.  I had set the following function as my sort_func (yes, it&#8217;s C++, but it should be fairly self-explanatory):</p>
<pre><code>static int
compare_foo (const Gtk::TreeModel::iterator&#038; a, const Gtk::TreeModel::iterator&#038; b)
{
    std::tr1::shared_ptr&lt;Foo&gt; l1, l2;
    l1 = a-&gt;get_value (COLUMN_FOO);
    l2 = b-&gt;get_value (COLUMN_FOO);

    if (!l1)
        return -1;

    if (!l2)
        return 1;

    return l1-&gt;get_id () - l2-&gt;get_id ();
}</code></pre>
<p>Can you spot the error?  Running it under valgrind indicated that I was reading data from *before* the start of the array that was being sorted.  In fact, the following lines of code in g_qsort_with_data() were causing tmp_ptr to be decreased back past the start of the array:</p>
<pre><code>        while ((*compare_func) ((void *) run_ptr, (void *) tmp_ptr, user_data) &lt; 0)
          tmp_ptr -= size;</code></pre>
<p>Hmm.  Why is there no guard to prevent tmp_ptr from being decreased past the start?  Then I noticed the following comment up a few lines:</p>
<pre><code>    /* Find smallest element in first threshold and place it at the
       array's beginning.  This is the smallest array element,
       and the operation speeds up insertion sort's inner loop. */</code></pre>
<p>So at this point, the code is assuming that the very first element of the array is the smallest, so compare_func should always return &gt;= 0 when it reaches the start of the array.  Aha!  So the problem is my compare_func.  It turns out I forgot to handle the single case of both values being NULL.</p>
<pre><code>    l1 = a-&gt;get_value (COLUMN_FOO);
    l2 = b-&gt;get_value (COLUMN_FOO);
+
+   if (!l1 &#038;&#038; !l2)
+       return 0;

    if (!l1)
        return -1;</code></pre>
<p>So there&#8217;s not really a big lesson to be learned here, but if you ever hit strange segfaults deep inside glib&#8217;s qsort while sorting a treemodel, do yourself a favor and double-check that your sort function is sane first.  Also, do yourself a favor and run it under valgrind as soon as you get a strange segfault.  Knowing the exact point of the invalid read is infinitely more helpful than waiting until that invalid read causes a segfault.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/jjongsma/2009/12/08/qsort-segfault/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Testing Nemiver</title>
		<link>http://blogs.gnome.org/jjongsma/2007/09/21/testing-nemiver/</link>
		<comments>http://blogs.gnome.org/jjongsma/2007/09/21/testing-nemiver/#comments</comments>
		<pubDate>Fri, 21 Sep 2007 02:25:33 +0000</pubDate>
		<dc:creator>jonner</dc:creator>
				<category><![CDATA[Nemiver]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/jjongsma/2007/09/21/testing-nemiver/</guid>
		<description><![CDATA[Progress on nemiver has been slightly slower of late, but we&#8217;re making some steady progress on new things. In an effort to help more people test out newer versions of nemiver and to brush up on my packaging skills, I set up a personal package archive at launchpad about a week ago where I&#8217;ve uploaded [...]]]></description>
			<content:encoded><![CDATA[<p>Progress on nemiver has been slightly slower of late, but we&#8217;re making some steady progress on new things.  In an effort to help more people test out newer versions of nemiver and to brush up on my packaging skills, I set up a <a href="https://edge.launchpad.net/~jonathon-jongsma/+archive">personal package archive at launchpad</a> about a week ago where I&#8217;ve uploaded a recent build of nemiver.   Those of you using Ubuntu Feisty that want to try out a more up-to-date version of Nemiver can do so by adding the following lines to <code>/etc/apt/sources.list</code></p>
<pre>deb     http://ppa.launchpad.net/jonathon-jongsma/ubuntu feisty main universe
deb-src http://ppa.launchpad.net/jonathon-jongsma/ubuntu feisty main  universe</pre>
<p>Followed by the requisite <code>apt-get install nemiver</code>.</p>
<p>I&#8217;ll try to upload new versions periodically.  Let me know if you have any issues with them.  All of the usual caveats apply &#8212; this is development code so may not be completely stable, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/jjongsma/2007/09/21/testing-nemiver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webcams on Linux</title>
		<link>http://blogs.gnome.org/jjongsma/2007/05/25/webcams-on-linux/</link>
		<comments>http://blogs.gnome.org/jjongsma/2007/05/25/webcams-on-linux/#comments</comments>
		<pubDate>Fri, 25 May 2007 19:54:00 +0000</pubDate>
		<dc:creator>jonner</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/jjongsma/2007/05/25/webcams-on-linux/</guid>
		<description><![CDATA[Since Joanne&#8217;s parents live in Thailand, they&#8217;re not able to see their new granddaughter very often. They use skype to communicate regularly, so we thought we&#8217;d grab a cheap little webcam so that they could see Ruby while they were talking as well. I picked up the cheapest webcam they had at the local Best [...]]]></description>
			<content:encoded><![CDATA[<p> Since Joanne&#8217;s parents live in Thailand, they&#8217;re not able to see their new granddaughter very often.  They use skype to communicate regularly, so we thought we&#8217;d grab a cheap little webcam so that they could see Ruby while they were talking as well.  I picked up the cheapest webcam they had at the local Best Buy: a <a href="http://www.logitech.com/index.cfm/products/details/US/EN,CRID=2204,CONTENTID=11932">Logitech QuickCam Communicate STX</a> for $35.  Just for fun, I thought I&#8217;d try it out on my Ubuntu Feisty machine, not really expecting much.  To my surprise, I plugged it into the USB port, fired up <a href="http://www.ekiga.org/">Ekiga</a> [1], and within 10 seconds was having a video chat with my brother (well, the video chat was one way, since he doesn&#8217;t have a webcam or a microphone, but I&#8217;m told that he could see and hear me).</p>
<p>By contrast, to get it to work on Joanne&#8217;s Windows machine (so she could use it with Skype), it wanted to immediately download updated &#8216;drivers&#8217; (probably including a bunch of useless utility software &#8212; over 100MB!) and of course, install them.  It installed without problem, but all-in-all, it took about 10 times as long as it did to get it working on Linux.</p>
<p>When I first started using Linux, I would have never dreamed that hardware support would have gotten this good by now.  In fact, on the way home from picking up the webcam, I joked to Joanne that getting it to work on Linux was going to be my weekend project. Ha!</p>
<p>[1] By the way, this is the first time I&#8217;ve used Ekiga.   It&#8217;s quite nice, and the <a href="http://blog.ekiga.net/?p=61">new GUI work</a> looks great.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/jjongsma/2007/05/25/webcams-on-linux/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bugzilla for Lunch</title>
		<link>http://blogs.gnome.org/jjongsma/2006/12/06/bugzilla-for-lunch/</link>
		<comments>http://blogs.gnome.org/jjongsma/2006/12/06/bugzilla-for-lunch/#comments</comments>
		<pubDate>Wed, 06 Dec 2006 21:39:00 +0000</pubDate>
		<dc:creator>jonner</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nemiver]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/jjongsma/2006/12/06/bugzilla-for-lunch/</guid>
		<description><![CDATA[Over my lunch hour, I&#8217;ve started taking about 15-30 minutes of my day and going through the list of newly filed bugs, marking duplicate reports or applying the stock NEEDINFO responses for bug reports without good stacktraces. I can&#8217;t do any in-depth triaging, since I&#8217;m at work away from my development environment, but I figure [...]]]></description>
			<content:encoded><![CDATA[<p> Over my lunch hour, I&#8217;ve started taking about 15-30 minutes of my day and going through the <a href="http://bugzilla.gnome.org/reports/core-bugs-today.cgi?ignore_triaged=1">list of newly filed bugs</a>, marking duplicate reports or applying the stock NEEDINFO responses for bug reports without good stacktraces.  I can&#8217;t do any in-depth triaging, since I&#8217;m at work away from my development environment, but I figure that I can at least help cut down on some of the noise in bugzilla with only a little bit of effort every day.</p>
<p>I&#8217;ve been using and developing software on Linux for a little while now, but I&#8217;ve always felt slightly uneasy about my lack of detailed knowledge about the Linux kernel.  So I picked up <a href="http://rlove.org/kernel_book/">rlove&#8217;s kernel development book</a> this past weekend and I&#8217;m about halfway through it already.  I&#8217;m gradually beginning to feel more &#8230; what&#8217;s the opposite of uneasy?  easy?  at ease?  Anyway, it&#8217;s quite good and well written.  Highly recommended if you&#8217;re looking for a nice introduction to the Linux kernel.</p>
<p>Nemiver&#8217;s proceeding nicely to a 0.2 release which should be a lot more robust in a lot of ways, including better support for poorly-behaved versions of gdb.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/jjongsma/2006/12/06/bugzilla-for-lunch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>That sure is Edgy</title>
		<link>http://blogs.gnome.org/jjongsma/2006/11/02/that-sure-is-edgy/</link>
		<comments>http://blogs.gnome.org/jjongsma/2006/11/02/that-sure-is-edgy/#comments</comments>
		<pubDate>Thu, 02 Nov 2006 15:48:00 +0000</pubDate>
		<dc:creator>jonner</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nemiver]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/jjongsma/2006/11/02/that-sure-is-edgy/</guid>
		<description><![CDATA[Well, I upgraded my main laptop to Ubuntu Edgy last weekend, and for the most part things went OK (I used the official &#8216;update-manager -c&#8217; procedure, so I didn&#8217;t get any severe breakage). Unfortunately, my wireless doesn&#8217;t work anymore. Sigh&#8230; I know I should have done more research into which laptops have good driver support [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I upgraded my main laptop to Ubuntu Edgy last weekend, and for the most part things went OK (I used the official &#8216;update-manager -c&#8217; procedure, so I didn&#8217;t get any severe breakage).  Unfortunately, my wireless doesn&#8217;t work anymore.  Sigh&#8230;  I know I should have done more research into which laptops have good driver support for linux before I bought it, but it&#8217;s still frustrating.  In the past I had to resort to the ndiswrapper driver to get it to work, but that doesn&#8217;t seem to work anymore.  And I can&#8217;t seem to get the new bcm43xx driver to work right either.  Alas, if only I were a hardware wizard.  But congrats to the Ubuntu team.  If I had the right hardware, I&#8217;m sure it&#8217;d be a fantastic release <img src='http://blogs.gnome.org/jjongsma/wp-content/mu-plugins/tango-smilies/tango/face-smile.png' alt=':)' class='wp-smiley' />   And at least I get to play with the new GNOME stuff now.</p>
<p>Oh wait, I do have one more complaint about the upgrade: <a href="http://bugzilla.gnome.org/show_bug.cgi?id=350053">Bug #350053</a> drives me insane.  I love Epiphany, but that bug completely screws up the way I use browse.  I can use the &#8216;smart bookmarks&#8217; feature, but it&#8217;s hard to reprogram my brain after getting used to just typing search terms in the location bar and hitting enter.  If anyone can get the fix for that into Edgy, I&#8217;d be eternally grateful.</p>
<p>Also, if any of the brilliant <a href="http://ramnet.se/~nisse/blog/?p=33">Tango Friday participants</a> want to make a nice little icon for the <a href="http://home.gna.org/nemiver/">Nemiver</a> debugger, that&#8217;d be great.</p>
<p>Joanne and I are heading out to the L.A. area for a long weekend tomorrow.  Hopefully the weather out there&#8217;s nice and warm there.  It&#8217;s certainly feeling a lot like winter up here.  I could really use a few days off work, so I&#8217;m hoping for a few nice relaxing days, and the computer&#8217;s staying home.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/jjongsma/2006/11/02/that-sure-is-edgy/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Experimental colorscheme packages for Ubuntu Breezy</title>
		<link>http://blogs.gnome.org/jjongsma/2006/02/20/experimental-colorscheme-packages-for-ubuntu-breezy/</link>
		<comments>http://blogs.gnome.org/jjongsma/2006/02/20/experimental-colorscheme-packages-for-ubuntu-breezy/#comments</comments>
		<pubDate>Mon, 20 Feb 2006 02:28:00 +0000</pubDate>
		<dc:creator>jonner</dc:creator>
				<category><![CDATA[Agave]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/jjongsma/2006/02/20/experimental-colorscheme-packages-for-ubuntu-breezy/</guid>
		<description><![CDATA[I took a little while this afternoon to sit down and try to teach myself a little about packaging software. I&#8217;m of the general opinion that software packaging should be left to the experts so that things can get done right. In fact, this is one of the things that makes Debian (and by extension, [...]]]></description>
			<content:encoded><![CDATA[<p> I took a little while this afternoon to sit down and try to teach myself a little about packaging software.  I&#8217;m of the general opinion that software packaging should be left to the experts so that things can get done right.  In fact, this is one of the things that makes Debian (and by extension, Ubuntu) great.  The packages are all of high quality and available in a central repository.  Before moving to Debian I was a Red Hat user (around version 9 &#8212; before Fedora and the extras improved things dramatically), so I&#8217;m well aware of the mess that comes from every user offering homemade packages on their websites.</p>
<p>Nevertheless, I&#8217;ve been getting a fair number of requests from people who want to use colorscheme but don&#8217;t have the necessary expertise to install it from source.  And I&#8217;d really like to get more people using it and giving me feedback.  So I&#8217;ve made a couple experimental <a href="http://download.gna.org/colorscheme/ubuntu/breezy/">colorscheme packages for Ubuntu Breezy</a> (i386 and amd64).  Hopefully this is just a temporary stop-gap measure until the software gets packaged for more distributions.</p>
<p>I make no guarantee that the packages will even work.  Nor will I guarantee any support for them (remember, I don&#8217;t actually know what I&#8217;m doing &#8212; I just whipped those up in an afternoon).  So I don&#8217;t particularly condone using them, but if you want to use the application and can&#8217;t get it installed from source, it&#8217;s an option.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/jjongsma/2006/02/20/experimental-colorscheme-packages-for-ubuntu-breezy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blogs.gnome.org/jjongsma/category/linux/feed/ ) in 1.26920 seconds, on Feb 11th, 2012 at 12:49 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 11th, 2012 at 1:49 am UTC -->
