<?xml version="1.0" ?>

<kc>


<headquote>
<a href="http://www.slug.org.au/"><img src="../ktimages/slug.gif" height="105"
width="150" border="0" alt="SLUG Logo"/><br />Check out the Sydney Linux User
Group</a>!
</headquote>


<title>SLUG Pearls</title>
<author contact="mailto:jdub@slug.org.au">Jeff Waugh</author>
<issue num="7" date="16 Jul 2000 00:00:00 -0800" />


<section
  title="Quickies">

<mention>Conrad Parker</mention>
<mention>Angus Lees</mention>
<mention>Dean Hamstead</mention>
<mention>Anand Kumria</mention>

<ul>

<li><p>Steven Kerr wanted to know how to assign the Unix time (number of
seconds since January 1, 1970) to a shell variable. Jim Clark replied:</p>

<quote who="Jim Clark">
<p>how about:</p>

<p><tt>%  secs=`date +%s`<br /><br />

%  echo $secs<br />
963141142</tt></p>

<p>Note: %s is a non-standard extension (found in the gnu version of
date(1)), so it may not work on other *nixes.</p>
</quote>
</li>

<li><p>Dean Hamstead wanted to know how to escape quotes in a string
destined for mySQL using Perl. Omar Kilani referred him to the 'quote'
function and the documentation for DBI.</p></li>

<li><p>After a mostly offtopic thread regarding Homer quotes, Andrew Shipton
successfully brought us back to the topic, asking, <quote who="Andrew
Shipton">ObSLUG: Upgrading from RH5.2 to Debian.  Anyone know of a better
way than blowing it away and starting again?</quote>. Anand Kumria Googled
the question, and referred Andrew to a <a
href="http://www.debian.org/Lists-Archives/debian-devel-9812/msg00728.html">Debian
mailing list post</a> and an <a
href="http://www.geocities.com/ResearchTriangle/3328/rh5todeb-howto.txt">older
HOWTO</a> on Geocities, whilst Angus Lees recalled a 'Phoenix' RPM that may
or may not be under development anymore.</p>
</li>

<li><p>David was having some troubles satisfying the dependencies between the
RedHat python and tkinter packages, <quote who="">Am I committing a
fundamental stupidity?  I am trying to update python to the latest version, and
I've got into a cyclic dependency problem. Is this a RedHat problem, or just
me?</quote> After much tooing and froing, Conrad Parker finally recommended
putting every package to be installed on the RPM command line.  This worked
once David figured out all the required packages, plus we learned one of the
prime tenets of using RedHat: Never use rpm -i, always use rpm -U.</p>
</li>

</ul>

</section>

<section
  title="I Like Your Old Stuff Better Than Your New Stuff"
  subject="Wht the Old Junk in New *nix?"
  archive="http://www.progsoc.uts.edu.au/lists/slug/2000/July/msg00604.html"
  posts="14"
  startdate="11 Jul 2000 00:00:00 -0800"
  enddate="11 Jul 2000 00:00:00 -0800">

<mention>Angus Lees</mention>
<mention></mention>
<mention>Herbert Xu</mention>
<mention>Matthew Dalton</mention>

<p>Jeff Waugh asked:</p>

<quote who="Jeff Waugh">
<p>Disclaimer: Please don't flame the newbie.</p>
  
<p>With recent discussions about termcaps, etc. I started thinking about the
relative obscurity of all these configuration details...</p>

<p>Why do they still exist? How *practically* useful are they anymore?</p>

<p>Is it a case of backwards/cross compatibility, and that no one has the
urge or flameproof suit strong enough to come up with new
specifications?</p>

<p>Obviously, this is a question coming from someone used to "New" *nix,
primarily as a desktop machine or standalone server, and the simplicity that
comes from using the average distro (Slackware excluded, yes).</p>

<p>I'm not debating the use of plain text files for configuration, merely
the gumpf that's grown over certain areas, and shows little sign of being
cut back.</p>
</quote>

