<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Advogato blog for ads</title>
    <link>http://www.advogato.org/person/ads/</link>
    <description>Advogato blog for ads</description>
    <language>en-us</language>
    <generator>mod_virgule</generator>
    <pubDate>Fri, 29 Aug 2008 01:42:48 GMT</pubDate>
    <item>
      <pubDate>Fri, 18 Aug 2006 12:30:41 GMT</pubDate>
      <title>18 Aug 2006</title>
      <link>http://www.advogato.org/person/ads/diary.html?start=7</link>
      <guid>http://www.advogato.org/person/ads/diary.html?start=7</guid>
      <description>&lt;a href="http://www.advogato.org/person/blm/" &gt;blm&lt;/a&gt;: dasher is the project you are thinking of, I believe. Matthew Garrett, mgj59, works on it.

&lt;p&gt; &lt;em&gt;More safe scripting&lt;/em&gt;

&lt;p&gt; &lt;tt&gt;set -u&lt;/tt&gt; will make a sh script abort on an undefined variable. I'm setting this in most, if not all of my scripts. Does anyone else have any useful defensive shell tips?</description>
    </item>
    <item>
      <pubDate>Tue, 14 Jun 2005 10:22:14 GMT</pubDate>
      <title>14 Jun 2005</title>
      <link>http://www.advogato.org/person/ads/diary.html?start=6</link>
      <guid>http://www.advogato.org/person/ads/diary.html?start=6</guid>
      <description>&lt;em&gt;Safe scripting&lt;/em&gt;

&lt;p&gt; &lt;p&gt;So, we all know that when writing a shell script, you start:

&lt;p&gt; &lt;blockquote&gt;&lt;tt id="moo"&gt;
#! /bin/sh&lt;br&gt;
#&lt;br&gt;
# description/author/copyright/blah-blah-blah&lt;br&gt;
&lt;br&gt;
set -e&lt;br&gt;
....&lt;br&gt;
&lt;/tt&gt;&lt;/blockquote&gt;

&lt;p&gt; &lt;p&gt;What I didn't ever see mentioned is that if you're assuming &lt;tt&gt;set -e&lt;/tt&gt;, command substitution &amp;mdash; &lt;tt&gt;`cmd`&lt;/tt&gt; or &lt;tt&gt;$(cmd)&lt;/tt&gt; &amp;mdash; with a non-zero exit status will &lt;strong&gt;not&lt;/strong&gt; cause the script to abort.

&lt;p&gt; &lt;p&gt;There's a simple solution, fortunately:

&lt;p&gt; &lt;blockquote&gt;
&lt;tt&gt;tmp=`cmd`
&lt;br&gt;do_stuff_with $tmp
&lt;/tt&gt;&lt;/blockquote&gt;

&lt;p&gt; &lt;p&gt;Whilst I'm onto it, if you're reading a stream of words into the positional (&lt;tt&gt;$1&lt;/tt&gt; etc) values with &lt;tt&gt;set --&lt;/tt&gt;, you really should check the number of parameters. Either:

&lt;p&gt; &lt;blockquote&gt;
&lt;tt&gt;tmp=`date +"%Y %m %d"`
&lt;br&gt;set -- $tmp
&lt;br&gt;[ $# = 3 ]
&lt;/tt&gt;&lt;/blockquote&gt;

&lt;p&gt; &lt;p&gt;or

&lt;p&gt; &lt;blockquote&gt;
&lt;tt&gt;tmp=`date +"%Y %m %d"`
&lt;br&gt;set -- $tmp
&lt;br&gt;year=$1; month=$2; day=${3:?date went wrong}
&lt;/tt&gt;&lt;/blockquote&gt;</description>
    </item>
    <item>
      <pubDate>Tue, 16 Mar 2004 17:12:11 GMT</pubDate>
      <title>16 Mar 2004</title>
      <link>http://www.advogato.org/person/ads/diary.html?start=5</link>
      <guid>http://www.advogato.org/person/ads/diary.html?start=5</guid>
      <description>&lt;p&gt;&lt;em&gt;Autofs&lt;/em&gt;: Looks like Jeremy Fitzhardinge got bored of Autofs 4 so Ian Kent has taken it over. Sadly, since Jeremy never released a version incorporating my code, I'm going to have to port it to Autofs 4.1. Anyway, I also found a bug in my code that caused it to forget variable definitions in some cases; the &lt;a href="http://www.dur.ac.uk/a.d.stribblehill/lookup_sun.c" &gt;fixed code&lt;/a&gt; for lookup_sun.c for Autofs 4.0 is here.</description>
    </item>
    <item>
      <pubDate>Tue, 6 Jan 2004 02:17:40 GMT</pubDate>
      <title>6 Jan 2004</title>
      <link>http://www.advogato.org/person/ads/diary.html?start=4</link>
      <guid>http://www.advogato.org/person/ads/diary.html?start=4</guid>
      <description>&lt;p&gt;&lt;em&gt;File, dbm and sql lookup&lt;/em&gt;: I had a little programming to write and was struck by the fact that I have to write my own code to do a linear search through a flat-file. (It was actually way easier to just use Berkeley DBM instead and do db-&amp;gt;find.) I'm wondering if it would be useful to have a library which did lookups for a variety of data sources in a unified manner, so if the source outgrows flat-file it can migrate to somethiing else without having to re-write any code. Anyone else think this would be good?

&lt;p&gt; &lt;p&gt;&lt;em&gt;&lt;a href="http://www.advogato.org/proj/autofs4/" &gt;autofs4&lt;/a&gt;&lt;/em&gt;: Jeremy has in principle accepted my autofs4 code but it's been a year since he last released anything. Must ping him.

&lt;p&gt; &lt;p&gt; &lt;p&gt;&lt;em&gt;PAM&lt;/em&gt;: I wrote a module, &lt;a href="http://womble.dur.ac.uk/~ads/pam_twist/pam_twist.c" &gt;pam_twist&lt;/a&gt; that maps a username into another, so the &lt;a href="http://compsoc.dur.ac.uk/" &gt;Durham Computing Society&lt;/a&gt; can authenticate using either their Society password or with their University password. This way they can log in to change their Society password without having to hassle me.
</description>
    </item>
    <item>
      <pubDate>Thu, 30 Jan 2003 00:19:36 GMT</pubDate>
      <title>30 Jan 2003</title>
      <link>http://www.advogato.org/person/ads/diary.html?start=3</link>
      <guid>http://www.advogato.org/person/ads/diary.html?start=3</guid>
      <description>&lt;p&gt;Been hacking on &lt;a href="http://www.advogato.org/proj/autofs4/" &gt;autofs4&lt;/a&gt; -- adding Sun-style inclusions into file parsing. The code is &lt;a href="http://www.dur.ac.uk/a.d.stribblehill/lookup_sun.c" &gt;here&lt;/a&gt; and if anyone wishes to review it for me, feel free. Email me if you have comments. Jeremy hasn't got back to me about it yet though :(</description>
    </item>
    <item>
      <pubDate>Wed, 18 Dec 2002 13:11:10 GMT</pubDate>
      <title>18 Dec 2002</title>
      <link>http://www.advogato.org/person/ads/diary.html?start=2</link>
      <guid>http://www.advogato.org/person/ads/diary.html?start=2</guid>
      <description>&lt;strong&gt;Debian&lt;/strong&gt;

&lt;p&gt; &lt;p&gt;Been looking through my prospective Debian maintainer's packages. (We call such people &lt;a href="http://nm.debian.org" &gt;NMs&lt;/a&gt;). They're excellent considering his experience, if a little rough round the edges.

&lt;p&gt; &lt;p&gt;I've been getting much better at finding problems in packages in recent days. Stephen Quinney and I occasionally pull apart a package that a NM wants sponsored -- competing to find the most problems in the same package, then comparing notes later. Hopefully this will in turn improve our packaging skills.

&lt;p&gt; &lt;strong&gt;PAM&lt;/strong&gt;

&lt;p&gt; &lt;p&gt;The implementation of these access controls is going nicely but it's not easy to get the users (machine owners) to pin down who they want to give access to. &amp;lt;sigh&amp;gt;
</description>
    </item>
    <item>
      <pubDate>Tue, 17 Dec 2002 12:03:21 GMT</pubDate>
      <title>17 Dec 2002</title>
      <link>http://www.advogato.org/person/ads/diary.html?start=1</link>
      <guid>http://www.advogato.org/person/ads/diary.html?start=1</guid>
      <description>&lt;p&gt;PAM-tastic is the word of the moment.

&lt;p&gt; &lt;p&gt;I'm implementing some login controls using the basic Linux-PAM system and it's great. Just a shame I have to be so repetitive in /etc/pam.d. Once that's done, I'll be porting the useful modules to Solaris. Despite the fact that it's the home of PAM, they have a distinct dearth of handy modules compared with Linux.

&lt;p&gt; &lt;p&gt;&lt;em&gt;Sick things to do with PAM number 1:&lt;/em&gt; Put a 'sufficient' authentication line of pam_listfile into xscreensaver, so my 3-year-old son David doesn't need a password to unlock it.

&lt;p&gt; &lt;p&gt;&lt;em&gt;Update to nnrpd:&lt;/em&gt; That code was accepted with good grace. Splendid.</description>
    </item>
    <item>
      <pubDate>Fri, 13 Dec 2002 09:46:11 GMT</pubDate>
      <title>13 Dec 2002</title>
      <link>http://www.advogato.org/person/ads/diary.html?start=0</link>
      <guid>http://www.advogato.org/person/ads/diary.html?start=0</guid>
      <description>&lt;p&gt;I've been amused to find that nnrpd, the client-facing news server from inn, was completely missing a documented feature. It took about two minutes and &lt;em&gt;one&lt;/em&gt; line of code to implement.

&lt;p&gt; &lt;p&gt;For the interested, the feature in question was the ability to disable Perl filtering for posted articles on the basis of who someone was authenticated as. That's not the point, however.

&lt;p&gt; &lt;p&gt;My point is simply this: Don't manpage writers actually try out what they document?</description>
    </item>
  </channel>
</rss>
