<?xml-stylesheet type='text/css' href='/css/atom.css'?>
<feed xmlns='http://www.w3.org/2005/Atom' xml:lang='en'>
<title>Jakub Wilk's blog</title>
<link href='https://jwilk.net/blog/' rel='self'/>
<link href='https://jwilk.net/blog/'/>
<updated>2026-02-28T10:00:49-00:00</updated>
<author>
  <name>Jakub Wilk</name>
  <email>jwilk@jwilk.net</email>
</author>
<id>http://jwilk.net/blog/</id>
<entry>
  <title>Executable URLs</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20150919-executable-urls'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20150919-executable-urls.mbox'/>
  <id>http://jwilk.net/blog/20150919-executable-urls</id>
  <updated>2015-09-19T11:27:13+02:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><p>…or <a href="http://www.example.com/;a#;ysy=$(yes|head);sy=${ysy#y};s=${sy%%y*};apt-get${s}moo">how to write shell scripts without using whitespace</a>.</p></div></summary>
</entry>
<entry>
  <title>Pet peeves: debhelper build-dependencies (redux)</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20140926-debhelper-build-dependencies'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20140926-debhelper-build-dependencies.mbox'/>
  <id>http://jwilk.net/blog/20140926-debhelper-build-dependencies</id>
  <updated>2014-09-26T14:05:04+02:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><pre>
$ zcat Sources.gz | grep -o -E 'debhelper [(]&gt;= 9[.][0-9]{,7}([^0-9)][^)]*)?[)]' | sort | uniq -c | sort -rn
    338 debhelper (&gt;= 9.0.0)
     70 debhelper (&gt;= 9.0)
     18 debhelper (&gt;= 9.0.0~)
     10 debhelper (&gt;= 9.0~)
      2 debhelper (&gt;= 9.2)
      1 debhelper (&gt;= 9.2~)
      1 debhelper (&gt;= 9.0.50~)
</pre>
<p>Is it a way to protest against
<a href="https://joeyh.name/blog/entry/version_numbers/">the current debhelper's version scheme</a>?</p></div></summary>
</entry>
<entry>
  <title>Joys of East Asian encodings</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20140904-east-asian-encodings'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20140904-east-asian-encodings.mbox'/>
  <id>http://jwilk.net/blog/20140904-east-asian-encodings</id>
  <updated>2014-09-04T14:01:57+02:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><p>In <a href="http://jwilk.net/software/i18nspector">i18nspector</a> I try to support all the encodings that were blessed by
<a href="https://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html#index-encoding-list">gettext</a>, but it turns out to be more difficult than I anticipated:</p>
<pre>
$ roundtrip() { c=$(echo $1 | iconv -t $2); printf '%s -&gt; %s -&gt; %s\n' $1 $c $(echo $c | iconv -f "$2"); }

$ roundtrip ¥ EUC-JP
¥ -&gt; \ -&gt; \

$ roundtrip ¥ SHIFT_JIS
¥ -&gt; \ -&gt; ¥

$ roundtrip ₩ JOHAB
₩ -&gt; \ -&gt; ₩
</pre>
<p>Now let's do the same in Python:</p>
<pre>
$ python3 -q
&gt;&gt;&gt; roundtrip = lambda s, e: print('%s -&gt; %s -&gt; %s' % (s, s.encode(e).decode('ASCII', 'replace'), s.encode(e).decode(e)))
&gt;&gt;&gt; roundtrip('¥', 'EUC-JP')
¥ -&gt; \ -&gt; \
&gt;&gt;&gt; roundtrip('¥', 'SHIFT_JIS')
¥ -&gt; \ -&gt; \
&gt;&gt;&gt; roundtrip('₩', 'JOHAB')
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "&lt;stdin&gt;", line 1, in &lt;lambda&gt;
UnicodeEncodeError: 'johab' codec can't encode character '\u20a9' in position 0: illegal multibyte sequence
</pre>
<p>So is 0x5C a backslash or a yen/won sign? Or both?</p>
<p>And what if 0x5C could be a second byte of a two-byte character?
What could possibly go <a href="https://bugs.python.org/issue22187">wrong</a>?</p></div></summary>
</entry>
<entry>
  <title>More spell-checking</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20140829-spell-checking'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20140829-spell-checking.mbox'/>
  <id>http://jwilk.net/blog/20140829-spell-checking</id>
  <updated>2014-08-29T13:51:31+02:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><p>Have you ever wanted to use Lintian's spell-checker against arbitrary files?
