# MirBSD Weblog

## 28.10.2006 by tg@

I'm back, and we have libncursesw-5.5 as libcurses replacement in da tree. One of my teeth still aches, but the doctor will see after it on tuesday and pull the strings from the other wounds. (Yuck.)

Let's see when I can tend to the other projects… (someone want to take on wsconfig(8)?)

Today, I recompiled screen and mc, and made centericq (sort of) utf8 capable… enough for what I need.

## 24.10.2006 by tg@

After the odds and ends from last time, now the Health End: I'll not be available/online for a few days – I have an appointment at my dentist (ouch!) tomorrow, for 1½ hours. I'll be recovering at the best grandmother ever's place for a while afterwards.

Stuff like TeΧ above isn't off-topic, this is open for personal ramblings after all, dear Benny. But I must say we prefer non-bzip2'd, i.e. gzip(1)ped or compress(1)ed, distfiles (zip, lzh are even better, because bzip2 is dead slow and memory hungry), but for e.g. iceweasel, it's okay to use bzip2 distfiles because nobody's going to compile it, at least not on a machine below 2 GHz, anyway.

If I can concentrate at all, I've got a few projects I could work at during the next days. One of these is an ncursesw mirport (including a "wide" flavour for the lynx mirport), another would be to re-work the, at least i386, bootloader interna (see below). Also, I've got an idea, sorry Benny, how to do a new website for us, which I could code first, propose then. Maybe I'll hack a bit on it. It uses a totally different approach than both www and web modules.

Bootloader… yeah. A few ideas: make stuff like PBR/bootxx, and the two MBRs, shell scripts that install themselves, nuke installboot. We need a C language helper for looking up block numbers (for ffs) but e.g. CD-ROM or raw disc image installs can do without. I'll try to not add MirOS specifics, so it could be run on e.g. GNU/Linux too. Also, I want a micro-PBR which just loads another PBR from say, sector 15 of a CD-ROM, which fits into the first 128 bytes of the first sector, so it can coexist with a Sun disklabel. Then, the bootloader could determine by reading a sector from the disc whether it's El Torito or not, so we won't need mkisofs(8)' -boot-info-table option any more and can use an unified bootloader for Live-CD and Live-HDD ;-) boots. That one could, then, also make use of MBR partitions – for example so we have a "boot hd0a:/bsd" as usual, "boot hd0,3:/bsd" for MBR partition (that's the only way to boot off a FAT partition if the disklabel doesn't have a slice for that filesystem), "boot hd0,2,0:/bsd" for extended ones. A "machine partinfo" command to display MBR and disklabel entries would, of course, make sense and complete that all. Finally, if I get the new installboot(8) replacement to be endian-independent and to convert the sparc one as well, dual-boot CDs will be much easier. (The sparc stuff needs a fake disklabel, but we could even hardcode that, much like the hardcoded MBR for macppc.)

## Thoughts on MirPorts dependency handling

22.10.2006 by bsiegert@

While I was in the train today, I looked at some of the more arcane inner workings of MirPorts: internal dependency handling.

Packages have dependencies. There are three types of them in MirPorts: build, run and library dependencies. I won't talk about the former here. MirPorts inherited a very convoluted way of handling those dependencies from OpenBSD, including several passes over the packing list using various scripts and the infamous pkg utility. pkg is essentially undocumented and constitutes a failed attempt of Marc Espie to rewrite the pkgtools in perl. It has only one subcommand, pkg dependencies with three sub-subcommands show, solve and check.

Dependencies are declared via the LIB_DEPENDS and RUN_DEPENDS variables in the port Makefile, for example:

LIB_DEPENDS=           apr::devel/apr/apr

From there, they are passed to a recursive solver in bsd.port.mk, which outputs commands like

@libdepend apr-util-0.9.12-0-bsddb:apr.0.9:apr-*:apr-0.9.12-0

into w-*/pkg/depends. The four arguments are called name, libspec, pattern, and def. The @newdepend directive is for run depends and does not have a libspec. The depends file is fed to pkg dependencies solve, which replaces these lines by

@comment libdepend apr.0.9:subversion-1.4.0-0-bsddb:apr-*:apr-0.9.12-0

Note the changed order of the arguments! What it also does is resolve the dependency and write a static @pkgdep line like

@pkgdep apr-0.9.12-0

on top. All of those are output into w-*/pkg/PLIST. Upon installation, pkg_add only cares about the @pkgdep directives.

There are a number of problems with this approach. I would like to replace pkg entirely by C code inside the pkgtools. The advantage is a much reduced complexity, the removal of the liability that is pkg, and more flexibility: If packages are upgradeable, the final resolution of the dependencies should be done by pkg_add when installing the package. If you have a newer version of a dependency installed, we can check if the library version matches and still allow the installation. pkg_upgrade would also profit massively, as the current implementation leaves the @pkgdep lines intact so that they are effectively unfulfilled. This project is promising but it will take me some time. Be patient.