<p>A couple of SLUGgers agreed, citing needless complexity and legacy
issues. Matthew Dalton complained specifically about his trouble with some
terminals.</p>

<p>Angus Lees commented that distributions should conform to a standard, and
hoped that they offered soluions similar to Debian's keyboard policy.
Herbert Xu posted a <a
href="http://www.progsoc.uts.edu.au/lists/slug/2000/July/msg00630.html">copy
of the policy</a>, also mentioning that Debian regards non-conformity to
this as a bug.</p>

<p>There were many suggestions as to why the terminal configuration system
was useful, including the use of ancient terminals and the 'screen' program.
Finally, Jamie Honan gave an interesting rundown of the old terminal
systems, and how the current systems came to be:</p>

<quote who="Jamie Honan">
<p>The thing is, there was no possible way you could encapsulate all
terminal / keyboard behaviour in a table.</p>

<p>Here are some examples from the O'Reilly book:</p>

<p>kdl1 = delete line<br />
xenl = newline glitch<br />
ked = clear to end of screen</p>

<p>There are glitch parameters, support for copy, move, redo, resume, next
object and select keys. Support for standout, blinking, hidden display
characteristics. Any terminal manufacturer could invent any wierd
feature.</p>

<p>I even invented one myself. I made a PC terminal emulation that would
display, buffer but not transmit normal keystrokes (e.g.  A-Z, 0-9) until a
special keystroke was entered (e.g. RETURN, TAB or cursor key). Why? Well a
server dealing with hundreds of terminals only had to respond once per field
instead of each character per field.</p>

<p>But perhaps Jeff is right. Perhaps it's anachronistic to be carrying
around a personal museum / shrine to the past glories of terminals.</p>

<p>Perhaps we can keep a VT100 terminfo / termcap 'fooler' for apps that
need it. For those who really need to know about the Hazeltine tilde glitch
(hz in terminfo and termcap), well you can roll your own.</p>

<p>Nah, lets keep terminfo. The past deserves respect, it contains the keys
of the future. Practicality? I'd vote yes.</p>

</quote>

</section>


<section
  title="Window Managers and Core Dumps"
  archive="http://www.progsoc.uts.edu.au/lists/slug/2000/July/msg00634.html"
  posts="5"
  startdate="11 Jul 2000 00:00:00 -0800"
  enddate="12 Jul 2000 00:00:00 -0800">

<mention></mention>

<p>After solving his network card troubles, Peter Rundle asked some
additional questions about how to start different window managers when
starting X, and what core files were used for. Jeff Waugh answered his
questions regarding window manager startup:</p>

<quote who="Jeff Waugh">

<p>Are you using xdm or gdm, which make X start when you boot, or do you run
startx from the command line?</p>

<ul>
<li>If you're using gdm, you can choose "Xsession" from the sessions menu,
and that will run whatever is in your .xsession file</li>

<li>If you're using xdm, it runs whatever is in your .xsession file [*], so
change it.</li>

<li>If you're using startx, .xinitrc [*] does the dirty work.</li>
</ul>

<p>In each case, you'll want to run your window manager on the last line with
exec, eg.</p>

<blockquote>exec lwm</blockquote>

<p>If you want to run any other software on startup, put them before that
line, and background them using the ampersand, &amp;.</p>
</quote>

<p>Whilst Angus Lees gave a quick guide to "How Cool is GDB?"</p>

<quote who="Angus Lees">
<p>just because i think core dumps are _way_ underrated:</p>

<p>gdb &lt;executable&gt; &lt;corefile&gt;</p>

<p>at the gdb prompt, type things like "where" to find out where the program
crashed.</p>

<p>if the executable has debugging symbols compiled in, you'll get a pretty
backtrace (and be able to look at variable values, etc). if it doesn't, then
you'll just get assembly and the odd cryptic linker symbol (which may still
be useful).</p>

<p>i think its a real shame that core dumps are turned off (the size is
limited to 0. see ulimit(1), limit(1) or getrlimit(2)) by default on most
linux distros. core dumps are an excellent way of catching those
one-in-a-million unreproducible bugs, without slowing your program down with
debugging code.</p>