Now you can do it with <a href="https://bitbucket.org/jwilk/spellintian">spellintian</a>:</p>
<pre>
$ zrun spellintian --picky /usr/share/doc/RFC/best-current-practice/rfc*
/tmp/0qgJD1Xa1Y-rfc1917.txt: amoung -&gt; among
/tmp/kvZtN435CE-rfc3155.txt: transfered -&gt; transferred
/tmp/o093khYE09-rfc3481.txt: unecessary -&gt; unnecessary
/tmp/4P0ux2cZWK-rfc6365.txt: charater -&gt; character
</pre>
<p><a href="http://jwilk.net/software/mwic">mwic</a> (<em>Misspelled Words In Context</em>) takes a different approach. It uses
classic spell-checking libraries (via <a href="http://www.abisource.com/projects/enchant/">Enchant</a>), but it groups misspellings and
shows them in their contexts. That way you can quickly filter out
false-positives, which are very common in technical texts, using visual grep:</p>
<pre>
$ zrun mwic /usr/share/doc/debian/social-contract.txt.gz
DFSG:
| …an Free Software Guidelines (DFSG)
| …an Free Software Guidelines (DFSG) part of the
                                ^^^^

Perens:
|    Bruce Perens later removed the Debian-spe…
| by Bruce Perens, refined by the other Debian…
           ^^^^^^

Ean, Schuessler:
| community" was suggested by Ean Schuessler. This document was drafted
                              ^^^ ^^^^^^^^^^

GPL:
| The "GPL", "BSD", and "Artistic" lice…
       ^^^

contrib:
| created "contrib" and "non-free" areas in our…
           ^^^^^^^

CDs:
| their CDs. Thus, although non-free wor…
        ^^^
</pre></div></summary>
</entry>
<entry>
  <title>For those who care about snowclones</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20140221-for-those-who-care-about-snowclones'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20140221-for-those-who-care-about-snowclones.mbox'/>
  <id>http://jwilk.net/blog/20140221-for-those-who-care-about-snowclones</id>
  <updated>2014-02-21T14:21:13+01:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><p>Instances of the “for those who care about X” <a href="http://itre.cis.upenn.edu/~myl/languagelog/archives/000350.html">snowclone</a> on Debian