If you want to discuss this, please use the miros-discuss mailing list.

## 20.10.2006 by bsiegert@

I haven't written anything here for quite a while, so here is a little update. I moved out of France and now live in Saarbrücken. I will hopefully have both telephone and DSL service soon—it is scheduled for tuesday, but let's say I will believe it when I see it. I started work on a port of Qt 4.2.0, as close as possible to the upstream sources. Those crazy patches from OpenBSD often break more than they fix. Qt is quite a beast though: a 36 MiB .tar.gz with no .tar.bz2 available, non-standard configure, .la files generated by C++ code, etc. Now I know why I like Gtk+ better :). Seriously, the tarball gained more than 4 MiB since 4.1.x. I knew that Mozilla is bloated (Firef*x is ~36 MiB compressed) but I was shocked to see Qt is just as big.

And now for something completely different: While writing the report for my summer internship, I came across a number of problems regarding pictures and their insertion into a LaTeX document. I will note my solutions here so that I don't forget what I did, even if this is a wee bit off-topic.

First problem: Inserting a plot done with gnuplot. Obviously, there are many ways to do this but here is what I do. My gnuplot file looks like this (example):

set encoding iso_8859_1
set term postscript color solid eps enhanced lw 2 "Helvetica" 20
set output "sucres2.eps"
set xlabel "Temp{\351}rature ({\260}C)"
set ylabel "Heat Flow (W/g)"
set key top right
plot [150:200] 	"bs06.4Kmin.txt" using 1:3 with lines title "exc{\350}s en chlorate"


The "set term" line is the most important here. color solid gets me a coloured plot without dashed lines. eps generates a correct bounding box and makes the plot a nice 12x7 cm. enhanced allows me to write stuff like "CO_2" and accented characters: {\260} for example inserts the latin-1 character with the octal code 260, a degrees sign. lw 2 makes the lines a bit thicker for better visibility. The 20-point font is good if you scale down the plot (like me).

Now you'll need to transform this into a pdf file. Use epstopdf:

$epstopdf -d sucres2.eps * Input filename: sucres2.eps * BoundingBox comment: %%BoundingBox: * Output filename: sucres2.pdf * Ghostscript command: "C:\Program Files\gs\gs8.54\bin\gswin32c.exe" * Compression: on * Ghostscript pipe: "C:\Program Files\gs\gs8.54\bin\gswin32c.exe" -q -sDEVICE=pdfwrite -sOutputFile=sucres2.pdf - -c quit * Scanning header for BoundingBox * Old BoundingBox: 50 50 410 302 * New BoundingBox: 0 0 360 252 * Offset: -50 -50 * Ready.  Note the correct bounding box. For inserting this, I do: \begin{figure} \centering\includegraphics[width=8cm]{Plots/sucres2} \caption{foo}% \label{fig:sucres} \end{figure}  Figures you have only as Word drawings are a whole different beast. But there is a way to do it: First, mark all elements of the drawing, copy it and insert it into a new document by itself. Important: You have to position it as close as possible to the lower left corner of the page, as this the origin in PostScript. Next, use File > Print, select a PostScript printer and check Print to file. Open the resulting .prn file in GSview (I assume you are under Windows -- you use Word, right?). Select File > PS to EPS and uncheck Automatically calculate Bounding Box. Select the margins of your drawing with the mouse and save it under a file name ending in .eps. Now comes the interesting part: You open the .eps file in a text editor. Among the first lines, you will see a BoundingBox DSC comment, like this: %%BoundingBox: 11 11 363 209 Note these values. Search for "PageSize". You will find a line like: <</PageSize [595 842] /ImagingBBox null>> setpagedevice Replace the values in the brackets by the third and fourth value from the bounding box above. Save and quit. Again, use epstopdf like above. Open the pdf in Acrobat Reader. It should have only your graph without any additional white space around. For the insertion into your LaTeX document, use the same lines as above. ## 18.10.2006 by tg@ High-End: we now run past 2038 as well: in 2100 (32 bit), almost no- thing breaks, except a few library functions and ffs (UFSv1) timestam- ps, in 2200 (33 bit), network and shutdown don't work any more, but we at least don't crash. Weird-End: sysctl(3) ddb.crash now can force a kernel panic. Low-End: I'm helping Vutral (real name known) to install MirOS on an 8 MiB RAM 80486DX system. That's fun, but the serial console is a slow UMTS link, which is NOT fun. French-End: Benny apparently is in Germany now and of course, thanks Deutsche Telekom, he doesn't have internet access. *sigh* Data-End: I lost herc:/home and one of two underlying parts of raid0 (RAID level 1) alias herc:/ – and as if that would not be enough I had an rsync accident (missing directory level on destination combi- ned with --delete) losing most of the stuff in my$HOME which was in a directory on /… note to self: dont keep backups within \$HOME but use a dedicated directory tree.