<p>and if you find a stray core file, "file core" will usually be able to
tell you what program produced the core dump</p>
</quote>

</section>


<section
  title="More Debian: auto-apt"
  subject="auto-apt"
  archive="http://www.progsoc.uts.edu.au/lists/slug/2000/July/msg00672.html"
  posts="11"
  startdate="12 Jul 2000 00:00:00 -0800"
  enddate="12 Jul 2000 00:00:00 -0800">

<mention></mention>

<p>Angus Lees forwarded the announcement of an interesting new development
in Debian's automation capabilities, auto-apt. Summarised by the maintainer,
auto-apt <quote who="Fumitoshi Ukai">checks file access of programs running
within auto-apt environments, and if the program try to access a file of
uninstalled package, auto-apt will install the package containing the file,
by using apt-get.</quote></p>

<p>Whilst Nick compared auto-apt's functionality to Office 2000's
"install-on-demand" feature, other SLUGgers were more devious in their
attraction to the idea. Jeff Waugh wondered, <quote who="Jeff Waugh">What's
one command I could try to invoke that would install the *most* software in
one hit? Emacs not allowed. ;)</quote></p>

<p>Trent Swift listed a few Debian packages with extensive dependencies,
notable task-gnome-games, and task-japanese. Jeff Waugh responded:</p>

<quote who="Jeff Waugh">
<p>so if I installed a very basic console woody, and tried running
gnome-tetris, I'd end up with a fully configured desktop system? And they
wonder why we LOVE Debian?!?</p>
</quote>

<p>Angus Lees cooked up another dastardly scheme:</p>

<quote who="Angus Lees">
<p>the cheating way would be:</p>

<p><tt>lynx -source<br />
http://mirror.aarnet.edu.au/debian/dists/potato/Contents-i386.gz\<br />
 | gunzip | sed -n '33,$s!^\([^[:space:]]*\).*$!/\1!p' | xargs ls</tt></p>


<p>otherwise.. here's a really evil way (if i understand how auto-apt works
correctly):</p>

<p><tt>mv /usr/doc /usr/doc.bak<br />
while ls /usr/doc; do<br />
&#160;&#160;&#160;mv /usr/doc/* /usr/doc.bak<br />
done<br />
mv /usr/doc.bak /usr/doc</tt></p>
</quote>

</section>


<section
  title="SLUGgers Still Capable of Political Debate"
  subject="name server weirdness"
  archive="http://www.progsoc.uts.edu.au/lists/slug/2000/July/msg00694.html"
  posts="24"
  startdate="12 Jul 2000 00:00:00 -0800"
  enddate="13 Jul 2000 00:00:00 -0800">

<mention></mention>

<p>Danny Yee asked a quick BIND question, and the list was soon embroiled in
arguments about Free Software. Hard to believe? Russell Davies commented
that if Danny was using BIND for a caching nameserver, he might want to try
<a href="http://dnscache.com/">dnscache</a>. Danny, who is well-known
amongst SLUGgers as a strong proponent of Free Software replied that
dnscache wasn't Free. Russell disagreed, <quote who="Russell Davies">it
certainly is free software. I suggest you review your facts.</quote> Danny
replied:</p>

<quote who="Danny Yee">

<p>The are conditions on binary distributions<br />
http://cr.yp.to/djbdns/dist.html</p>

<p>My understanding (assuming this si the same deal as qmail, etc.) is that
these don't cover just anything calling itself djbdns, but anything derived
from the same code base.</p>

</quote>

<p>Russell did not believe this to be the case:</p>

<quote who="Russell Davies">
<p>Your understanding is in serious question.</p>

<p>From www.gnu.org,</p>

<p>``Free software'' refers to the users' freedom to run, copy, distribute,
study, change andimprove the software. More precisely,
it refers to four kinds of freedom, for the users of the software:</p>