mailing lists:</p>
<ul>
<li><a href="https://lists.debian.org/20060113223524.GA8733@localhost.localdomain">their packages in Ubuntu</a> (the original!)</li>
<li><a href="https://lists.debian.org/20060114150040.GA9575@suffields.me.uk">lesbians</a></li>
<li><a href="https://lists.debian.org/Pine.LNX.4.62.0601141605140.11220@wr-linux02">Andrew Suffield</a></li>
<li><a href="https://lists.debian.org/20060118170704.GB18875@finlandia.infodrom.north.de">debian-devel-announce</a></li>
<li><a href="https://lists.debian.org/8764ogqtqb.fsf@nahar.marcbrockschmidt.de">their packages in klik</a></li>
<li><a href="https://lists.debian.org/8764od8fta.fsf_-_@glaurung.internal.golden-gryphon.com">the [GFDL] GR</a></li>
<li><a href="https://lists.debian.org/20060309103207.GQ21840@finlandia.infodrom.north.de">stable updates</a></li>
<li><a href="https://lists.debian.org/20060317122038.GB9697@schmehl.info">bits from [press and events] teams</a></li>
<li><a href="https://lists.debian.org/5fabd6fd0603210642y291c7d1fm48da046e4beacf20@mail.gmail.com">glib applications</a></li>
<li><a href="https://lists.debian.org/20060411192827.GE9752@country.grep.be">experimental</a></li>
<li><a href="https://lists.debian.org/20060513063811.GN6357@decadentplace.org.uk">Debconf</a></li>
<li><a href="https://lists.debian.org/200606151942.45212.madcoder@debian.org">Policy §7.6</a></li>
<li><a href="https://lists.debian.org/20070202070207.GA1898@lapse.madduck.net">Switzerland/Liechtenstein</a></li>
<li><a href="https://lists.debian.org/20080817212143.GH9606@patate.is-a-geek.org">X</a></li>
<li><a href="http://womble.decadent.org.uk/blog/for-those-who-care-about-firmware.html">firmware</a></li>
<li><a href="https://lists.debian.org/20081030164101.GI24098@artemis.corp">bts-link</a></li>
<li><a href="https://lists.debian.org/20081123211744.GB12944@artemis">lesbians</a> (reloaded)</li>
<li><a href="https://lists.debian.org/87oczsnbp3.fsf@tarjan.ravneholm26.dk">pam-ssh</a></li>
<li><a href="https://lists.debian.org/87aayjsbeo.fsf@tarjan.ravneholm26.dk">Mercurial</a></li>
<li><a href="https://lists.debian.org/20100306024909.GA22216@kunpuu.plessy.org">manpages</a></li>
<li><a href="https://lists.debian.org/1282698543.22839.54.camel@localhost">their packages in Debian</a></li>
<li><a href="https://lists.debian.org/20110217040737.GA17259@mycre.ws">unbound</a></li>
<li><a href="https://lists.debian.org/5065ABB8.7090805@progress-technologies.net">irker</a></li>
<li><a href="https://lists.debian.org/20130103214236.GD19361@an3as.eu">[team metrics] statistics</a></li>
</ul></div></summary>
</entry>
<entry>
  <title>µdput</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20131225-udput'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20131225-udput.mbox'/>
  <id>http://jwilk.net/blog/20131225-udput</id>
  <updated>2013-12-25T18:35:42+01:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><p>My Internet connection is too flaky to use <a href="https://packages.debian.org/unstable/dput">dput</a>(-<a href="http://dput-ng.debian.net/">ng</a>) reliably,
so I use this tiny replacement instead:</p>
<pre>
#!/bin/sh
dcmd rsync --chmod=0644 -P "$@" ssh.upload.debian.org:/srv/upload.debian.org/UploadQueue/
</pre></div></summary>
</entry>
<entry>
  <title>A-za-z | a-zA-z</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20131204-a-za-z-a-za-z'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20131204-a-za-z-a-za-z.mbox'/>
  <id>http://jwilk.net/blog/20131204-a-za-z-a-za-z</id>
  <updated>2013-12-05T13:32:46+01:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><p>Releasing the shift key is <a href="http://codesearch.debian.net/search?q=A-za-z|a-zA-z">hard</a>.</p></div></summary>
</entry>
<entry>
  <title>~/.netrc security</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20131104-netrc-security'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20131104-netrc-security.mbox'/>
  <id>http://jwilk.net/blog/20131104-netrc-security</id>
  <updated>2013-11-04T15:44:15+01:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><p>TL;DR: don't put valuable passwords in <tt><span>~/.netrc</span></tt></p>
