tag:blogger.com,1999:blog-39391645410283171592024-02-19T10:06:47.513-06:00Raphael's blogOn software, projects, ideas, random thoughts, and more.Unknownnoreply@blogger.comBlogger73125tag:blogger.com,1999:blog-3939164541028317159.post-55744108463753288212015-08-25T02:00:00.000-05:002015-08-25T02:00:00.285-05:00Updates to the sources.debian.net editorDebconf is a great opportunity to meet people in real life, to express and share ideas in a different way, and to work on all sort of stuff.<br />
<br />
I therefore spent some time to finish a couple of features in the <a href="http://rgeissert.blogspot.com/2014/12/editing-debian-online-with.html">editor for sources.debian.net</a>. Here are some of the changes:<br />
<br />
<ul><li>Compare the source file with that of another version of the package</li>
<li>And in order to present that: tabs! editor tabs!</li>
<li>at the same time: generated diffs are now presented in a new editor tab, from where you can download it or email it</li>
</ul><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiJ_rjHMzYQdAUXWFrsdK7eU9Av8i0ZnqmUAQ02IlxU9qt9aAQ_0FTwkaG6is4F-ALrreIfPXW3LAB_2Ojrm5RpqJF3DFUJsPwMFHy7F_j43-oieHqqrZR_7V6q-okREJZtgFVHd4r5IQ/s1600/edit+tabs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiJ_rjHMzYQdAUXWFrsdK7eU9Av8i0ZnqmUAQ02IlxU9qt9aAQ_0FTwkaG6is4F-ALrreIfPXW3LAB_2Ojrm5RpqJF3DFUJsPwMFHy7F_j43-oieHqqrZR_7V6q-okREJZtgFVHd4r5IQ/s1600/edit+tabs.png" /></a></div><br />
Get it for <a href="http://rgeissert.blogspot.com/2014/12/editing-debian-online-with.html">chromium</a>, and <a href="http://rgeissert.blogspot.com/2015/01/edit-debian-with-iceweasel.html">iceweasel</a>.<br />
<br />
If your browser performs automatic updates of the extensions (the default), you should soon be upgraded to version 0.1.0 or later, bringing all those changes to your browser.<br />
<br />
Want to see more? multi-file editing? in-browser storage of the editing session? that and more can be done, so feel free to join me and contribute to the Debian sources online editor!Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-3939164541028317159.post-84799792728080353322015-08-20T04:33:00.002-05:002015-08-20T04:33:40.290-05:00Call for release goal: package reconsiderationBased on a discussion around breakfast, and encouraged by the people at the table, I hereby call for a new release goal (or challenge, whatever you prefer to call it):<br />
<br />
<big><br />
Every package maintainer should remove one of their packages from the archive.<br />
</big><br />
<br />
It's dead simple. It is acceptable to adopt a package to <i>replace</i> the one that has been removed, or to add a new one to the archive.<br />
For tracking purposes please include "for RG" (release goal) in the removal request to <a href="https://bugs.debian.org/ftp.debian.org">ftp.debian.org</a>.<br />
<br />
<br />
And how about a debconf challenge? how about filing over <b>100 removal requests before the end of Debconf 15</b> on Saturday night? blog about it, dent/twit about it, spam IRC about it!<br />
<br />
<br />
The idea came up after discussing about how us as package maintainers refuse to remove our obsolete or unused packages. So yes, that may also include the very first package that you got into the archive.<br />
<br />
<br />
Sad news, good news.Unknownnoreply@blogger.com1Heidelberg, Germany49.3987524 8.67243350000001149.2334369 8.34971000000001 49.5640679 8.9951570000000114tag:blogger.com,1999:blog-3939164541028317159.post-15384650679005779222015-06-05T02:00:00.000-05:002015-06-05T02:00:13.857-05:00IncompetenceI don't know most of my passwords<br />
<br />
I don't know most of my email addresses<br />
<br />
<br />
But I do know which site shared my email address with spammers<br />
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-3939164541028317159.post-15202091973187397632015-05-14T06:31:00.000-05:002015-05-14T06:32:09.041-05:00On using https mirrorsOn confidentiality:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://i.dailymail.co.uk/i/pix/2014/01/08/article-2535670-1A7BFC7100000578-5_634x370.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://i.dailymail.co.uk/i/pix/2014/01/08/article-2535670-1A7BFC7100000578-5_634x370.jpg" width="580px" /></a></div><br />
So that they don't know what's insideUnknownnoreply@blogger.com2tag:blogger.com,1999:blog-3939164541028317159.post-66090296190585282762015-04-28T01:00:00.000-05:002015-04-28T01:00:00.706-05:00Updates to the Debian sources editorSince the announcement of the chrome/chromium and firefox/iceweasel extensions that add in-browser editing of Debian sources there have been a few changes:<br />
<br />
<ul><li>Update to Ace 1.1.9, which brings quite some fixes</li>
<li>Downloads with proper file names! this should work with recent browsers. E.g for a patch it will propose <i>package-version_path_file.patch</i></li>
<li>Changing the order of additions and removals in the generated patches (it was strange to see additions first)</li>
<li>Improvements to the compatibility with debsources' URL parameters</li>
<li>Allow the extension to be enabled in private browsing mode (firefox/iceweasel)</li>
<li>Loading of the extension when browsing debsources via https</li>
<li>Internal extension packaging cleanup, including the generation of a versioned copy of the web (remote) files, so that users of version 0.0.x do use the remote code version 0.0.x</li>
</ul><br />
If your browser performs automatic updates of the extensions (the default), you should soon be upgraded to version 0.0.10 or later, bringing all those changes to your browser.<br />
<br />
Want to see more? multi-file editing? emacs and vim editing modes? in-browser storage of the modified files? that and more can be done, so feel free to join me and contribute to the Debian sources editor!<br />
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3939164541028317159.post-36556941135411874172015-04-01T05:00:00.000-06:002015-04-01T05:28:07.474-06:00Special guest for the Lyon minidebconf, 2015It appears that this year's MiniDebconf in Lyon, France is going to have a very special guest. After enjoying so much the <a href="http://meetings-archive.debian.net/pub/debian-meetings/2014/debconf14/webm/QA_with_Linus_Torvalds.webm" target="_blank" rel="nofollow">Q&A held at Debconf14</a>, Linus Torvalds has decided to make a quick detour from a trip to Europe to bring the opportunity for another session with the Debian community.<br />
<br />
The event <b>has yet to appear</b> in the <a href="https://wiki.debian.org/DebianEvents/fr/2015/Minidebconf">MiniDebconf agenda</a>. Rumor has it that the hurds of fans that tend to attend his events pose a logistics and safety challenge, reason why the event might only appear in the agenda a couple of days before the event.<br />
Lyon being such an easy place to get by train, flight, car, and even by boat, it is understandable and should be expected that a great number of people attend the minidebconf only for his very session.<br />
<br />
If you have not yet registered, I'd recommend you to do so now and to book your travel and accommodation ASAP, before everything is overpriced due to high demand.<br />
<br />
See you in ten days!<br />
<br />
P.S. kudos to the organizers!Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-3939164541028317159.post-19449208563466612312015-01-20T01:00:00.000-06:002015-01-20T01:00:05.830-06:00Edit Debian, with iceweaselSoon after publishing the chromium/chrome extension that allows you to <a href="http://rgeissert.blogspot.com/2014/12/editing-debian-online-with.html">edit Debian online</a>, <a href="https://github.com/lejenome">Moez Bouhlel</a> sent a pull request to the extension's git repository: all the changes needed to make a firefox extension!<br />
<br />
After another session of browser extensions discovery, I merged the commits and generated the xpi. So now you can go download the <a href="https://people.debian.org/~geissert/ace-debsources/ace-sourced_n.xpi">Debian online editing firefox extension</a> and hack the world, the Debian world.<br />
<br />
Install it and start contributing to Debian from your browser. There's no excuse now.<br />
<br />
Unknownnoreply@blogger.com7tag:blogger.com,1999:blog-3939164541028317159.post-39493870074111630412014-12-16T02:00:00.000-06:002014-12-16T02:00:00.596-06:00Editing Debian online with sources.debian.netHow cool would it be to fix that one bug you just found without having to download a source package? and without leaving your browser?<br />
<br />
Inspired by github's online code editing, during <a href="http://debconf14.debconf.org/"><b>Debconf 14</b></a> I worked on integrating an online editor on debsources (the software behind sources.debian.net). Long story short: it is available today, for users of chromium (or anything supporting chrome extensions).<br />
<br />
After installing the <a href="https://people.debian.org/~geissert/ace-debsources/latest.crx">editor for sources.debian.net extension</a>, go straight to sources.debian.net and enjoy!<br />
<br />
Go from simple debsources:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSfZe11qxsu8FTGJNyoTuOdpipj8jv029CbLCRgJV0S2iWvKHa7ehYSiOuuKf1ZALI4z-h6y6gi7rBO_zoWqkarccC8VS2r26THFZNKTQCoxSMjsGifJs1tx4OuL3rjaV4NOvfAJ0wKhk/s1600/sad+debsources.png" /></div><br />
To debsources on steroids:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOQS34w4r5hvwoCNImMpHLegpG11mkL6DqprE3YMPrXfhgQF63c2OFf002eAgAaMQpJgyxfVlIgDddNVW4pHZAxHwhf-qwPy_GanW-aYqtV764QnWssGmm5dHFaa8LK-GQNYApJ-Wa4KE/s1600/edit+debsources.png" /></div><br />
All in all, it brings:<br />
<ul><li>Online editing of all of Debian</li>
<li><b>In-browser patch generation</b>, available for download</li>
<li>Downloading the modified file</li>
<li>Sending the patch to the <b>BTS</b></li>
<li>Syntax highlighting for over <b>120 file formats!</b></li>
<li>More hidden gems from <a href="http://ace.c9.io/">Ace editor</a> that can be integrated thanks to patches from you</li>
</ul><br />
Clone it or <a href="https://github.com/rgeissert/ace-sourced.n/fork">fork it</a>:<br />
<pre>git clone https://github.com/rgeissert/ace-sourced.n.git
</pre><br />
For example, head to apt's source code, find a typo and correct it online: open <a href='http://sources.debian.net/src/apt/latest/cmdline/apt.cc/'>apt.cc</a>, click on <b>edit</b>, make the changes, click on <b>email patch</b>. Yes! it can generate a mail template for sending the patch to the BTS: just add a nice message and your patch is ready to be sent.<br />
<br />
Didn't find any typo to fix? how sad, head to codesearch and <a href="http://codesearch.debian.net/results/informations/page_0">search Debian for a spelling mistake</a>, click on any result, edit, correct, email! you will have contributed to Debian in less than 5 minutes without leaving your browser.<br />
<br />
The editor was meant to be integrated into debsources itself, without the need of a browser extension. This is expected to be done when the requirements imposed by debsources maintainers are sorted out.<br />
<br />
Kudos to Harlan Lieberman who helped <a href="http://blog.setec.io/articles/debconf-return/">debug some performance issues</a> in the early implementations of the integration and for working on the packaging of the Ace editor.Unknownnoreply@blogger.com7tag:blogger.com,1999:blog-3939164541028317159.post-52806281658809067392014-04-01T06:00:00.000-06:002014-04-01T06:00:16.379-06:00Rant: no more squeeze LTSFollowing my blog post about <a href="http://rgeissert.blogspot.com/2014/03/debian-squeeze-lts.html" rel="nofollow">Long Term Support for Debian squeeze</a>, the news was picked up by <a href="http://linux.slashdot.org/story/14/03/20/1722208/debian-considering-long-term-support-for-squeeze" rel="nofollow">Slashdot</a>, <a href="http://www.reddit.com/r/debian/comments/20q17p/if_you_want_squeeze_lts_and_can_contribute/" rel="nofollow">Reddit</a> (again), Barrapunto, <a href="https://twitter.com/debian/status/446592718173507584" rel="nofollow">Twitter</a>, and <a href="http://www.phoronix.com/forums/showthread.php?97705-Mesa-10-2-devel-Is-Going-To-Land-In-Ubuntu-14-04-LTS&p=406379#post406379" rel="nofollow">Phoronix</a> (in spite of their skepticism).<br />
<br />
Over 300 persons, some representing their companies, contacted the security team since the news about the LTS came out - it all seemed like things were finally rrolling.<br />
<br />
However, a few days before the coordination mailing list was setup, a <a href="http://abovethelaw.com/2011/04/cease-and-desist-follow-up-check-you-calendar/" rel="nofollow" title="Cease and Desist">not-so-friendly mail</a> was received from a legal officer of a company that produces a RPM derivative with Long Term Support and paid support contracts. The <i>company-that-can't-be-named</i> from here on, due to <a href="https://en.wikipedia.org/wiki/Trademark_abuse">trademark abuse</a>.<br />
<br />
Long story short: the Debian Squeeze LTS project has been boycotted and threatened. Unfair competition (antitrust law) has been brought up against the project, among other threats.<br />
<br />
So, great move <i>company-that-can't-be-named</i>, you got it - there won't be LTS, it's been decided and the interested parties have been notified. Perhaps you want to take over the actual development?<br />
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-3939164541028317159.post-69717475200288424272014-03-18T01:30:00.000-06:002014-03-18T01:30:00.168-06:00Debian squeeze LTSAs announced in the "<i><a href="https://lists.debian.org/debian-devel-announce/2014/03/msg00004.html">Bits from the Security Team</a></i>" (<small><a href="https://lwn.net/Articles/590311/" rel="nofollow">LWN copy</a></small>) email a couple of weeks ago, it is possible that Debian squeeze will have Long Term Support, primarily in the way of security updates.<br />
<br />
The news have made it to <a href="http://news.softpedia.com/news/Debian-Developers-Are-Preparing-an-LTS-Version-for-quot-Wheezy-quot-432130.shtml" rel="nofollow">Softpedia</a> and <a href="http://www.reddit.com/r/linux/comments/20bl4r/debian_plans_for_a_lts_version_of_debian_6/" rel="nofollow">reddit</a> and even though it has not been announced how long it would be supported, what use cases are planned, etc., the answer I can give is that <b>it depends solely on people contributing to it</b>.<br />
<br />
I'd like to add that no, the LTS announcement is not related to the use of <a href="http://www.debian.org/News/weekly/2013/10/#nasa" rel="nofollow">Debian on the ISS laptops</a>, as mentioned in reddit - at least not that we are aware of. And to avoid possible confusion from the Softpedia article, the plan is LTS for the <b>squeeze</b> release.<br />
<br />
From the emails we have received in response to the announcement, I do wonder however where are the people who expressed interest and signs of engagement last time there was a discussion about <a href="https://lwn.net/Articles/565007/">providing LTS for Debian</a>.<br />
<br />
Perhaps it wasn't stressed enough in the email, but those who are <i>interested</i> in benefiting from (and therefore contributing to) long term support, please do <b>contact the security team NOW</b>.<br />
<br />
After all, the clock keeps ticking and Debian squeeze is going to reach its End of Life in less than two months otherwise.<br />
Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-3939164541028317159.post-85342179669662011522013-11-13T02:30:00.000-06:002013-11-13T04:47:10.480-06:00A bashism a week: heredocsOne great feature of POSIX shells is the so-called <i><span title="here document">heredoc</span></i>. They are even available in languages such as Perl, PHP, and Ruby.<br />
<br />
So where is the bashism?<br />
<br />
It's in the implementation. What odd thing do you see below?<br />
<br />
<code><br />
$ strace -fqe open bash -c 'cat <<EOF<br />
foo<br />
EOF' 2>&1 | grep -v /lib<br />
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3<br />
open("/dev/tty", O_RDWR|O_NONBLOCK|O_LARGEFILE) = 3<br />
open("/proc/meminfo", O_RDONLY|O_CLOEXEC) = 3<br />
[pid 6696] open("/tmp/sh-thd-1384296303", O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_LARGEFILE, 0600) = 3<br />
[pid 6696] open("/tmp/sh-thd-1384296303", O_RDONLY|O_LARGEFILE) = 4<br />
[pid 6696] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3<br />
foo<br />
--- SIGCHLD (Child exited) @ 0 (0) ---<br />
</code><br />
<br />
Yes, it uses temporary files!<br />
<br />
So do ksh, pdksh, mksh, posh and possible other shells. Busybox's sh and dash do not use temporary files, though:<br />
<br />
<code><br />
$ strace -fqe open dash -c 'cat <<EOF<br />
foo<br />
EOF' 2>&1 | grep -v /lib<br />
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3<br />
[pid 6767] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3<br />
foo<br />
--- SIGCHLD (Child exited) @ 0 (0) ---<br />
</code><br />
<br />
Next time you want data to never hit a hard disk, beware that heredocuments and herestrings are best avoided.<br />
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3939164541028317159.post-80657448100103639692013-10-09T02:30:00.000-05:002013-10-09T02:30:01.129-05:00A bashism a week: mathsYou've probably already done some basic maths in shell scripts, but do you know what else you can actually do?<br />
<br />
Pick at least 4 operations that you can do in bashisms-free shell scripts:<br />
<br />
<pre>$((n+1))
$((n>8))
$((n^4))
$((--n))
$((n*=5))
$((n++))
$((n==1?2:3))
</pre><br />
The POSIX:2001 standard defines the <a href="http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_04">arithmetic expansion requirements</a>, which leads us to selecting all of the above operations except two:<br />
<br />
<pre>$((--n))
$((n++))
</pre><br />
"--" and "++" are not required to be implemented, and in some cases they may lead to <b>unexpected results</b>, such as the following:<br />
<br />
<code><br />
$ bash -c 'n=1; echo $((++n))'<br />
2<br />
$ dash -c 'n=1; echo $((++n))'<br />
1<br />
</code><br />
<br />
Remember, if you rely on any non-standard behaviour or feature make sure you document it and, if feasible, check for it at run-time.<br />
Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-3939164541028317159.post-51094494284225777812013-10-08T01:30:00.000-05:002013-10-08T01:30:04.280-05:00Faster, more stable and new opportunitiesA new version of the code behind <a href="http://http.debian.net/" title="Debian mirrors redirector">http.debian.net</a> was deployed a few days ago. It has proved to be far more stable, faster, and scalable compared to the previous mod_perl-based deployment.<br />
<br />
There were a couple of glitches during the earlier roll-out for IPv6 users, fixed thanks to the reports by Cyril Brulebois, Michael Stapelberg and Robert Drake.<br />
<br />
What's behind?<br />
The redirector is now a <a href="http://plackperl.org/">plack</a> application (with no middlewere) running under the <a href="http://search.cpan.org/perldoc?Starman">Starman server</a> with an apache fronted. Requests are processed faster than before and there mod_perl-induced system overload is finally gone.<br />
<br />
The redirector is now easier to test and develop. Deploying the live instance is not yet fully streamlined, but it has seen a lot of improvement. Some important changes to the way the redirector works are already on their way to see the light and I am going to be announcing them when they do. <a href="https://github.com/rgeissert/http-redirector/">Fork the repository</a> and hack a few changes, contributions are welcome :)<br />
<br />
It's probably time to move it under debian.<b>org</b>, and finish <a href="http://live.debian.net/manual/4.x/html/live-manual/customizing-package-installation.en.html#359" rel="nofollow">making</a> <a href="http://grml.org/changelogs/README-grml-2013.02/" rel="nofollow">it</a> <a href="http://packages.qa.debian.org/f/fai/news/20120626T151930Z.html" rel="nofollow">the</a> <a href="http://people.skolelinux.org/pere/blog/Fourth_alpha_release_of_Debian_Edu_Skolelinux_based_on_Debian_Wheezy.html" rel="nofollow">default</a> <a href="https://encrypted.google.com/search?q=%22http.debian.net%22+site:wiki.debian.org" rel="nofollow">everywhere</a>. It's even made its way into the <a href="http://www.debian.org/releases/stable/i386/ch06s03.html#apt-setup-mirror-selection" rel="nofollow">installation manual</a>.<br />
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3939164541028317159.post-88102266302939940492013-10-02T02:30:00.000-05:002013-10-02T04:26:52.248-05:00A bashism a week: dangerous exportsAs a user of a shell you have most likely had the need to export a variable to another process; i.e. set/modify an environment variable.<br />
<br />
Now, how do you stop exporting an environment variable? can you export anything else?<br />
<br />
The bash shell offers the <i>-n</i> option of the <i>export</i> built-in, claiming it "<i>remove[s] the export property</i>". However, this feature is not part of the POSIX:2001 standard and is, therefore, a bashism.<br />
<br />
A portable way to stop exporting an environment variable is to <i>unset</i> it. E.g. the effect of "export MY_VAR=foo" can be reverted by calling "unset MY_VAR" - surely enough, this will also destroy the content of the variable.<br />
<br />
An equivalent could then be:<br />
<br />
<code># to stop exporting/"unexport" the MY_VAR environment variable:<br />
my_var="$MY_VAR" ; unset MY_VAR ;<br />
MY_VAR="$my_var" ; unset my_var ;</code><br />
<br />
The above code will make a copy of the variable before destroying it and then restoring its content.<br />
<br />
How about exporting other things? did you know that you can <b>export shell functions</b>?<br />
<br />
With the bash shell, you can export a function with the <i>-f</i> parameter of the <i>export</i> built-in. Needless to say, this is a bashism. Its secret? it's just an environment variable with the name of the function and the rest of the function definition as its value.<br />
<br />
Try this:<br />
<br />
<code>$ echo="() { /bin/echo 'have some bash' ; }" bash -c 'echo "Hello World!"'<br />
have some bash</code><br />
<br />
Yes, this means that if you can control the content of an environment variable passed to bash <b>you can probably execute whatever code you want</b>. It comes handy when you want to alter a script's behaviour without modifying the script itself.<br />
<br />
Possibilities are endless thanks to <a
href="http://rgeissert.blogspot.com/2013/08/a-bashism-week-function-names.html">bash's support for non-standard characters in function names</a>. Functions with slashes can also be exported, for example:<br />
<br />
<code>/sbin/ifconfig() {<br />
echo "some people say you should be using ip(1) instead" ;<br />
}</code><br />
<br />
<small>Are you into bug hunting? export exec='() { echo mount this ; }'</small><br />
Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-3939164541028317159.post-90098504007636070272013-09-25T02:30:00.000-05:002013-09-25T02:30:02.010-05:00A bashism a week: aliasesIn a response to my blogpost about <a href="http://rgeissert.blogspot.com/2013/08/a-bashism-week-function-names.html">bashisms in function names</a>, reader <i>Detlef L</i> pointed out in a comment that <a href="http://rgeissert.blogspot.com/2013/08/a-bashism-week-function-names.html?showComment=1377118845813#c7078155885728855921">aliases allow non-standard characters</a> in their names, contrary to functions. They could then be used to, for example, set an alias of the run-parts(1) command (cf. the blog post).<br />
<br />
Aliases indeed allow characters such as commas ( , ) to be used in the alias name. However, aliases are an extension to the POSIX:2001 specification and are therefore bashisms. Moreover, the characters set defined by POSIX <a href="http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_10">does not include dashes</a>.<br />
<br />
Last but not least, aliases belong to the list of shell features that are usually "disabled" when the shell is run in non-interactive mode. I.e.<br />
<br />
<code><br />
$ bash <<EOF<br />
alias true=false; <br />
if true; then echo alias disabled; else echo alias enabled; fi<br />
EOF<br />
<br />
<b>alias disabled</b><br />
$ bash -i <<EOF # force interactive mode<br />
alias true=false; <br />
if true; then echo alias disabled; else echo alias enabled; fi<br />
EOF<br />
<br />
$ alias true=false; <br />
$ if true; then echo alias disabled; else echo alias enabled; fi<br />
<b>alias enabled</b><br />
$ exit<br />
</code><br />
<br />
To add to the fun of different behaviours, other shells <i>always</i> expand aliases.<br />
<br />
If you decide to play with aliases you should note one thing: they are only enabled from the line <b>after</b> the definition. E.g. note the difference below<br />
<code><br />
$ dash -c 'alias foo="echo foo"; foo'<br />
dash: foo: not found<br />
$ dash -c 'alias foo="echo foo";<br />
foo'<br />
foo<br />
</code><br />
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-3939164541028317159.post-74867380756449503942013-09-23T02:30:00.000-05:002013-09-24T15:53:53.415-05:00Worse than no supportYou are in need of support and you go ask in project <i>x</i>'s forums (mailing list, online board, etc.) and get something worse than no support:<br />
<br />
Responses from an incompetent with plenty of time and lots of <a href="https://en.wikipedia.org/wiki/Fear,_uncertainty_and_doubt">FUD</a> to spread.<br />
<br />
Now that we have "<a href="http://www.enricozini.org/2013/debian/umarells/">umarell</a>" thanks to Enrico Zini and other Italian folks, we need a name for the above.<br />
<br />
<small>Apologies to some readers who might be disappointed by this post. I don't like calling people names but I've seen too many of the above in less than two hours not to be tired.</small>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3939164541028317159.post-81508922228409161312013-09-18T02:30:00.000-05:002013-09-18T02:30:04.000-05:00A bashism a week: testing stringsThe bashism of this week deals again with tests. How do you compare two strings to tell which one goes before or after the other in the alphabet in a shell script?<br />
<small>(also know as lexicographic comparison)</small><br />
<br />
If you are familiar with perl and the relationship between its comparison operators and that of shell scripts, you would probably write the test as follows:<br />
<br />
<code><br />
$ test bar '<' foo<br />
$ test foo '>' bar<br />
</code><br />
<br />
And yes, that would work, but not with all shells. I'm afraid to tell you that the < and > comparison operators are <b>not</b> required by the POSIX:2001 specification and are, therefore, bashisms.<br />
<br />
What does this have to do with perl? well, the shell way is the inverse of the perl way.<br />
What? In Perl you test the equality of two numbers with '==', in shell you use '-eq'; in perl the equality of strings is 'eq', in shell it is '='. In shell scripts you can compare two numbers with -gt (test 1 -gt 0) while in perl the equivalent comparison is with > (1 > 0).<br />
<br />
So in this case the perl way is "bar lt foo" and based on the above the shell way should be "bar < foo". However, care must be taken when using such operators in shell scripts. Since < and > are used for redirections in shell scripts, one must quote them even when using bash. An alternative is to use the [[ special test function of bash which alters the shell syntax.<br />
<br />
This time I didn't write a function to portably (or "somewhat portably") replace such comparisons. Feel free to share your solution in the comments, with bonus points if you come up with a solution without using external commands.<br />
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3939164541028317159.post-76991975995683337122013-09-04T02:30:00.000-05:002013-09-04T02:30:03.213-05:00A bashism a week: tilde expansionDid you know that you can get a user's home directory with the "~<i>username</i>" tilde expansion? You probably do, but how about other tilde expansions?<br />
<br />
Thanks to a few bashisms you can make your script even more difficult to read by using "<i>~+</i>" to get $PWD, and "<i>~-</i>" to get $OLDPWD.<br />
<br />
Are you using bash and want to access the directories stack created when using the <a href="http://rgeissert.blogspot.com/2013/02/a-bashism-week-pushing-and-poping.html">pushd and popd bashisms</a>? The <i>~i</i> (where i is an integer) expansion can give you that. It gives you forward (~+<i>i</i>) and backward (~-<i>i</i>) access to the directories stack.<br />
<br />
But beware, if the directories stack is smaller than the number you used, there won't be any expansion.<br />
<br />
When using tildes in shell scripts, make sure you quote to avoid unwanted expansions. Note that the posh shell in wheezy and older do support those non-POSIX expansions.<br />
<br />
<small>in the first examples the tilde is quoted for easier reading; the expansion doesn't occur if the tilde is quoted.</small>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-3939164541028317159.post-67499793608975160542013-08-28T05:20:00.001-05:002013-08-28T05:20:30.345-05:00Scheduling mistakeSometimes people make mistakes and things don't go as expected. Eventually, they find out and say <i>oops</i>.<br />
<br />
The next blog post for the <i>a bashism a week</i> series was scheduled for publishing on next Wednesday due to a mistake from my side. Sorry about that! given that it's a bit late today, let's better take a break this week.<br />
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3939164541028317159.post-12764289435713266922013-08-21T02:30:00.000-05:002013-08-21T05:22:34.694-05:00A bashism a week: function namesThe bashism of this week is easy to hit when overriding the execution of a command with a shell function. Think of the following example scenario:<br />
<br />
Replacing the <a href="http://manpages.debian.net/cgi-bin/man.cgi?query=yes">yes</a>(1) command with a shell function:<br />
<pre>$ exec /bin/bash
$ type -t yes
file
$ yes() { while :; do echo ${1:-y}; done; }
$ type -t yes
function
</pre><br />
Now every time <i>yes</i> is called the above-defined shell function will be called instead of /usr/bin/yes.<br />
<br />
Apply the same principle to replace the <a href="http://manpages.debian.net/cgi-bin/man.cgi?query=run-parts">run-parts</a>(8) command with the following overly-simplified shell function:<br />
<br />
<pre>$ run-parts() {
if [ "$1" = "--test" ]; then
shift;
simulate=true;
else
simulate=false;
fi;
for f in "$1"/*; do
[ -x "$f" ] && [ -f "$f" ] || continue;
case "$(basename "$f")" in
*[!a-zA-Z0-9_/-]*)
:
;;
*)
if $simulate; then
echo $f;
else
$f;
fi
;;
esac;
done
}
$ type -t run-parts
function
</pre><small>(note the use of <a href="http://rgeissert.blogspot.com/2013/02/a-bashism-week-negative-matches.html">negative matching</a>)</small><br />
<br />
It also works as expected. However, when running it under a shell that only supports the function names required by the POSIX:2001 specification <b>it will fail</b>. One such shell is dash, which aborts with a "<i>Syntax error: Bad function name</i>", another is posh which aborts with a "<i>run-parts: invalid function name</i>".<br />
<br />
If you ever want to have function names with dashes, equal signs, commas, and other unusual characters make sure you use bash and ksh-like shells (and keep that code to yourself). Yes, you can even have batch-like silencing of stdout with <pre>function @ { "$@" > /dev/null ; }</pre><br />
Update: there were missing quotation marks in the example <i>@</i> function.<br />
Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-3939164541028317159.post-22880479185189842652013-08-14T02:30:00.000-05:002013-08-14T02:30:05.073-05:00A bashism a week is backAfter a while without posts on the <a href="http://rgeissert.blogspot.com/2012/12/introducing-bashism-week.html">a bashism a week</a> series, it is coming back!<br />
<br />
Next week, at the usual time and day of the week, the series of blog posts about bashisms will be back for at least one more month. <a href="http://rgeissert.blogspot.com/feeds/posts/default">Subscribe via Atom</a> and don't miss any post and check <a href="http://rgeissert.blogspot.com/search/label/bashisms">all the previous posts</a>.<br />
<br />
The <i>a bashism a week</i> series cover some of the differences between <b>bash</b> and the behavior of other shells, and the requirements by the POSIX standard regarding shell scripting. Or put simply: they are a guide to common bashisms, allowing you to identify them and avoid their use for a more compatible and portable code.<br />
<br />
Happy reading!Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3939164541028317159.post-50035717292672889892013-07-31T02:30:00.000-05:002013-07-31T02:30:04.318-05:00Ten years-old ebook readerI own a ten years-old ebook reader.<br />
<br />
Is it a smartphone?<br />
It has features that make it pretty much like one, except that it can't make phone calls. So no. (However, I dare to say that making phone calls is one of the least used features of smartphones nowadays. Perhaps in the feature smartphones won't even be phones anymore, due to atrophy.)<br />
<br />
What is it then?<br />
It is a Sony CLIÉ, a <a href="http://www.amazon.com/gp/product/B00008L3HI/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B00008L3HI&linkCode=as2&tag=producttag-20" rel="nofollow">PEG-SJ22</a> to be more precise. A PDA running Palm OS 4.1 that I'm now using as an ebook reader. To my surprise, the <a href="https://en.wikipedia.org/wiki/Plucker">Plucker</a> and <a href="https://en.wikipedia.org/wiki/iSilo">iSilo</a> readers still exist and at least the latter seems somewhat alive - there is even a version for Android.<br />
<br />
Nowadays there are ebook readers with electronic paper displays, wifi or 3G connectivity, and other features but they all come down to the same thing: an ebook reader. Truth be told, the technology is quite old. In 2004, a year after the release of the PEG-SJ22, Sony also released the <a href="http://asia.cnet.com/sony-librie-ebr-1000ep-e-book-reader-62100002.htm">LIBRIé EBR-1000EP</a> in Japan, an ebook reader with a 6" electronic paper display. A few years later is was released in the US as the <i>Sony Reader</i>.<br />
<br />
Certainly, there have been advances since those devices were first released, but I have yet to see something that is really innovating. This year we are back to wrist watches, which were first released more than ten years ago - and one of them <a href="http://news.cnet.com/2100-1040-254658.html" title="Computer wrist watch running linux">even ran linux</a>.<br />
<br />
Netbooks also had devices like the <a href="http://www.amazon.com/gp/product/B0000AQFZ9/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B0000AQFZ9&linkCode=as2&tag=producttag-20" rel="nofollow">PEG-UX50</a> as their ancestor.<br />
<br />
And if you were thinking about shoes, you've arrived late: the <a href="http://www.digibarn.com/collections/weirdstuff/computer-tennis-shoes/index.html" rel="noref">Puma RS</a> already had some chips in them, and the <i>Adidas 1</i> were also sported a few years ago. World, it's time to innovate.<br />
<br />
<img src="http://ir-na.amazon-adsystem.com/e/ir?t=producttag-20&l=as2&o=1&a=B00008L3HI" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><img src="http://ir-na.amazon-adsystem.com/e/ir?t=producttag-20&l=as2&o=1&a=B0000AQFZ9" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3939164541028317159.post-61177797707093820212013-07-09T02:30:00.000-05:002013-07-09T02:30:02.653-05:00Explaining segmentation fault errorsWant to fix that <span title='segmentation fault'>segfault</span> you keep hitting or was reported to you? The first step is to understand the error message you get.<br />
<br />
So you have a message like the following:<br />
<i>segfault at bfea3fec ip 080ee07e sp bfea3fa0 error 6</i><br />
<br />
You might already know that <i>ip</i> means <i>instruction pointer</i> and <i>sp</i> means <i>stack pointer</i> and as such the addresses that follow them are the values in those registers. But what does the <b>error number</b> mean?<br />
<br />
The error number, or code, actually gives you a better explanation of what the cause of the segfault is. The number's bits are flags describing the error and are architecture-dependent. For x86/x86_64 I just wrote an online converter/decoder that you can use to <a href="http://rgeissert.blogspot.com/p/segmentation-fault-error.html">explain the segfault error code</a>.<br />
<br />
As an example, the above error code is explained as:<br />
<pre>The cause was a user-mode write resulting in no page being found.</pre><br />
And the common <i>error 4</i>:<br />
<pre>The cause was a user-mode read resulting in no page being found.</pre>(also known as a null pointer dereference).<br />
<br />
Enjoy.Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-3939164541028317159.post-26794904849329493782013-06-12T01:30:00.000-05:002013-06-12T01:30:04.589-05:00Service update: 5 million a dayAfter the release of Debian wheezy traffic jumped to about <a href="http://rgeissert.blogspot.com/2013/05/almost-one-million-requests-per-day.html">1 million requests per day</a>, but as the weeks have passed by traffic has continued to increase to 5 million requests every day.<br />
<br />
Even though it is a new record for <a href="http://http.debian.net" title="Debian mirrors redirector">the redirector</a> it can not yet be compared to openSUSE.org's 20-40 million on their <a href="http://www.mirrorbrain.org/">mirrorbrain</a> instance. Let's see how long it takes to get there.<br />
<br />
User adoption has increased but it has yet to become the <a href="http://lists.debian.org/debian-devel/2013/06/msg00150.html">default mirror</a> in several places.<br />
Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-3939164541028317159.post-7944152444865678942013-06-05T01:30:00.000-05:002013-06-05T01:30:00.574-05:00The "let the tool do the work" updateOver the last few weeks I've been making several changes to <a href="http://http.debian.net" title="Debian mirrors redirector">http.debian.net</a> to detect mirrors that don't follow Debian's mirroring guidelines and end up causing problems to the end users. The changes will mean less hash mismatches and similar errors.<br />
<br />
As I wrote back in December, the redirector is becoming <a href="http://rgeissert.blogspot.com/2012/12/nicer-but-stricter.html">nicer but also stricter</a>. Some of the changes I recently made caused over 30 mirrors to be completely disabled from the redirector. This is not ideal and I don't like having to disable mirrors. They are contributions afterall.<br />
<br />
The only thing I can do, and can't stress enough, is encourage people to use an up to date ftpsync script (available at project/ftpsync/ on every mirror) to mirror Debian.<br />
It takes care for you of all the little but important things needed. Really. A mirror that uses ftpsync is easier for the administrator to properly configure, and provides a consistent mirror for the benefit of the users.<br />
<br />
Speaking of ftpsync, <a href="http://lists.debian.org/debian-mirrors-announce/2013/05/msg00000.html">there is a new version</a>! If you use ftpsync please upgrade it as soon as possible.<br />
<br />
Other improvements are on their way. Contributions are welcome (if you like refactoring, there's quite a bit of explicitly-redundant code in check.pl that should now give a better idea of the way it needs to be refactored.)Unknownnoreply@blogger.com1