GNU End: gcc miscompiles not only C++ but also C code with a certain option -fomit-frame-pointer – caught by my favourite text editor.

Money End: At last, I get some state money (by far not enough), more might come, but I'd prefer a job. OTOH they'll pay for new teeth, more than they had paid if I were employed. But the pain's the same.

## 03.10.2006 by tg@

Advertising pays off, the Sourcemage guy (morfic) not only fixed the spell (their lingo for port), but also threw its name into some random IRC conversations in places I don't dwell. Cool.

I got a surprise when, preparing the new snapshot with Live CD to be issued, the BSDstats.org code didn't run any more. Luckily, we got the bugs and updates past that state. Getting ftp(1) to not pretend it can handle HTTP/1.1 responses did surely help.

Installing Windows® 2000 on a Pentium Ⅰ notebook without a CD-ROM drive can be entertaining. While it's a real PITA, having MirOS at hand eases the pain very much. (And I discovered a local DoS attack in our kernel, default installation, during the process.) However, the ancient game (Age of Empires Ⅰ) I was installing… I needed a no-cd crack, and all failed but one, which was merely a text file of 15k credits and four "patch these and be happy" instructions – what I did. Now, which editor can I use on DOS for a 1'622'016 bytes executable? Volkov Commander and debug.exe fail, so I used jupp. Yes, right. A Cygwin compiled (4 files: libcygwin, libncurses, jupprc, jupp) executable of my favourite text editor. And it worked for me and saved my arse from the pain of copying back and forth, without a putty installed (yet – will follow). To only change a 7504 conditional jump into an EB63 at D769F and adjust F7D8 at D7706 to 4090 is enough, contrary to the beliefs of people making 500+ KiB RAR/ACE files with a PE binary (can you spell trojan?) inside. Anyway, the laptop initially wasn't intended for gaming but for office work under Windows. However, the hardware (Compaq Armada 4220T) is cool, so I saved some 384 MiB on wd0 for a full (yet kept quite minimal) MirOS+X11 install, using a DOS PAGEFILE.SYS for swap.

I spotted quite some bugs working on the snapshot – I believe, it's already in a much better shape than #9. And I kept a few great ideas for past the snapshot, even. (So that people can upgrade a running system to get the security fixes, some of which I incorporated before That Ơther BSD.) What I didn't spot is Benny.

## 24.09.2006 by tg@

Did some serious FreeWRT hacking at wbx@' place yesterday. He showed me how to roll my own Sushi and we had enough wine to get me a serious hangover today.

Benny and I agreed on renaming #9bis into #10 because some seriously deep changes which could not entirely be avoided. This way we can also polish a little more and make one or two user-visible changes, but I'm trying to not delay the release any more for that reason. Afterwards a #11 will be released, with the goal "sync with OpenBSD 4". I also have plans for #12 which will take quite a long time.

## 21.09.2006 by tg@

Someone remind me to get Darren Tucker a beer.

I need plumbing in Plan 9! If I select a line like

/usr/src/foo/bar/bar.c:123: warning: fnord


then I mark the filename with the mouse, type "jupp ", hit the middle mouse button, press return. That could be easier. Plan 9.

A person asked me in private mail how he could use the root account, on his freshly installed (in MS Virtual PC) MirOS. I told him that one uses sudo(8), but I still wonder why people do not ask in public, on a mailing list. Even if you ask in German there, you won't be considered impolite because about half of our usership could still make use of an answer in that language. (Of course it's better to write English.) But keeping these mailing lists and the archives is work, so, please, if a question appears, use these, or at least IRC.

Update: looks like it's greylisting. If the 451 is received the user gets a failure reply even though the message will be sent correctly ~4 hours later. If everyone would just be using IPv6… at this rate, spammers will be using IPv6 before the rest of the world. Even the uni of Düsseldorf.

make(1) needs a break-and-continue mode. Oh, and, if you change some types in the compiler, make sure to re-build and install all libraries before rebuilding the system, otherwise xlock might not link because a symbol was missing in libstdc++ (do I need to change the shlib version now? no idea, I think nm might know).

## 20.09.2006 by tg@

I hope the last wlog entry did not scare too many of you. First, I'm apologising to Benny for slandering his effort. Second, MirOS is going to continue, and in fact, Benny and I have talked about long-term plan (not 9) regarding packages, syspkgs, and so on. This is, seriously, an idea that will take years to complete, so we won't discuss it for now, unless someone asks us (over a few beers *hint hint*).