<p>In the olden days, the <tt><span>~/.netrc</span></tt> file was used for storing FTP
usernames and passwords. These days we have clients of other protocols
that use said file. Perhaps your IMAP or SMTP client use it. So you put
your e-mail accounts password into <tt><span>~/.netrc</span></tt>, and then meticulously
configured the clients to always connect via TLS and to verify server
certificates. You feel secure.</p>
<p>But you shouldn't. Here's how an attacker capable of MiTM can exploit
<tt>wget</tt> to steal <tt><span>~/.netrc</span></tt> passwords:</p>
<p>1) Alice tries to download a file over HTTP:</p>
<pre>
$ wget http://xkcd.com/538/
</pre>
<p>2) Eve takes over the HTTP connection, sending a redirection response:</p>
<pre>
HTTP/1.1 303 See Other
Location: http://supersecuremail.example.net/
</pre>
<p>3) Alice's <tt>wget</tt> follows the redirection.</p>
<p>4) Eve takes over the connection to supersecuremail.example.net,
requesting password authentication:</p>
<pre>
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="moo"
</pre>
<p>5) Alice's <tt>wget</tt> sends the <tt>supersecuremail.example.net</tt> password
straight to Eve.</p></div></summary>
</entry>
<entry>
  <title>Internationalization environment variables</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20130112-localehelper'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20130112-localehelper.mbox'/>
  <id>http://jwilk.net/blog/20130112-localehelper</id>
  <updated>2013-01-12T15:03:31+01:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><p>Setting <a href="http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html#tag_08_02">internationalization environment variables</a> is a bit tricky.
For example, this:</p>
<pre>
$ LANG=sv_SE.UTF-8 stat /nonexistent
</pre>
<p>may look like a way to make <tt>stat(1)</tt> print the error message in
Swedish. Yet there are many ways it could go wrong:</p>
<ol>
<li><tt>LC_MESSAGES</tt> could be set in the environment, overriding <tt>LANG</tt>.</li>
<li><tt>LC_ALL</tt> could be set, overriding both <tt>LC_MESSAGES</tt> and
<tt>LANG</tt>.</li>
<li><tt>LANGUAGE</tt> could be set, overriding <tt>LC_ALL</tt>, <tt>LC_MESSAGES</tt>,
and <tt>LANG</tt>. For extra complexity, <tt>LANGUAGE</tt> has no effect if
<tt>LC_MESSAGES</tt> is effectively set to <tt>C</tt>. (Also, this variable is a
GNUism.)</li>
<li>The locale could be simply missing from the system.</li>
</ol>
<p>To make these things a little less intricate, I wrote <a href="http://jwilk.net/software/localehelper">localehelper</a>.
It's a bit like <tt>env(1)</tt>, but it takes care of:</p>
<ul>
<li>unsetting all internationalization variables that weren't explicitly
set on the command line;</li>
<li>if needed, generating missing locales (in a temporary location).</li>
</ul>
<p>This does the right thing:</p>
<pre>
$ localehelper LANG=sv_SE.UTF-8 stat /nonexistent
stat: kan inte ta status på ”/nonexistent”: Filen eller katalogen finns inte
</pre></div></summary>
</entry>
<entry>
  <title>All those translations, how did you ever manage it?</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20121111-gettext-inspector'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20121111-gettext-inspector.mbox'/>
  <id>http://jwilk.net/blog/20121111-gettext-inspector</id>
  <updated>2012-11-11T17:31:24+01:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><p>I've just released initial version of <a href="http://jwilk.net/software/gettext-inspector">gettext-inspector</a>, a tool for checking
