tag:blogger.com,1999:blog-81993330202566979872024-03-13T20:07:04.899-07:00futzAnonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.comBlogger25125tag:blogger.com,1999:blog-8199333020256697987.post-66517827593749780832013-07-30T07:33:00.000-07:002013-07-30T07:33:31.307-07:00Python remote class for TAHI's v6eval engine.The TAHI v6eval Perl module for IPv6 compliance testing at one point included a bunch of 'remote' scripts to automate tasks on the target device under test (the NUT, or node under test).<br />
<br />
These scripts were always more like examples than set in stone automation and always required adjustment for the target device. The scripts used a assumed serial port connection via null modem to the target and Perl expect to check for the prompt, issue commands, etc..<br />
<br />
At work to automate the compliance testing, I wanted to use the out-of-band management port via ssh to issue commands, and to avoid long waits on reboot with just quick restarts of services etc, so I made my own remote interface that used this:<br />
<br />
It uses some other utils we've coded for keyswapping with the management host, a ssh remote wrapper, etc, that I won't provide here, but you can see how it works below.<br />
<br />
It uses v6eval's own configuration of tn.def and nut.def to provide all the connectivity,<br />
In tn.def:<br />
<br />
<br />
<ul>
<li>the 'RemoteDevice' option is re-used to provide an ssh ip address. </li>
<li>'RemoteMethod' is also defined to 'ssh' and although not parsed here could be easily expanded to switch different access methods based on that variable.</li>
</ul>
<br />
In nut.def:<br />
<br />
<ul>
<li>the 'User' option is used to provide username for ssh access.</li>
<li>the 'Password' option is used to provide the password for ssh access.</li>
</ul>
<div>
Of course 'System' is used by the engine to determine which scripts to execute in /usr/local/v6eval/bin/[system]</div>
<div>
<br /></div>
<div>
All options passed to each of the '.rmt' scripts are available when using the remote class ropt dictionary for easy consumption.</div>
<br />
<br />
<pre></pre>
<br />
#!/usr/bin/env python<br />
"""<br />
reboot.rmt<br />
reboots the NUT (via a quick reload)<br />
<br />
example invocation from the TAHI v6eval remote suite<br />
<br />
./reboot.rmt -u root -p default -d 192.168.1.1<br />
"""<br />
<br />
import remote<br />
import sys<br />
import time<br />
<br />
def reboot(argv):<br />
nut = remote.remote(argv)<br />
<br />
cmd = 'reload'<br />
<br />
rc = nut.runcmd(cmd)<br />
# maximum time needed for config reload<br />
time.sleep(90)<br />
<br />
if rc != 0:<br />
print "cmd remote command %s returned %d" % (cmd, rc)<br />
return nut.exitFail<br />
<br />
return nut.exitPass<br />
<br />
if __name__ == '__main__':<br />
sys.exit(reboot(sys.argv))<br />
<div>
</div>
<br />
<br />
<pre></pre>
<br />
# remote.py<br />
# python v6eval remote interface class<br />
<br />
import os<br />
import logging<br />
import tcutils.commandutils as cu<br />
<br />
from tcutils import logger<br />
from paramikoutils import keyswap<br />
<br />
DEBUG = bool(os.environ.get('DEBUG'))<br />
log = logger.stdout_logger('remote',<br />
level=logging.DEBUG if DEBUG else logging.INFO)<br />
<br />
class remote:<br />
"""v6eval remote interface class"""<br />
def __init__(self, argv):<br />
"""init remote class"""<br />
<br />
# options passed by v6eval<br />
#my $cmd = searchPath($rpath, $fname);<br />
# $cmd .= " -t $NutDef{System}" if $NutDef{System};<br />
# $cmd .= " -u $NutDef{User}" if $NutDef{User};<br />
# $cmd .= " -p $NutDef{Password}" if $NutDef{Password};<br />
# $cmd .= " -T $TnDef{RemoteCuPath}" if $TnDef{RemoteCuPath};<br />
# $cmd .= " -d $TnDef{RemoteDevice}" if $TnDef{RemoteDevice};<br />
# $cmd .= " -v $TnDef{RemoteDebug}" if $TnDef{RemoteDebug};<br />
# $cmd .= " -i $TnDef{RemoteIntDebug}" if $TnDef{RemoteIntDebug};<br />
# $cmd .= " -o $TnDef{RemoteLog}" if $TnDef{RemoteLog};<br />
# $cmd .= " -s $TnDef{RemoteSpeed}" if $TnDef{RemoteSpeed};<br />
# $cmd .= " -l $TnDef{RemoteLogout}" if $TnDef{RemoteLogout};<br />
# $cmd .= " $RemoteOption $opts @args";<br />
<br />
self.exitPass=0 # PASS<br />
self.exitIgnore=1 # Ignore (ex. initializeation script)<br />
self.exitNS=2 # Not yet supported<br />
self.exitWarn=3 # WARN<br />
self.exitHostOnly=4 # Host Only<br />
self.exitRouterOnly=5 # Router Only<br />
self.exitSpecialOnly=6 # Special Only<br />
self.exitExceptHost=7 # Except Host<br />
self.exitExceptRouter=8 # Except Router<br />
self.exitExceptSpecial=9 # Except Special<br />
self.exitSkip=10 # Skip<br />
self.exitTypeMismatch=11 # Type Mismatch<br />
#<br />
self.exitFail=32 # FAIL<br />
self.exitInitFail=33 # Initialization Fail<br />
self.exitCleanupFail=34 # Cleanup Fail<br />
# # 35 - 63: reserved for future use<br />
#<br />
self.exitFatal=64 # FATAL (terminate series of related tests)<br />
<br />
self.lastrc = 0<br />
self.laststdout = ""<br />
self.laststderr = ""<br />
<br />
self.ropt = { }<br />
self.ropt = self.parseargs(argv)<br />
<br />
# root user<br />
if '-u' in argv:<br />
self.user = argv[argv.index('-u') + 1]<br />
# root password<br />
if '-p' in argv:<br />
self.passwd = argv[argv.index('-p') + 1]<br />
# management ip<br />
if '-d' in argv:<br />
self.mgmt_ip = argv[argv.index('-d') + 1]<br />
<br />
# save the original options<br />
self.argv = argv<br />
keyswap.keyswap(self.mgmt_ip, self.user, self.passwd)<br />
<br />
def parseargs(self, args):<br />
"""find the foo=bar variables"""<br />
arg_dict = { }<br />
for arg in args:<br />
try:<br />
nom, val = arg.split('=')<br />
arg_dict[nom] = val<br />
except ValueError:<br />
pass<br />
<br />
return arg_dict<br />
<br />
def runcmd(self, cmd):<br />
"""run the command on the NUT"""<br />
(self.lastrc, self.laststdout, self.laststderr) = cu.runcmd_ssh(self.mgmt_ip, cmd)<br />
if self.lastrc > 0:<br />
log.error('command: %s FAILED %s' % (cmd, self.laststderr))<br />
return 1<br />
return 0<br />
<div>
</div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com0tag:blogger.com,1999:blog-8199333020256697987.post-12652168940685962502013-01-24T11:29:00.000-08:002013-01-24T11:29:08.418-08:00The sick and twisted world of KDE/konsole 4.8.4 from dbus<b>YUCK</b><br />
<div>
<br /></div>
<div>
For some reason, you have to <i style="font-weight: bold;">find yourself</i> when running from a konsole window now.<br />
<br />
So the code for opening tabs now has to:<br />
<br />
<ul>
<li>Grab a list of all the fricking windows (getWindowId()/getWindows() below) to find my own id.</li>
<li>Grab a list of all the fricking sessions (getSessions() below)</li>
<li>Open a new tab</li>
<li>Grab the session list AGAIN and compare it to find the one we just opened.</li>
<li>Only then are you able to send a command to that tab.</li>
</ul>
<div>
Hope you can read some shell script, because this is almost too painful to explain.</div>
<b><br /></b></div>
<pre>#!/usr/bin/env bash
# konsole dbus functions
getWindows() {
windows=`qdbus org.kde.konsole /konsole org.freedesktop.DBus.Introspectable.Introspect |grep MainWindow | cut -d \" -f 2`
echo ${windows}
}
getSessions() {
sessions=`qdbus org.kde.konsole /Sessions org.freedesktop.DBus.Introspectable.Introspect |grep "node name" | cut -d \" -f 2`
echo ${sessions}
}
getWindowId() {
windows=`getWindows`
for i in $windows
do
id=`qdbus org.kde.konsole /konsole/$i org.kde.KMainWindow.winId`
if [ "${WINDOWID}" -eq "$id" ]; then
echo $i
fi
done
} </pre>
<pre>findNewSession() {
old="$@"
new=`getSessions`
for t in $new; do
grep -q $t <(echo $old)
if [ "$?" -eq "1" ]; then
echo $t
fi
done
}</pre>
<pre>sshopentabs () {
boxlist=$1
box_name=$2
comm='ssh -o StrictHostKeyChecking=no -o CheckHostIP=no -o UserKnownHostsFile=/dev/null'
slot=1
for i in $boxlist
do
sessions=`getSessions`
echo ${KONSOLE_DBUS_SERVICE}
newtab
j=`findNewSession $sessions`
if [ "${box_name}" -eq "" ]; then
renametab ${j} $i
else
renametab ${j} "${box_name} slot ${slot}"
fi
sendtab ${j} "${comm} root@${i}"
let slot=$slot+1
done
return ${j}
}</pre>
<pre>newtab () {
id=`getWindowId`
dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply /konsole/$id org.kde.KMainWindow.activateAction string:"new-tab"
}
renametab () {
sessionno=$1
tabname=$2
session="/Sessions/${sessionno}"
dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply ${session} org.kde.konsole.Session.setTabTitleFormat int32:0 string:"$tabname"
dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply ${session} org.kde.konsole.Session.setTabTitleFormat int32:1 string:"$tabname"
dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply ${session} org.kde.konsole.Session.setTitle int32:1 string:"$tabname"
}
sendtab () {
sessionno=$1
cmd=$2
session="/Sessions/${sessionno}"
dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply ${session} org.kde.konsole.Session.sendText string:"$cmd^M"
}
closetab () {
dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply ${KONSOLE_DBUS_SESSION} org.kde.konsole.Session.sendText string:"exit^M"
}
</pre>
Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com0tag:blogger.com,1999:blog-8199333020256697987.post-3259309571476218822012-02-15T08:55:00.000-08:002012-02-16T08:15:03.390-08:00Patch for TAHI's v6eval on FreeBSD after the switch to utmpxAfter FreeBSD made the switch to utmpx, which you can read about here:<br />
<br />
<a href="http://thread.gmane.org/gmane.os.freebsd.current/122932">http://thread.gmane.org/gmane.os.freebsd.current/122932</a><br />
<br />
Certain programs, like the <a href="http://www.tahi.org/">TAHI organizations</a> <a href="http://www.tahi.org/release/">v6eval</a> package will fail to compile. This means the recent 9.0-RELEASE of FreeBSD will no longer work out of the box. This really only required a minor change to get it working. I've published a patch here.<br />
<br />
<a href="http://dl.dropbox.com/u/18896363/v6eval-3.3.1-utmpx.patch">v6eval-3.3.1-utmpx.patch</a><br />
<br />
Enjoy!<br />
<br />
<b>EDIT</b>: ed@ kindly worked up a functional patch that works with utmpx's binary format, this might explain why sometimes your child processes are left hanging after a run:<br />
<a href="http://80386.nl/pub/v6eval.txt" style="font-family: sans-serif; font-size: small; line-height: 18px; text-align: justify;">http://80386.nl/pub/v6eval.txt</a><br />
<br />
Thanks Ed!<br />
<div style="text-align: justify;">
<span style="font-family: sans-serif; font-size: x-small;"><span style="line-height: 18px;"><br /></span></span></div>Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com2tag:blogger.com,1999:blog-8199333020256697987.post-71449040087852984022012-02-10T09:18:00.000-08:002012-02-10T09:18:26.655-08:00Linux patches for TAHI v6eval 3.3.2In my previous, ancient post <a href="http://wundermark.blogspot.com/2008/09/running-tahi-v6eval-suite-on-linux.html">running-tahi-v6eval-suite-on-linux</a> I put out some information for posterity on converting v6eval to run on Linux systems. Most Linux systems have moved on since three years ago and so has the v6eval suite.<br />
<br />
I've kept up with porting the suite @$work to do automatic, unattended evaluation and reporting of our product, but I've neglected to keep it nice and clean for the rest of world.<br />
<br />
Seeing that quite a few searches end up on that old post, I've cleaned it up and present a new patch for use against <a href="http://www.tahi.org/">TAHI</a> <a href="http://www.tahi.org/release/v6eval/v6eval-3.3.2.tar.gz">v6eval-3.3.2</a> . You can download the patch <a href="http://dl.dropbox.com/u/18896363/v6eval-3.3.2-linux.patch"><b><i>HERE</i></b></a>.<br />
<br />
<b>A few points about the patch and the v6eval suite:</b><br />
<br />
<ul><li>To apply, extract the v6eval-3.3.2 package somewhere cd to v6eval-3.3.2 and run patch -p1 < (path to patch filel)</li>
<li>v6eval <i style="font-weight: bold;">is not 64-bit clean, </i>although it compiles fine, pktbuf will dump core. I have not investigated or fixed this yet. The TAHI maintainers are aware that it's not 64-bit capable. Try to compile only in a 32bit environment. In addition, I have not tested with -m32 compiles, if they work, let me know.</li>
<li>This compiles on a fairly recent Gentoo and a recent version of basically Centos/Redhat.(gcc 4.4.5).</li>
<li>Read the <b>INSTALL.linux</b> file for hints</li>
<li>Since the patch creates new files, some of these files may need permissions fixes, mainly build.sh and lorder need execute permissions.</li>
<li>Use build.sh to build, or incorporate the environment variables.</li>
<li>Getting a valid pmake is the hardest part, however Gentoo made it easy:</li>
</ul><div><div><pre></pre></div><div>* sys-devel/pmake</div><div> Latest version available: 1.111.3.1</div><div> Latest version installed: 1.111.3.1</div><div> Size of files: 289 kB</div><div> Homepage: http://www.netbsd.org/</div><div> Description: BSD build tool to create programs in parallel. Debian's version of NetBSD's make</div><div> License: BSD</div></div><div></div><ul><li>The patch tries to do the minimum against the distributed code to get it to work with one exception.</li>
<li>The patch contains my custom pcap filter enhancement for the tn.def file:</li>
</ul>Normally the engine only supports filtering for just ipv6 packets with a single line in the tn.def file:<br />
<br />
<pre>filter ipv6
</pre><br />
<br />
Since the automation harness at work has a busy network, I've modified the filter expression to be capable of any valid bpf filter, which means you need use similar syntax to tcpdump, so <br />
<pre>filter ipv6</pre>becomes <pre>filter ip6</pre>.<br />
<br />
I use something similar to the following example to restrict tests to only the NUT, using the NUT's mac address:<br />
<br />
<pre>filter ether host aa:bb:cc:dd:ee:ff and ip6
</pre><br />
<br />
REF:<br />
<a href="http://dl.dropbox.com/u/18896363/v6eval-3.3.2-linux.patch">http://dl.dropbox.com/u/18896363/v6eval-3.3.2-linux.patch</a>Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com1tag:blogger.com,1999:blog-8199333020256697987.post-31367576792043876702011-09-12T15:33:00.000-07:002013-03-18T08:35:23.990-07:00pidgin sipe win32 compiles w/ pidgin 2.10 (libpurple 2.10.0 & sipe-1.12.0)UPDATE: The sipe project appears to have official builds now:<br />
<br />
<a href="http://sourceforge.net/projects/sipe/files/sipe/">http://sourceforge.net/projects/sipe/files/sipe/</a><br />
<br />
UPDATE/EDIT: <i>As some of you have figured out from the config.h blurb below, this is actually pidgin-sipe 1.12.0. I just re-upped to dropbox with a name change on the .zip. I guess I was trying to brain dump to this blog too fast so I wouldn't forget the steps to compiling it.</i><br />
<br />
Well I did it.
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsp04AxmrHglYdypcHwFb4IlHKwZ9cMP_RAywL4OBgXhOzb2CfZZ0WotzbJDusTVZyzCyYzVGjJqhxyNZZags7ylIEwqH2uOTzmNbgiOXmuN5k5dVlqtk-JXM0xIEcofqWKK9uHjGmnQ-r/s1600/win32-pidgin-sipe-1.12.0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsp04AxmrHglYdypcHwFb4IlHKwZ9cMP_RAywL4OBgXhOzb2CfZZ0WotzbJDusTVZyzCyYzVGjJqhxyNZZags7ylIEwqH2uOTzmNbgiOXmuN5k5dVlqtk-JXM0xIEcofqWKK9uHjGmnQ-r/s320/win32-pidgin-sipe-1.12.0.jpg" width="306" /></a></div>
<br />
<br />
What a mess it is to compile some of these programs on win32.<br />
<br />
I followed the basic instructions on compile pidgin and got that all working. These instructions are actually pretty good. They are begging to be automated similar to a FreeBSD port build:<br />
<br />
<a href="http://developer.pidgin.im/wiki/BuildingWinPidgin">http://developer.pidgin.im/wiki/BuildingWinPidgin</a><br />
<br />
Then I tried to follow the pidgin sipe wiki entry for windows:<br />
<br />
<a href="http://sourceforge.net/apps/mediawiki/sipe/index.php?title=Windows_Build">http://sourceforge.net/apps/mediawiki/sipe/index.php?title=Windows_Build</a><br />
<br />
These are a bit out of date. The good thing is that if you're building post 2.7.0 then most dependencies are already there.<br />
<br />
There were a couple things broken at this point preventing success:<br />
<br />
<ul>
<li>one file was missing an include for glib.h -- already fixed in the sipe git rep</li>
<li>you need gmime installed in your pidgin-devel/win32-dev directory (linked on the sipe wiki)</li>
<li>you need the rest of libiconv installed in your pidgin-devel/win32-dev directory (grab libiconv-1.13.1-1-mingw32-dev.tar.lzma from the mingw site)</li>
<li>libxml2 needed the libs renamed to libxml2-2.lib in their win32-dev directory.</li>
<li>sipe-core.c wouldn't compile with several entries from config.h which are only generated when running configure. Since running configure correctly in this setup would be a veritable pain, I managed to get what it wanted figured out:</li>
</ul>
<div>
config.h</div>
<div>
<pre></pre>
</div>
<div>
<div>
#define PACKAGE_NAME "pidgin-sipe"</div>
<div>
#define PACKAGE_TARNAME "pidgin-sipe"</div>
<div>
#define PACKAGE_VERSION "1.12.0"</div>
<div>
#define PACKAGE_STRING "pidgin-sipe 1.12.0"</div>
<div>
#define PACKAGE_BUGREPORT "https://sourceforge.net/tracker/?atid=949931&group_id=194563"</div>
<div>
#define PACKAGE_URL "http://sipe.sourceforge.net/"</div>
<div>
#define SIPE_TRANSLATIONS_URL "https://www.transifex.net/projects/p/pidgin-sipe/r/mob/"</div>
</div>
<br />
<br />
<br />
Save this as config.h and plop it in src/core and delete the #ifdef HAVE_CONFIG_H stanza in sipe-core.c to allow it to be included. This will allow sipe_core_about() to compile.<br />
<br />
Successful compile. Yay. <br />
<br />
After this I copied libxml2-2.dll and libiconv-2.dll to my pidgin-2.10.0/win32-install-dir directory and src/core/libsipe.dll to the win32-install-dir/plugins directory. Viola, it worked.<br />
<br />
You can download it here <a href="http://dl.dropbox.com/u/18896363/pidgin-sipe-1.12.0.zip">win32 libpurple 2.10.0 pidgin-sipe-1.12.0</a>Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com1tag:blogger.com,1999:blog-8199333020256697987.post-2034951700142795412011-07-07T07:46:00.000-07:002011-07-07T07:46:50.444-07:00moved from livejournal...<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">Not sure that it requires any explanation (all you have to do is look at livejournal's front page). </span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">Used <a href="http://google-blog-converters-appengine.googlecode.com/">google-blog-converters</a> to grab all the posts and convert them to blogger.xml. Then used the import feature here on the settings tab. Worked great!</span><br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">I then promptly deleted my livejournal account.</span>Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com0tag:blogger.com,1999:blog-8199333020256697987.post-49097451974732467502011-04-11T03:51:00.000-07:002011-07-07T07:35:17.055-07:00konsole tabs with dbus in kde4.6In the continuing automation saga with konsole at my job, KDE has come far enough with the dbus interface in 4.6 to allow me to bring up tabs again and perform actions in them with a script. <br/><br/>For this I created the following shell functions:<br/><br/><pre><br/># konsole dbus functions<br/>newtab()<br/>{<br/> dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply /konsole/MainWindow_1 org.kde.KMainWindow.activateAction string:"new-tab"<br/>}<br/><br/>renametab()<br/>{<br/> sessionno=$1<br/> tabname=$2<br/> session="/Sessions/${sessionno}"<br/> dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply ${session} org.kde.konsole.Session.setTabTitleFormat int32:0 string:"$tabname"<br/> dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply ${session} org.kde.konsole.Session.setTabTitleFormat int32:1 string:"$tabname"<br/> dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply ${session} org.kde.konsole.Session.setTitle int32:1 string:"$tabname"<br/>} <br/><br/>sendtab()<br/>{<br/> sessionno=$1<br/> cmd=$2<br/> session="/Sessions/${sessionno}"<br/>" dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply ${session} org.kde.konsole.Session.sendText string:"$cmd<br/>}<br/><br/>closetab()<br/>{<br/> dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply ${KONSOLE_DBUS_SESSION} org.kde.konsole.Session.close<br/>}<br/></pre><br/><br/><br/>In scripts that I want automation, I include these functions:<br/><br/><pre><br/># konsole functions<br/>. ~/bin/kons-fn.sh<br/></pre><br/><br/><br/>I can then open a whole bunch of tabs at once and send them a command:<br/><br/><pre><br/><br/>PORTS=( 2022 2021 )<br/><br/>SESSIONS="<br/>A_FU<br/>B_BAR<br/>"<br/><br/>command="telnet ${CONSOLE_SERVER}"<br/><br/>j=1<br/>index=0<br/>for i in ${SESSIONS}<br/>do<br/> newtab<br/> let index=$j-1<br/> let j=$j+1<br/> renametab $j $i<br/> sendtab $j "${command} ${PORTS[${index}]}"<br/>done<br/><br/>closetab<br/>exit 0<br/></pre><br/><br/><br/>However I haven't gotten this to work from starting 'konsole -script' from a shortcut. Launching a script like this creates an infinite number of tabs launching the script in sequence. Very weird stuff.<br/><br/>For now, just start a konsole session and launch the script within the first tab. As you can deduce from the functions, it has to be the first tab you launch konsole with.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com0tag:blogger.com,1999:blog-8199333020256697987.post-66805582984678477642009-12-03T06:25:00.000-08:002011-07-07T07:35:17.055-07:00tbird on FreeBSDI recently moved to using thunderbird on freebsd and away from pine. I did this mainly because there are just too many oddly formatted html emails floating around work from people who are chained to lookout and don't know any better.<br/><br/>My pine config is still active and available but serves now only as a remote-in, or console bound backup mailer.<br/><br/>The first problem I encountered with t-bird is the helper apps. The list comes up blank from the installed freebsd port and there are no helper apps listed and no way to activate them. This was unlike pine where a url-viewer could be defined. With t-bird I discovered after much web digging if you have Freebsd/KDE/qt without gtk helper infrastructure, you'll need to define the url viewer for firefox. You do this under the advanced config editor, or in prefs.js:<br/><br/><pre><br/> user_pref("network.protocol-handler.app.ftp", "/usr/local/bin/firefox3");<br/> user_pref("network.protocol-handler.app.http", "/usr/local/bin/firefox3");<br/> user_pref("network.protocol-handler.app.https", "/usr/local/bin/firefox3");<br/></pre><br/>For anything else, under pine/alpine you'd be editing your .mailcaprc, but under t-bird you'll need mimeTypes.rdf and <A HREF="https://addons.mozilla.org/en-US/thunderbird/addon/4498">Mime Edit</A>. It was ridiculous how hard it was to find this functionality and for a long time I was hand editing the Mimetypes.rdf to add helper apps.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com1tag:blogger.com,1999:blog-8199333020256697987.post-46605947892487975972009-11-06T01:41:00.000-08:002011-07-07T07:35:17.056-07:00convertingIn my ancient post on <a href="http://othermark.livejournal.com/2654.html">Scripting up some tabs with konsole in kde</a> was for 3.5 era and dcop. I had a lot of scripts that would just blast open windows in a konsole session, automatically connecting to my various machines in the remote computer lab. Depending on what I was doing, I could just exec a sript from the desktop to connect and use a suite of machines in a tabbed konsole session.<br/><br/>With dbus, and the 4.x kde upgrade I lost all that. Recently I've started trying to convert the old stuff to dbus.<br/><br/>For example, setting tab titles:<br/><br/><pre><br/>$ dbus-send --session --dest=$KONSOLE_DBUS_SERVICE --type=method_call --print-reply /Sessions/35 org.kde.konsole.Session.setTitle int32:1 string:"title"<br/>method return sender=:1.88 -> dest=:1.187 reply_serial=2<br/></pre><br/><br/>It unfortuantely took me a long time to figure this out. One, since dbus-send spits out an incorrect error when the parameters are wrong. Instead of 'incorrect parameter,' you get 'no such method.' This makes sense from a OO standpoint since 'no such method' exists with 'those parameters'' <br/><br/><br/><pre><br/>$ dbus-send --session --dest=$KONSOLE_DBUS_SERVICE --type=method_call --print-reply /Sessions/35 org.kde.konsole.Session.setTitle<br/>Error org.freedesktop.DBus.Error.UnknownMethod: No such method 'setTitle' in interface 'org.kde.konsole.Session' at object path '/Sessions/35' (signature '')<br/></pre><br/><br/>dbus-send supports all sorts of types, and from introspection, I knew setTitle needed a int and a string. dbus-send supports all types of things int16, int32, etc..<br/>Without looking at the source, you just kind of have to guess which types to send.<br/><br/><pre><br/>$ qdbus $KONSOLE_DBUS_SERVICE /Sessions/35<br/>method void org.kde.konsole.Session.close()<br/>method QByteArray org.kde.konsole.Session.codec()<br/>method QStringList org.kde.konsole.Session.environment()<br/>method bool org.kde.konsole.Session.flowControlEnabled()<br/>method int org.kde.konsole.Session.foregroundProcessId()<br/>method bool org.kde.konsole.Session.isMonitorActivity()<br/>method bool org.kde.konsole.Session.isMonitorSilence()<br/>method int org.kde.konsole.Session.processId()<br/>method void org.kde.konsole.Session.sendMouseEvent(int buttons, int column, int line, int eventType)<br/>method void org.kde.konsole.Session.sendText(QString text)<br/>method bool org.kde.konsole.Session.setCodec(QByteArray codec)<br/>method void org.kde.konsole.Session.setEnvironment(QStringList environment)<br/>method void org.kde.konsole.Session.setFlowControlEnabled(bool enabled)<br/>method void org.kde.konsole.Session.setMonitorActivity(bool)<br/>method void org.kde.konsole.Session.setMonitorSilence(bool)<br/>method void org.kde.konsole.Session.setMonitorSilenceSeconds(int seconds)<br/>method void org.kde.konsole.Session.setTitle(int role, QString title)<br/>method QString org.kde.konsole.Session.title(int role)<br/>method QDBusVariant org.freedesktop.DBus.Properties.Get(QString interface_name, QString property_name)<br/>method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString interface_name)<br/>method void org.freedesktop.DBus.Properties.Set(QString interface_name, QString property_name, QDBusVariant value)<br/>method QString org.freedesktop.DBus.Introspectable.Introspect()<br/></pre><br/><br/>Now onto, auto new tabs, title naming, and finishing the conversion.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com0tag:blogger.com,1999:blog-8199333020256697987.post-42156454081175771812009-11-06T01:01:00.000-08:002011-07-07T07:35:17.056-07:00Viewing /var/mail/username mail via thunderbirdDespite the really decrepit solutions you can find via Google, this is really easy.<br/><br/>1. create a "Movemail account"<br/>2. exit thunderbird<br/>3. cd ~/.thunderbird/{random}.default/Mail/localhost<br/>4. ln -sf /var/mail/{username} Inbox<br/>5. re-startup thunderbird<br/>6. read mail.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com0tag:blogger.com,1999:blog-8199333020256697987.post-40521143439042747292008-09-10T00:32:00.000-07:002011-07-07T07:35:17.056-07:00Running TAHI's v6eval suite on linux systemsFor many years I've been verifying our products stack at work with the <a href="http://www.tahi.org">TAHI organization's</a> v6eval engine and conformance test suite. One of the good and bad things about it is that it ran on FreeBSD -- pretty much only on FreeBSD.<br/><br/>This is because in the beginning this organization also were also sponsoring the KAME stack that you could drop right into the FreeBSD kernel sources and come out with a highly compliant ipv6 stack. Well, like anything that was FreeBSD only, that made it difficult to run in a company that did Linux development.<br/><br/>It wasn't long before people tasked with ipv6 verification and strapped by Linux systems began attempting to port it. IBM first posted a patch to get the v6eval engine running, and they did a really good job. That was posted on some long lost IBM site, but I had a copy and saved it off to help people out with their Linux systems here. This patch worked for a long time, as long as you didn't upgrade your old 2.2 or 2.4 based Linux system.<br/><br/>That patch I have archived here: <a href="http://kuoi.asui.uidaho.edu/~darkmark/tahi-linux/v6eval-2.2b6_linux.patch">v6eval-2.2b6_linux.patch</a><br/><br/>Recently the v6eval code was updated so that it would, a. run on modern FreeBSD systems, and b. compile on modern C++ compilers. This change was good, because it actually made the code more portable in a way. A while back on the TAHI users email list a patch was posted for Fedora 8. This patch was based on the Debian port and makes changes for Fedora 8. <br/><br/>That patch I have archived here: <a href="http://kuoi.asui.uidaho.edu/~darkmark/tahi-linux/v6eval_fedora8.diff">v6eval_fedora8.diff</a><br/><br/>Here's the original message from the list (you can pull it from the TAHI user archives if you choose -- I removed the emails addresses/names).<br/><br/><pre><br/>Date: Thu, 3 Apr 2008 13:31:45 -0700<br/>Subject: [users:00660] Re: Running Tahi on Linux<br/><br/>Here is the patch file for v6eval-3.0.12. Naturally the Tahi folk released a new version while I was building and verifying this patch file.<br/><br/>To use this, install the source from Tahi onto a Fedora 8 system and use the 'patch' command to apply this patch. You should then be able to use 'make' as before to<br/>build the system and 'make install' to install it in /usr/local/v6eval. Note that there are probably some dependancies that I'm glossing over. If you have problems<br/>building, let me know and I'll try to help you figure out what packages you need to install. The compiler does issue a lot of warnings about virtual functions that I<br/>didn't chase down, but the system seems to still work for me.<br/><br/>While this patch is meant to be applied to the base source as available from Tahi, I won't claim to be the one who did all the necessary modifications. I started<br/>with the tahi-linux package that according to the change log came from Kazuo Hiekata at IBM, then made changes to get it to compile on Fedora 8. My modification<br/>mostly involved the Makefiles. Guess I should add my name to the change log as well. Maybe next time.<br/><br/>Let me know if there are any issues.<br/></pre><br/><br/>The Fedora/Debian patch has some good bits but makes <b><i>WAY</i></b> too many unnecessary changes (reformatting code, rewriting Makefiles -- no big deal as it was someones rough personal copy posted to a list). When I ported to the automated test system here I did the following and was able to port it in just under a day:<br/><br/><ul><br/><li>extract the latest tarball<br/><li>grab 'pmake' package for my distribution and install (*BSD style make)<br/><li>grab 'byacc' package for my distribution and install (*BSD style yacc)<br/><li>apply minimalist 2.2b6 patch (read the instructions at the top of the patch file text)<br/><li>attempt to compile, and fix issues.<br/><li>pull very specific Linux OS related issues from Fedora/Debian patch over to extracted area.<br/></ul><br/><br/>That's it.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com0tag:blogger.com,1999:blog-8199333020256697987.post-1421907884834003802008-09-01T23:51:00.000-07:002011-07-07T07:35:17.057-07:00Patchiness of source controlI maintain several systems that I use day to day at my Job. One of these is a box I use for mostly code compilation that run Gentoo. The machine runs on a Tyan S2822-D, aka Thunder K8SD Pro. <br/><br/>When I decided to wipe this machine, which was running CentOS 3.x at the time, and drop Gentoo on it, I had been out of the Linux Kernel compilation game for quite a while. To make a long story short, I could not find the correct Kernel compile options (which have become inordinately numerous and bloated) in the 2.6 kernel to make this beast boot. The internet was very little use as to which ones I needed as well. After a couple days of free time spent trying to get the correct options, I gave up and used what did boot -- Gentoo's genkernel package.<br/><br/>Since I ply mostly with FreeBSD systems, having a 'GENERIC' kernel was very familiar to me, and I wrote it down as a 'good move overall' for the future. However, after many moons of regular 'emerge --sync' and 'emerge -vuD world' success stories, I came across a update that broke my genkernel compilation. I couldn't find any hints from internet groups or google searches. Last week I broke down and decided to fix the damn thing myself.<br/><br/>The error was fleeting to say the least and NOT logged in /var/log/genkernel.log. The compilation always died after the kernel compilation and during the busybox compilation. busybox in genkernel is 1.7.4 and gentoo's genkernel ships several patches to it. The compilation would die during this patch process. The error would appear only on the terminal and would not be logged:<br/><br/>patch: **** File shell/ash.c seems to be locked by somebody else under Perforce<br/><br/>There was a whole bunch of other failures that would make this scroll by, so unless you happened to troll the backbuffer you wouldn't catch this as the failure. To it's credit the gentoo genkernel process does mention the failure to patch as the key failure.<br/><br/>So I simulated the patch process, I ran 'tar -xjpf /usr/portage/distfiles/busybox-1.7.4.tar.bz2' in /var/tmp and ran 'patch -p1 < /usr/share/genkernel/patches/busybox/1.7.4/1.7.4-ash-timeout.diff' from the extracted directory. Sure enough, same error.<br/><br/>It turns out that since permissions are extracted by default with the tar command under the build process, patch has '-g' ON BY DEFAULT (from the manpage):<br/><pre><br/> -g num or --get=num<br/> This option controls patch's actions when a file is under RCS or SCCS control, and does not exist or is read-only and matches the default ver-<br/> sion, or when a file is under ClearCase or Perforce control and does not exist. If num is positive, patch gets (or checks out) the file from<br/> the revision control system; if zero, patch ignores RCS, ClearCase, Perforce, and SCCS and does not get the file; and if negative, patch asks<br/> the user whether to get the file. The default value of this option is given by the value of the PATCH_GET environment variable if it is set;<br/> if not, the default value is zero if patch is conforming to POSIX, negative otherwise.<br/></pre><br/><br/><br/>I was not amused. Anyway, I moved patch from /usr/bin/ to /usr/bin/patch.org and wrote this wrapper in /usr/bin/patch:<br/><br/><pre><br/>#!/bin/bash<br/>/usr/bin/patch.org -g0 $@<br/>exit $?<br/></pre><br/><br/>genkernel now compiles.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com1tag:blogger.com,1999:blog-8199333020256697987.post-48321275251039612852006-11-27T03:08:00.000-08:002011-07-07T07:35:17.057-07:00scans in a fogI have a scanjet 6300c at home, and for quite a while now, the glass on the innards side of the scanner has had a thin film or fog like quality to it. My wife was scanning pictures in and was complaining that the little 'all-in-one' scanner/printer/copier scans much better than the 6300. True enough the scans on the 6300c have a fog or haze to them (like when you have the contrast too high and the colors get less defined) . <br/><br/>Well, I'd been adverse to actually doing something about it since the manual and HP's online documentation stated you cannot clean the inside of the glass on the 6000 series. However, after a few web searches I found some third party evidence that you can open it up safely and clean the innards.<br/><br/>Sure enough, it was _extremely_ easy. Just pop the scan lid off (the manual shows you how so you can attach the page feeder), and then pop two screw covers on the front end of the glass top portion of the scanner. After that just take a torqx-10 head and undo 4 screws holding the lid on.<br/><br/>With the lid off, it's obvious you do not want to remove the glass since it's packed tightly with spacers that look like they would break easily if you tried. However, since it's just a hunk of plastic and glass, it's fairly easy to clean in place.<br/><br/>Cleaning it, according to the common sense instructions here:<br/><br/>http://h10025.www1.hp.com/ewfrf/wc/document?docname=bps02788&lc=en&cc=us&product=60104&dlc=<br/><br/>I discovered there was a thin sheen of oil residue on the bottom side of the glass. Apparently, I deduced, the manufacturing oil/grease used on the head, plastic belt, and gears evaporates from the heat of the lamp and gets plastered on the glass. This happens slowly over time, but will always affect picture quality.<br/><br/>After several thorough cleanings with some photo lens cleaner and cloth, both my wife and I could not see any residue or streaks on either side of the glass when held up to the light from several angles. <br/><br/>I then used some mini-vac attachments to suck up a very tiny amount of dust that had collected on the bottom (the chassis on this model is probably not as air tight as it could be) and then I used compressed air to blow off the mirrors and light. I then popped the scan glass back on, re-tightened the screws and replaced the scan lid.<br/><br/>Some test scans proved a world of difference in quality. I'll probably be maintaining a clean schedule with it now every three months.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com0tag:blogger.com,1999:blog-8199333020256697987.post-36987563071133446112006-09-22T07:28:00.000-07:002011-07-07T07:35:17.057-07:00peril vs perl[14:21] <darkmark> do you have your peril sensitive sunglasses?<br/>[14:21] <darkmark> (and your towel?)<br/>[14:26] <axly> damn. I only brought my perl sensitive sunglasses.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com0tag:blogger.com,1999:blog-8199333020256697987.post-65626530808910498122006-08-15T07:38:00.000-07:002011-07-07T07:35:17.058-07:00amazingly difficult to find 'getting a MAC address from a interface?' answer.I was trying to convert a piece of network software to FreeBSD. Unfortunately, even though the author quotes <br/>"should compile on any POSIX like OS," it doesn't (POSIX != LINUX). It should be obvious, when they drop things like:<br/><br/><pre><br/> if (ioctl (sock, SIOCGIFADDR, &ifr) < 0)<br/></pre><br/><br/>throughout the code.<br/><br/>So the above is from a section of code trying to obtain the MAC address on a interface. Doing this task <br/>on FreeBSD can be done through ioctl(), but is <A HREF="http://thread.gmane.org/gmane.os.freebsd.devel.hackers/25724/focus=25731">discouraged</A> by the developers. They encourage you to use getifaddrs(). <br/><br/>This strange and wonderful function grabs all sorts of information from the interface list, however, a couple of things <br/>are not obvious about it's use. If you really want to play arround with IF_LINK type addresses on the interfaces returned <br/>you need to be using sockaddr_dl not just sockaddr. Overloading sockaddr with magic casting is the new pink these days and <br/>thats what's required. It confused me at first since the manpage has:<br/><br/><pre><br/> struct ifaddrs *ifa_next; /* Pointer to next struct */<br/> char *ifa_name; /* Interface name */<br/> u_int ifa_flags; /* Interface flags */<br/> struct sockaddr *ifa_addr; /* Interface address */<br/> struct sockaddr *ifa_netmask; /* Interface netmask */<br/> struct sockaddr *ifa_broadaddr; /* Interface broadcast address */<br/> struct sockaddr *ifa_dstaddr; /* P2P interface destination */<br/> void *ifa_data; /* Address specific data */<br/></pre><br/><br/>for the structure.. same with /usr/include/ifaddrs.h. It turns out copying sa_data of sa_len from your friendly <br/>struct sockaddr does not give your the ethernet address from ifa_addr. :( :( :( :(.<br/><br/>Too make a long story short:<br/><br/><pre><br/>/* getmac.c -- retrieve the mac address from a interface name */<br/>#include <stdio.h><br/>#include <sys/types.h><br/>#include <sys/socket.h><br/>#include <net/if_dl.h><br/>#include <ifaddrs.h><br/><br/>int main(int argc, char ** argv)<br/>{<br/> struct ifaddrs *ifaphead;<br/> unsigned char * if_mac;<br/> int found = 0;<br/> struct ifaddrs *ifap;<br/> struct sockaddr_dl *sdl = NULL;<br/><br/> if (argc < 2)<br/> {<br/> fprintf(stderr,"usage:\n");<br/> fprintf(stderr,"\t %s <interface name>\n",argv[0]);<br/> exit(1);<br/> }<br/><br/> if (getifaddrs(&ifaphead) != 0)<br/> {<br/> perror("get_if_name: getifaddrs() failed");<br/> exit(1);<br/> }<br/><br/> for (ifap = ifaphead; ifap && !found; ifap = ifap->ifa_next)<br/> {<br/> if ((ifap->ifa_addr->sa_family == AF_LINK))<br/> {<br/> if (strlen(ifap->ifa_name) == strlen(argv[1]))<br/> if (strcmp(ifap->ifa_name,argv[1]) == 0)<br/> {<br/> found = 1;<br/> sdl = (struct sockaddr_dl *)ifap->ifa_addr;<br/> if (sdl)<br/> {<br/> /* I was returning this from a function before converting<br/> * this snippet, which is why I make a copy here on the heap */<br/> if_mac = malloc(sdl->sdl_alen);<br/> memcpy(if_mac, LLADDR(sdl), sdl->sdl_alen);<br/> }<br/> }<br/> }<br/> }<br/> if (!found)<br/> {<br/> fprintf (stderr,"Can't find interface %s.\n",argv[1]);<br/> if(ifaphead)<br/> freeifaddrs(ifaphead);<br/> exit(1);<br/> }<br/><br/> fprintf (stdout, "%02X%02X%02X%02X%02X%02X\n",<br/> if_mac[0] , if_mac[1] , if_mac[2] ,<br/> if_mac[3] , if_mac[4] , if_mac[5] );<br/><br/> if(ifaphead)<br/> freeifaddrs(ifaphead);<br/> <br/> exit(0);<br/>}<br/></pre>Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com3tag:blogger.com,1999:blog-8199333020256697987.post-63909813979490875652006-08-09T07:36:00.000-07:002011-07-07T07:35:17.058-07:00command line new tabs in konquerorThe following is a simple shell script using the KDE dcop client to open new tabs in konqueror (or a new instance of konqueror if it's not running). I use this from pine's url-viewers setting to launch new tabs with a url contained in a email.<br/><br/><pre><br/>#!/bin/sh<br/><br/>KONQ_WIN=`dcop konq* | head -1`<br/><br/>if [ "$KONQ_WIN" = "" ]; then<br/> /usr/local/bin/konqueror $1 &<br/>else<br/> NEW_TAB=`dcop $KONQ_WIN konqueror-mainwindow#1 action newtab`<br/> dcop $NEW_TAB activate<br/> dcop $KONQ_WIN konqueror-mainwindow#1 openURL $1<br/>fi<br/>return 0<br/></pre>Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com2tag:blogger.com,1999:blog-8199333020256697987.post-2932119302949332402006-07-10T07:39:00.000-07:002011-07-07T07:35:17.058-07:00fun with MSI, ACPI, and freebsd.Last two weeks I had been working on and off on a problem related to ACPI and some 1u servers using MSI-9618 motherboards. After booting freebsd, I couldn't get the second NIC to work at all, it turns out after looking at 'vmstat -i' that em0 and em1 where sharing an interrupt:<br/><br/><pre><br/># vmstat -i<br/>interrupt total rate<br/>irq3: sio1 52807402 55<br/>irq4: sio0 1604 0<br/>irq14: ata0 36 0<br/>irq16: em0 em1+ 2527378 2<br/>irq19: uhci1+ 86991 0<br/>cpu0: timer 1886077214 2000<br/>cpu1: timer 1886076861 2000<br/>Total 3827577486 4058<br/></pre><br/><br/>From past experience I knew this was from poor resource assignment from the BIOS when ACPI isn't enabled. So I built and installed the acpi.ko modules and installed it. These are webware 1185s from pogolinux. The chassis manual that comes with it labels them as P1-103 series and a part number as MS-9218 1U rackmounts.<br/><br/>Then when I booted, right after it should be switching to multi-user, it appeared to hang. I enabled ALT_BREAK_TO_DEBUGER in the kernel and tried again, except the keycode for break to debugger did nothing. I posted about the hang on the freebsd-acpi list with no response. Then out of hand I tried sshing to the box... it worked! So it wasn't really hung, just the serial console was unresponsive.<br/><br/>Now looking closer at the dmesg I realized the resources for sio0 and sio1 were wrong! sio0 was getting 0x2F8 and sio1 was getting 0x3F8 when it should be the other way around. I rechecked the BIOS settings, everything was ok. I downloaded a new BIOS from the MSI taiwan site that stated the fix was for 'redhat 4' installs. That didn't work. <br/><br/>I posted to freebsd-acpi again with what I knew. This time I got a <A HREF="http://article.gmane.org/gmane.os.freebsd.devel.acpi/2606">reply</A> and after some back and forth, I generated a new <A HREF="http://kuoi.asui.uidaho.edu/~darkmark/msi-9618-fixed.asl">.asl</a> file that would probe sio0 and sio1 in the correct order! Now all my interrupts are assigned correctly:<br/><br/><pre><br/>[root@pogo-1 ~]# vmstat -i<br/>interrupt total rate<br/>irq1: atkbd0 6 0<br/>irq3: sio1 13587145 55<br/>irq4: sio0 1243 0<br/>irq14: ata0 36 0<br/>irq16: em0 uhci3 3237 0<br/>irq17: em1 21 0<br/>irq19: uhci1+ 66550 0<br/>cpu0: timer 485520843 2000<br/>cpu1: timer 485520575 2000<br/>Total 984699656 4056<br/></pre><br/><br/>And everything seems to be working great, although my post's problem according to the resulting discussion on freebsd-acpi seems to be more common than imagined!Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com0tag:blogger.com,1999:blog-8199333020256697987.post-72273611056875205072006-04-20T06:12:00.000-07:002011-07-07T07:35:17.058-07:00http compressionOne of the things I also use regularly at work is <a href="http://www.gnu.org/software/wget/index.html#introduction">wget</a>. In order to work on compression I needed a tool that would recursively spider a web site and had the appropriate features, but would also support <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html">compression</a>. At the time, nothing out there supported this, so a year ago or so I finished a patch to <a href="http://www.gnu.org/software/wget/index.html#introduction">wget</a> to add compression.<br/><br/>You can check out the latest version of wget using the subversion repository outlined <a href="http://www.gnu.org/software/wget/wgetdev.html#development">here.</a> Apply this patch from the top directory and as long as your OS has <a href="http://www.zlib.net/">zlib</a> support, then you should be able to use the '-z' switch this patch adds to request compressed files from a webserver.<br/><br/><a href="http://kuoi.asui.uidaho.edu/~darkmark/w-get-zlib-04202006.patch">wget-zlib-04202006.patch</a><br/><br/>Here's an example how a 39K download turns into a 10K download with compression, and downloads in half the time.<br/><br/><pre><br/>$ ./wget http://172.16.17.1/index.html<br/>--13:22:32-- http://172.16.17.1/index.html<br/>Connecting to 172.16.17.1:80... connected.<br/>HTTP request sent, awaiting response... 200 OK<br/>Length: 39599 (39K) [text/html]<br/>Saving to: `index.html'<br/><br/>100%[=======================================>] 39,599 --.-K/s in 0.005s<br/><br/>13:22:32 (8.39 MB/s) - `index.html' saved [39599/39599]<br/><br/>$ ./wget -z http://172.16.17.1/index.html<br/>--13:22:39-- http://172.16.17.1/index.html<br/>Connecting to 172.16.17.1:80... connected.<br/>HTTP request sent, awaiting response... 200 OK<br/>Length: 10546 (10K) [text/html]<br/>Saving to: `index.html.1'<br/><br/>100%[=======================================>] 10,546 --.-K/s in 0.002s<br/><br/>13:22:39 (5.62 MB/s) - `index.html.1' saved [10546/10546]<br/><br/>$ diff index.html index.html.1<br/>$ echo $?<br/>0<br/></pre>Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com4tag:blogger.com,1999:blog-8199333020256697987.post-60554815478606058682006-04-19T13:16:00.000-07:002011-07-07T07:35:17.058-07:00lighttpdIn my job, I deal with a lot of tcp traffic, esp http, and ipv6.<br/><br/>For awhile I've been using both <a href="www.eterna.com.au/bozohttpd/">bozohttpd</a> and Apache. <br/>I used bozohttpd because it's simple, light weight, command line driven and easy to hack on. The big win for bozohttpd was the fact you could drop it into inetd and let inetd take care of the ipv6 compliance side. However, bozohttpd is lacking in several useful features and in many cases is missing some standards compliancy -- so in those cases I used Apache. Everyone here tests with Apache, but I absolutely despise Apache's convoluted "do everything" configuration and setup. It can take me hours to remember, research and setup even simple changes (esp if it requires a missing module!). Compiling Apache can be a royal PITA... Basically, it's too flexible.<br/><br/>Recently I've taken a liking to <a href="http://www.lighttpd.net">lighttpd</a>. It's very fast, easily configurable, and restricted enough in it's feature set to allow easy module configuration. It only has one problem. You could use it for ipv6 and not ipv4 or vice versa. Common mistake really, people never take the time and effort to use sock storage structure and properly do a dual stack server, they try to 'hack' their ipv4 server into v6 with #ifdefs, etc. Bad bad bad. I digress.<br/><br/>Adjusting lighttpd to work on v4 and v6 in the same process was easy. Easy that is if you're using freebsd. <br/><br/><br/><pre><br/>sysctl net.inet6.ip6.v6only=0<br/></pre><br/><br/>Then set up lighttpd to serve v6 addressing, and you're set. This basically enables v4 compat ipv6 addressing like ::ffff:172.16.17.1, so all their #ifdef'd ipv6 only code still chomps on the numbers just fine and listening on :: still gets you v4 traffic.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com1tag:blogger.com,1999:blog-8199333020256697987.post-62868916058159544772005-11-30T09:20:00.000-08:002011-07-07T07:35:17.059-07:00scripting up some tabs in kde's konsole app<pre><br/>[root@moby bin]$ cat bipcons.sh<br/>#!/bin/sh<br/><br/>SESSIONS="<br/>d44<br/>co-04<br/>c62-29<br/>co-02<br/>co-05<br/>d84-1<br/>d84-2<br/>"<br/><br/>KONSOLE=`dcopclient $KONSOLE_DCOP`<br/>CURSESSION=$KONSOLE_DCOP_SESSION<br/>for A in $SESSIONS; do<br/>NEWSESSION=`dcop $KONSOLE konsole newSession $A`<br/>dcop $KONSOLE $NEWSESSION renameSession $A<br/># your command here on the next line!<br/>dcop $KONSOLE $NEWSESSION sendSession "console $A"<br/>done<br/>dcop $CURSESSION closeSession<br/></pre><br/><br/><br/>The above shell script I have saved to a icon on my kde desktop. The icon properties run this in the command section:<br/><br/>/usr/local/bin/konsole --script -e ~/bin/bipcons.sh<br/><br/>Basically it opens a new tab for each entry in $SESSIONS, assigns the tab name to that entry ($A) and then runs a command on that entry as well. In this example, the remote console app (http://www.conserver.com). Of course that app could be anything, like ssh.<br/><br/>Very useful stuff. Took me a long time to dig up this information on the web, so I'm posting it here for posterity.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com2tag:blogger.com,1999:blog-8199333020256697987.post-44817000727970248042005-02-22T04:25:00.000-08:002011-07-07T07:35:17.059-07:00Using APT to keep DeadRat 9 up to date.Here's a slightly out of date HOW-TO I wrote that has kept me somewhat sane when using RedHat 9 (DeadRat):<br/><br/>Keeping your RH9 box up to date with apt<br/>----------------------------------------<br/><br/>Apt, normally a base part of the debian Linux distrobution has been ported<br/>to RedHat and rpm. Apt makes it extremely easy to keep up to date with the<br/>latest fixes and packages from the official RedHat distribution. Apt also<br/>does all the dependancy checking for you. Thus keeping your installation<br/>sane as well as up to date. It will not let you install incompatible package<br/>sets.<br/><br/>- Start here:<br/> http://apt.freshrpms.net<br/><br/>- download the apt for RedHat 9 package.<br/><br/>- install the apt for RedHat 9 package:<br/><br/> rpm -Uhv apt-0.5.5cnc5-fr2.i386.rpm<br/><br/>- update the package list:<br/><br/> apt-get update<br/><br/> You can 'cron' this command if you like. Use the really quiet mode to <br/> prevent email unless there's an error. 'apt-get -qq update'<br/><br/>- upgrade your installed packages:<br/><br/> apt-get upgrade<br/><br/> You can also 'cron' this command. I prefer to use the 'download' only<br/> switch. This way I get a email report from std out about the packages<br/> that are ready to be updated. I can then manually do a 'apt-get update'<br/> at my convienance and resolve conflicts if they occur.<br/><br/> download only mode: 'apt-get -y -q -d upgrade'<br/><br/>- erase old 'out of date' packages from the local cache"<br/><br/> apt-get autoclean<br/><br/> You should cron this one, for a once a week operation.<br/><br/>- installing new packages and their dependancies via apt:<br/><br/> You have to know the package name first:<br/><br/> browse http://ayo.freshrpms.net/redhat/9/i386/ to find the packages available.<br/> (this pointer is stored in /etc/apt/sources.list and may update/change)<br/><br/> Once you find the package you want, install it.<br/><br/> apt-get install vim-X11<br/><br/> You don't need to specify the version, or the file name.<br/><br/>- checking on dependancies for available packages:<br/><br/> You can see the dependancy and package descriptions for packages in the <br/> local cache:<br/><br/> apt-cache showpkg vim-X11<br/><br/> Use this command to decide if it's worth installing, investigating what<br/> you're missing, etc..Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com1tag:blogger.com,1999:blog-8199333020256697987.post-8221337132794407332004-09-24T00:30:00.000-07:002011-07-07T07:35:17.059-07:00kde-3.3 on freebsd 6-currentwow, teh suck!<br/><br/>[root@adkinson245 root]$ konqueror<br/>konqueror: ERROR: Error in BrowserExtension::actionSlotMap(), unknown action : searchProvider<br/>ASSERT: "data->bitmap" in kernel/qbitmap.cpp (222)<br/>konqueror: ERROR: : couldn't create slave : Unable to create io-slave:<br/>klauncher said: Error loading 'kio_http'.<br/>konqueror:<br/>konqueror: ERROR: Error in BrowserExtension::actionSlotMap(), unknown action : searchProvider<br/><br/>No web browsing available. The http render component works in other components, so it's just the network protocol object that seems hosed. <br/><br/>I can't figure this one out, but a full rebuild of kde would probably fix it. These are using the <a href="http://rabarber.fruitsalad.org/">fruitsalad</a> builds.<br/><br/>This <a href="http://freebsd.kde.org/pipermail/kde-freebsd/2004-August/008870.html">thread</a> mentions the problem. But no real resolution.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com1tag:blogger.com,1999:blog-8199333020256697987.post-53748733786642864362004-03-05T01:18:00.000-08:002011-07-07T07:35:17.060-07:00More fun with freebsd-currentI was experiencing softupdate inconsistencies and actual data-loss in 4-stable on my main workstation which has a large 30gig EIDE drive on it. Turning off softupdates and disabling dma in -stable made most of the corruption go away, but it was still there.<br/><br/>I decided to upgrade the workstation to freebsd-current and see if ATANG would fix my problem. So far it has fixed the disk issue, but it broke my mouse. ums(4) is losing interrupts and the mouse is unusable. I have to attribute this to my chipset and the new interrupt code. I'm going to be playing around with different settings to try to get my usb trackball back, currently I'm recompiling with NO_MIXED_MODE to see if this might fix my issue. *cross fingers*<br/><br/>I notice that ULE still needs some work however, I experienced several instances while buildworld/buildkernel is humming in the background where apps never get slices or not enough slices to continue correctly (most visible with knode).<br/><br/>So far -current is fairly stable if I ignore the ums issue and use the trackball in ps/2 mode with the adapter.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com5tag:blogger.com,1999:blog-8199333020256697987.post-62391153964814928642003-11-21T04:24:00.000-08:002011-07-07T07:35:17.060-07:00I'm totally addicted...To natural selection (www.natural-selection.org). Thanks mike.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com0tag:blogger.com,1999:blog-8199333020256697987.post-74856218728329143342003-11-20T04:35:00.000-08:002011-07-07T07:35:17.060-07:00fun with -currentSo I have several boxes at work installed with 5.0. One particular box I was having trouble with inetd connections sending reset when the box was under a significant amount of httpd load. No problem, I just adjusted inetd to start with '-R0' and problem solved. <br/><br/>After I did this, it occurred to me that I could easily update the box to -current by NFS mounting /usr/src and /usr/obj from the machine I track -current on and run make installkernel, reboot, installworld, etc.. to get it up to date fairly quickly. I should have stopped myself right there.<br/><br/>At first make installkernel complained about this line in Makefile.inc1<br/><br/>745: (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101)<br/><br/>Which was really weird since ${BOOTSTRAPPING} is 0, not "0" and it's complaining about string comparisons. Oh well, I changed '<' to '!=' since it would accomplish the same thing. <br/><br/>Installkernel succeeded and I rebooted single user into the new kernel, remounted /usr/src and /usr/obj off the -current box and began to run makeinstallworld (after mergemaster -p of course). This is where things got ugly. The install died somewhere in in the middle of nowhere leaving me with no ld-elf.so.1 and half installed new DYNAMICROOT /bin, /sbin, etc... ARGHH!! I couldn't do anything that wasn't built into the shell at this point.<br/><br/>THANK GOD for a statically linked mountd. I was able to finally mount /rescue off of the -current box and proceed to copy just enough to selectively 'make install' certain portions of the tree! After it was fairly stable, I re-ran 'make installworld' and succeeded. I think NO_DYNAMICROOT=yo will be in the -current boxen's make.conf from now on.Anonymoushttp://www.blogger.com/profile/18275944998833595028noreply@blogger.com2