<ul>
<li>Access to the source code.</li>
<li>The freedom to run the program, for any purpose.</li>
<li>The freedom to study how the program works, and adapt it to your
needs.</li>
<li>The freedom to redistribute copies so you can help your neighbor.</li>
<li>The freedom to improve the program, and release your improvements to the
public, so thatthe whole community benefits.</li>
</ul>

<p>Dan's software satisfies all these criteria.</p>

<p>If you are complaining that you can't hack this software and release it
_under the same name_, then you better remove all that GNU software you have
as well.</p>
</quote>

<p>Herbert Xu - one of SLUG's resident Debian developers - took exception to
this point, commenting that Debian would still be using it otherwise.</p>

<quote who="Herbert Xu">
<p>Crap.  If all we had to do was to change the name, then qmail would've
been part of Debian ages ago and we wouldn't have spent the huge amount of
effort to convert our main server away from qmail.  Read this from <a
href="http://cr.yp.to/qmail/dist.html">http://cr.yp.to/qmail/dist.html</a>:</p>

<blockquote>If you want to distribute modified versions of qmail (including
ports, no matter how minor the changes are) you'll have to get my approval.
This does not mean approval of your distribution method, your intentions,
your e-mail address, your haircut, or any other irrelevant information. It
means a detailed review of the exact package that you want to
distribute.</blockquote>

<p>I don't see anything about allowing the distribution of a modified qmail
under a different name.</p>

<p>And if you still think this is OK, well just ask yourself what a
distributor can do when the next security hole comes along and Dan is not in
a position of releasing a patch (on a safari trip, perhaps?).</p>
</quote>

<p>Russell:</p>

<quote who="Russell Davies">
<p>_next time_ ? There has never been a security hole in any of Dan's
software to the best of my knowledge and he regularly offers cash rewards at
their release for any found. However, for the sake of argument, let's assume
a security hole is found.</p>

<p>In that event, simple -- I'd probably hit www.qmail.org where there is a
wealth of knoweldge, users and patches. Note in particular 'User-Contributed
Software for Qmail'. There is nothing stopping somebody writing a patch that
others can obtain and apply to the official source distribution -- a simple
patch; make and make install would probably solve the problem.  When Dan
returns from his hypothetical safari, he would probably decide whether or
not to include it in the next release (which are very few and far between I
might add).</p>

<p>Your scenario isn't really a big deal.</p>
</quote>

<p>Herbert commented that, <quote who="Herbert Xu">It's not a problem for an
individual with the skills.  But for a distribution this is not good
enough.</quote></p>

<p>Angues Lees asked, <quote who="Angus Lees">so does that mean that when a
distro (for example: debian) decides they want to patch the source to change
a default path, or something - they can't distribute the resultant binaries?
(without renaming it to "dnscache-debian" or some other
shenanigans)</quote>. To this, Danny Yee commented on further problems with
the licensing:</p>

<quote who="Danny Yee">
<p>My concern is that it's not even clear that they would be allowed to do
the latter - ie, change the binaries *and* the name.</p>

<p>I understand that DJB is a genius and no one should ever want to modify
his code or change the way he does things, but I feel that people should do
the right thing because they choose to, not because they are compelled
to.</p> 

<p>And what happens if Bernstein is run over by a bus tomorrow?  In the
absence of any formal licence covering his code, who knows what the
executors of his estate could do.</p>
</quote>

<p>The debate was continued off-list.</p>

</section>


<section
  title="Prioritising Network Traffic with 2.2"
  subject="Priority of network traffic"
  archive="http://www.progsoc.uts.edu.au/lists/slug/2000/July/msg00734.html"
  posts="18"
  startdate="13 Jul 2000 00:00:00 -0800"
  enddate="14 Jul 2000 00:00:00 -0800">

<mention></mention>
<mention>Jill Rowling</mention>
<mention>James Morris</mention>

<p>Joshua Marshall asked whether it was possible, <quote who="Joshua
Marshall">using IPChains or other means, to prioritise network traffic over
a link?</quote></p>

<quote who="Joshua Marshall">