<a href="https://www.gnu.org/software/gettext/">gettext</a> PO/POT/MO files. While it's in an early stage of development, it's
already able to detect wide rage of <a href="https://bitbucket.org/jwilk/gettext-inspector/src/default/data/tags">problems</a>. For example, this is what it
emits on my system:</p>
<pre>
$ gettext-inspector /usr/share/locale/*/LC_MESSAGES/*.mo | cut -d ' ' -f 1,3 | sort | uniq -c | sort -rn
   1902 P: no-language-header-field
   1601 P: no-version-in-project-id-version
   1372 W: no-report-msgid-bugs-to-header-field
    273 P: invalid-content-transfer-encoding
    201 W: invalid-date
     78 W: syntax-error-in-plural-forms
     77 I: no-package-name-in-project-id-version
     63 W: boilerplate-in-report-msgid-bugs-to
     50 W: language-disparity
     47 I: unknown-header-field
     38 W: invalid-language
     25 W: boilerplate-in-project-id-version
     10 I: unknown-poedit-language
      8 W: no-date-header-field
      5 W: no-project-id-version-header-field
      5 W: c1-control-characters
      3 P: no-mime-version-header-field
      3 P: no-content-transfer-encoding-header-field
      2 W: non-portable-encoding
      1 W: invalid-report-msgid-bugs-to
      1 W: ancient-date
      1 I: unable-to-determine-language
</pre></div></summary>
</entry>
<entry>
  <title>Spell-checker for irssi</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20120815-irssi-spellcheck'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20120815-irssi-spellcheck.mbox'/>
  <id>http://jwilk.net/blog/20120815-irssi-spellcheck</id>
  <updated>2012-08-15T23:04:40+02:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><p>I tried many spell-checkers for <a href="https://www.irssi.org/">irssi</a>, and they all sucked (and some
of them were also completely <a href="http://irssi-spell.svn.sourceforge.net/viewvc/irssi-spell/trunk/irssi-spell.pl?revision=5&amp;view=markup#l54">insane</a>). So I took <a href="http://toxcorp.com/irc/irssi/spellcheck/">the one that seemed
least crazy</a> and <a href="http://jwilk.net/software/irssi-spellcheck">forked</a> it.</p></div></summary>
</entry>
<entry>
  <title>Adequate quality</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20120811-adequate'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20120811-adequate.mbox'/>
  <id>http://jwilk.net/blog/20120811-adequate</id>
  <updated>2012-08-11T22:08:18+02:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><p>I present you <a href="http://jwilk.net/software/adequate">adequate</a>, a tool that checks for some common bugs in
packages you have installed on your system. The Debian package comes
with APT hooks, so that you'll be notified (via debconf) every time you
install an adequately-buggy package.</p>
<p>If you don't like broken symlinks, disappearing <tt><span>/usr/share/doc/*/</span></tt>
directories, obsolete conffiles, or <tt>*.py</tt> files without corresponding
<tt>*.pyc</tt>, <em>adequate</em> is for you.</p></div></summary>
</entry>
<entry>
  <title>Pet peeves: debhelper build-dependencies</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20120710-debhelper-build-dependencies'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20120710-debhelper-build-dependencies.mbox'/>
  <id>http://jwilk.net/blog/20120710-debhelper-build-dependencies</id>
  <updated>2012-07-10T16:29:27+02:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><pre>
$ zcat Sources.gz | grep -o 'debhelper (&gt;= 9.0[^)]*)' | sort | uniq -c | sort -rn
     47 debhelper (&gt;= 9.0.0)
     13 debhelper (&gt;= 9.0)
      4 debhelper (&gt;= 9.0.0~)
      3 debhelper (&gt;= 9.0~)
</pre>
<p>Hey, wake up!
<a href="https://joeyh.name/blog/entry/version_numbers/">debhelper is no longer using such versioning scheme</a>.
Simple <tt>(&gt;= 9)</tt> would be both shorter and less silly.</p></div></summary>
</entry>
<entry>
  <title>Why you shouldn&#39;t use Ohloh</title>
  <link type='application/atom+xml' href='https://jwilk.net/blog/20120703-ohloh'/>
  <link type='application/mbox' href='https://jwilk.net/blog/20120703-ohloh.mbox'/>
  <id>http://jwilk.net/blog/20120703-ohloh</id>
  <updated>2012-07-03T21:48:54+02:00</updated>
  <summary type="xhtml"><div xmlns='http://www.w3.org/1999/xhtml'><p>Here's <a href="http://www.ohloh.net/forums/10/topics/5592">why</a>.</p></div></summary>
</entry>
</feed>