While my work situation did not improve yet, I hope to be invited to a personal talk at some companies soon… who knows…

I hacked quite well on fwcf – our first hosted foreign project – that's some good creative work, finally.

mksh(1) world domination is going to succeed.

-rHEAD contains lots of security updates; yes I promised a snapshot, quite some time ago actually, to be out shortly. Okay okay.

## 13.09.2006 by tg@

The more you work with software, the more it sucks. I found out that I have to rewrite at least mksh(1)'s emacs editing mode, due to design bugs rendering command-line editing with tabs broken, but better re-do the whole damned thing (taking 64-bit integers and wide chars into the initial design considerations). Same goes for MirPorts, after stumping across a bazillion more quoting bugs. If I had the money…

À propos rewriting… don't you dare mention FreeWRT.

A computer-illiterate visitor today decided the new design sucks too and prefers the old one. Yay! I still wonder why we didn't keep my CMS (or rather, excuse for not having a CMS) and changed only the content; dynamic page elements, such as news or wlog, could've been implemented within the existing framework as well.

Yep, MirOS now hosts foreign projects within its CVS. Trusted people only, of course. (Time to redesign CVS's operation.)

I'm missing a lot more catch-up things but you should have a look at BSDstats and their sub-page over MirOS.

Somehow I've been missing "the spirit" lately. Add to that the truth that, out of MirOS, I've basically written nothing, only doing integration work or writing (sometimes larger, such as with e.g. djbdns) patches. Even these rarely add major functionality. Magic is only contained in the one thing I have really written myself and of which I can be proud, the licence. Sucks, if you consider yourself not a lawyer but a programmer, eh? On the other hand, integration work is, both, importand and a good starting point into snapping how all works. Maybe I should really "clone" MirBSD again, this time not as an OpenBSD fork, but as a modular smallish system not even self-hosted in the beginning. Starting with the cvs- and ctm-based infrastructure, then some kind of packaging tools, initial utilities including an mksh rewrite, a bootloader, kernel, installer, third-party apps. But that's a thing I can't do alone unless I dedicate myself fully to it and some other person maintains MirOS. I guess I will never get that far. Wise, it is not, to reinvent the wheel. Building upon and improving existing solutions (which suck) is the way to go in this world. Does this suck? I guess it does. And I guess I'm not the first dreamer.

And I guess I don't have the vigour to do even one of them :'(

## 03.09.2006 by tg@

Yeah, to hell with OSI, the FSF now has two webpages which are under the MirOS licence: mksh's page and mirmake's page, and the page of jupp the editor. Cool!

We have a new design, I must say I'm… shocked. (And make these <h2> smaller in the CSS, please.)

Other than that, not much noteworthy happened.

## 27.08.2006 by tg@

Okay, the new website is online, with fixes. I don't think using other peoples' design is a good thing, because, if you don't use a design of your own which you don't licence to others freely, you aren't safe from copycats. This is a reason for the "must not copy the design of MirOS or (my) personal webpage" clause in the old www/LICENCE file, by the way. (I don't like the news entry format much – it has too much red tape (everything before, and especially the colon-space (use an equals sign, if you're going to use a key-value pair at all!), in the header).

Played with MacOS 7.5.3 in Basilisk Ⅱ and SheepShaver today. I think the GUI is quite intuitive. The OSnews article on GEOS was quite the good read for the evening too, and fasm (flat assembler) looks not bad either, and it has a funny BSD-style licence.

On the other hand I ended up doing my own letter form for a DIN 5008 letter all afternoon, because there are no good ones available, and no single one for Lotus Word Pro 9.5 (Millennium Edition) for Windows, at all! This sucks, the freely available specs (the standard itself costs some 30-50 €) suck and contradict themselves, but IMHO, I crafted something usable which doesn't make me look bad to my hopefully future employer at the first look. (On related news, I am still looking for a job, anyone?)
PS: Long live (AFPL) Ghostscript!

I'm pondering to release mksh R28 now, codename Pleitegeier (not an austrian word though). I should move some of the MI Plan 9 support code into the branch though, as I'm suspicious of it causing issues with job control in Plan 9 itself. The FSF and UNESCO directory of Free Software sadly still doesn't list it.

I should convert the entire repository to strict ISO_646.irv:1991 or UTF-8 conformance. Maybe post-#9bis, because I'd really like to get it out of the doors, but then really (including change logs, mailx(1) and submit.cf default, etc.) and correctly.

Cygwin, Interix, various Mac and Windows instances, GNU and BSD suck all, just in different flavours and strengths. And Solaris is the funny dot on the i. (What is Plan 9 APE then? I guess I don't want to even know.)