<p>The link is 33k and is easily flooded by people accessing files etc
across this link.</p>

<p>I would like to put something on there so that the telnet sessions are
given the highest priority, and everything else only allowed to transmit
once the telnet packets have been sent out. We can control both ends of the
link so priority on transmit at each end would do the trick (I don't think
you can put priority on receive, you just get it as it comes - am I
correct?)</p>

<p>Any info would be appreciated, we're using kernel 2.2.16</p>

</quote>

<p>Jill Rowling hoped that by giving the telnet daemon a higher priority
than normal, the sessions would be better off. DaZZa pointed out that
'nicing' them would only prioritise the process, not the link.</p>

<p>Herbert Xu offered a number of tips, summarised here:</p>

<quote who="Herbert Xu">
<p>It should be done automatically with the TOS bit. Though you might have
to adjust the txqueuelen paramter of your PPP interface. Of course this is
assuming the routers on both ends of your link are Linux or at least
prioritise according to the TOS bit.</p>

<p>...if your application does not set the TOS bit correctly, you need to
either fix it or use ipchains to rewrite the TOS bit.</p>

<p>If you're using Linux, and haven't enables QoS, then this is the default.
The code is in net/sched/sch_generic.c.</p>

<p>[The list of TOS flags can be set are from] /usr/include/linux/ip.h:</p>

<p><tt>#define IPTOS_LOWDELAY          0x10<br />
#define IPTOS_THROUGHPUT        0x08<br />
#define IPTOS_RELIABILITY       0x04<br />
#define IPTOS_MINCOST           0x02</tt></p>
</quote>

<p>James Morris suggested the <a
href="http://www.linux.org.au/LDP/HOWTO/IPCHAINS-HOWTO-4.html">'Manipulating
the Type of Service' section</a> in the IP Chains HOWTO as a good guide to
this feature.</p>

<p>Angus Lees strongly recommended that Joshua check out iproute2:</p>

<quote who="Angus Lees">
<p>it does all this and is in the 2.2 kernels (you just need the two
user-space tools) (apt-get install iproute)</p>

<p>basically, iproute2 (the command is just "ip") does away with
ifconfig, route, interface aliases and tunnelling, and is *much* more
flexible. addresses are separated from devices, devices from routes,
etc. and each can have a list, not just one. tc is the traffic shaping  
stuff, and you can choose just about any criteria to match traffic,
and then about 10 different algorithms for what to do with it.</p>
</quote>

<p>In addition to the documentation provided with the tools, Angus offered
<a
href="http://www.ds9a.nl/2.4Networking/">http://www.ds9a.nl/2.4Networking/</a>
as a good reference.</p>

</section>


<section
  title="Thank a Hacker"
  subject="Add some karma, send a ThankYou"
  archive="http://www.progsoc.uts.edu.au/lists/slug/2000/July/msg00838.html"
  posts="5"
  startdate="14 Jul 2000 00:00:00 -0800"
  enddate="14 Jul 2000 00:00:00 -0800">

<mention></mention>

<p>Jamie Honan posted a nice Friday morning warm fuzzy for us all:</p>

<quote who="Jamie Honan">
<p>Thought for the day:</p>

<p>Why not send a thank you email to someone who has written some
free software you use and like.</p>

<p>Something simple like: "I use XYZ a lot, just thought you'd like to know".</p>

<p>Or: "I couldn't get by without PQR. Thank You".</p>
   
<p>You feel good, they feel good, and so on ....</p>

<p>Doesn't take a lot of effort. Do it now.</p>
</quote>

<p>Howard Loundes joked that yes, it must be Friday, <quote who="Howard
Loundes">but in the spirit of Jamie's suggestion, Thanks to Sluggers for
answering questions.</quote></p>

<p>Awwwwwwww...</p>

<p>Ken Yap agreed, and mentioned that, <quote who="Ken Yap">Developers would
often like to know if you are using their software in some unusual situation.
It may even give them ideas for future directions.</quote></p>

</section>

</kc>
