OpenBSD Journal

Marc Espie talks about ports internals

Contributed by mk/reverse on from the interrogation dept.

Marc Espie is an interesting sort of chap living in Paris, France. When tired, he watches a lot of DVDs. He enjoys juggling and riding through Paris on rollerblades.

Sometimes he hacks on the OpenBSD operating system. We tricked him into talking about time machines - and the internals of OpenBSD ports.

(Comments are closed)

  1. By uriel ( on

    When is he rewriting it in sh/awk so we can remove Perl from the base system?

    1. By Nate ( on

      He probably wouldn't, Marc seems anti-shell script.

      The better question is when are you going to submit the patches?

      1. By Anonymous Coward ( on

        If he doesn't like shell scripts maybe he should not be using Unix.

        And I will send the patches when rc becomes the default OpenBSD shell ;)

        Now seriously, to be honest I think the current ports system is over designed and over engineered; something much simpler is enough for me, all I want is to see Perl go, FreeBSD got rid of it a while ago, and it would be sad to see OpenBSD falling behind.

        1. By Marc Espie ( on

          If you are to write trolls, you should at least try to write believable ones. Not liking shell-scripts ? Hah! I'm actually one of the developers in OpenBSD that hacks on shell-scripts. What do you think is anyways ? What do you think is the underlying language of Makefiles ? I don't often go around putting my weight in arguments, but if you have a simple look at the CVS commits in OpenBSD, you'll find hundreds of commits I did in shell-scripts. I'll even point you at the old cpp script, or lorder, or /etc/rc to give you an idea about the kind of stuff I hack. Heck, I also simplified the memory system of ksh so that it could cope with libtool. And I did write the update-patches script from scratch, and about ALL the shells scripts you'll find under /usr/ports/infrastructure if you care to look. That said, the shell has some limitations. Not being structured is one of them. Not coping well with weird names is another. And once you start needing tools like awk, it's simpler to bite the bullet and go perl. About the ports system being over-engineered, what's funny is that in OpenBSD is roughly 2500 lines long, whereas the corresponding files in both NetBSD and FreeBSD are over 5000 lines these days. And the pkg_tools they have are growing each day, with more tweaks, and knobs, and checks, and new commands. Based on really shaky fundations, because the underlying C tools are downright buggy. Like, they don't handle things right, so they add a layer on TOP of that to try to fix the issues. Well, you've got one thing right: you don't like perl, and I do.

          1. By Anonymous Coward ( on

            Don't let the trolls get to you, man. You (and all the other hard-working devs out there) rock! :)

          2. By Chris ( on

            About the ports system being over-engineered, what's funny is that in OpenBSD is roughly 2500 lines long, whereas the corresponding files in both NetBSD and FreeBSD are over 5000 lines these days. And the pkg_tools they have are growing each day, with more tweaks, and knobs, and checks, and new commands. Based on really shaky fundations, because the underlying C tools are downright buggy.

            Is it fair to answer a troll with another (partial) troll? The reason the NetBSD mk files are much larger than the OpenBSD ones is mostly due to the excellent cross platform support of pkgsrc. This includes support for OpenBSD, and judging by the reasonable number of OpenBSD related posts on the pkgsrc mailing list there are people who use pkgsrc in preference to OpenBSD's ports. I'd be shocked if there weren't some warts in the pkgsrc code, but your assertion that it's "based on shaky foundations" doesn't fit with my experience, which is that the tools are becoming increasingly sophisticated as new features are added - not because of the addition of dubious workarounds.


            1. By Marc Espie ( on

              Yes and no.
              There is some useful stuff in NetBSD, but there is also a lot of cruft we did streamline in OpenBSD.

              One of my regular activities involves monitoring NetBSD and FreeBSD to see what I should grab from their infrastructure.

              As for people using pkgsrc on OpenBSD, I'm pretty certain those are the people with cross-platforms needs who don't want to have differing behavior when they change systems.

              To give you instances of stuff we removed: NetBSD always defines
              pre-*/do-*/post-* targets, whereas we only use these if they exist.
              This shaves about 10 targets from each Makefile.

              I've also finished sorting through variables and targets, so that all targets now appear after all variables have been defined.

              There's also the very useful trick of storing shell script fragments in variables for specializing stuff that's becoming pervasive in OpenBSD.

              We have removed stuff. I can see it still in NetBSD. In all cases, it was stuff we could do without (and that we no longer use).

              1. By Chris ( on

                Hi Marc. I use pkgsrc on NetBSD and Solaris, so your comment about people using pkgsrc across various platforms to keep the behaviour the same rings true. It's good to see from your other comments that there's cross-pollination of code between the various BSD package and ports frameworks. I also noticed your recent post to the NetBSD pkgsrc list, which will hopefully lead to further cross-pollination of ideas and code.


          3. By uriel ( on

            It was not me who said that you were "anti-shell script". I commented that _if_ that was the case, then Unix might not be the right OS for you.

            What I will say is that if you like Perl, you probably don't understand Unix. Specially if you think that is shell scripts are "not structured". Structuring shell scripts in small programs that do one thing well and work well together is one of the most fundamental Unix principles.

            I recommend that you read: The Unix Programming Environment by Brian Kernighan and Rob Pike and The AWK Programming Language by Aho, Kernighan, and Weinberger,

            Perl and Perl programmers that didn't understand the Unix philosophy were one of the main causes of the death of Unix.

            1. By Marc Espie ( on

              Thanks, uriel. You're really the funniest little troll there is on

              Your messages are so ludicrous they make me laugh.

              Tell me to learn Unix and shell programming ? hehehe. BWAHAHAHA.

        2. By Michael Knudsen ( on

          It's not exactly like removing Perl from FreeBSD base has made their life any easier.

          1. By Anonymous Coward ( on

            Hasn't it? It allows people to use whatever version of perl they want cleanly and easily just like they can with any other piece of software. Not everyone wants their OS bundled with apache and bind and perl every other random thing that belongs in ports.

            1. By Michael Knudsen ( on

              It hasn't made it easier for the developers who now have to maintain two versions of perl along with extra complexity to handle it.

              Regarding users then I've only heard complaints about having issues with different versions being installed. While this may be issues that stem from uneducated users, having no choice would prevent this. Also, now users have to keep track of which version of perl they've installed.

              This is why I say their move to remove perl from base hasn't made their lives easier.

              1. By Anonymous Coward ( on

                What about "devs" maintaining two versions is so bad exactly? How is that any different from offering the choice of apache 1 and apache 2? It lets users run the software they want, instead of the software the developers want.

                1. By tmclaugh ( on

                  Port Maintainer 1 maintains foo and tests it against Perl 5.8. Port maintainer 2 maintains bar and tests it against 5.6. As a user I use foo and bar with Perl 5.8. When an update comes down the CVS pipe at least one of the ports I use is untested against my Perl version and I get to be the guinea pig. Will one package break? I don't know but I'll find out. Forcing one Perl version forces users and developers to be on the same page. If you like a Perl version _that_ much then pull the last version of the port that you like, install it, and use it at your own risk.

                  1. By Anonymous Coward ( on

                    Are you kidding me? Neither breaks, install both versions of perl and have a nice day. Do you see python in the openbsd ports tree right now? You are trying to make a problem that doesn't exist just to put down freebsd because they don't agree with your "include every stupid thing on the planet in the base system" attitude.

                    1. By Anonymous Coward ( on

                      Submit a port.

                      I'd rather the devs work on something useful instead of reinventing the perl applications already on the system.

                    2. By tmclaugh ( on

                      I'm a FreeBSD port maintainer. I believe in making sure that my ports work. I could maintain two Mono ports, one for each line. I don't because it doubles my testing and I really don't have time for that. It's not about "user X wants this version but user Y preffers this version". I don't care. What I do care about is that user X and user Y have working and tested ports at all times. If someone is that anal about a version, they can pull an older port and use that but they're on their own from there.

                      Having two installed versions of Perl also tends to be a major reason for user fuckups.

                2. By henning ( on

                  you imply choice is good.
                  the opposite is true, choice is bad.

                3. By Marc Espie ( on

                  People have a limited amount of time.

                  Your reply implies that a maintainer caring for two versions of the same port will spend twice the time maintaining the two versions.

                  This is usually not true. It most often means the maintainer will split the same amount of time between the two ports. This is critical for testing, and also for bug-reports. Especially stuff that is hard to reproduce because it depends on versions used.

                  There's also some combinatorial complexity involved. If there are several programs involved, then each version choice *multiplies* the number of possible configurations, and the number of factors that may trigger bugs.

                  There's a large number of system integration bugs where diagnosing the exact problem is the hardest issue. Once you've found that this issue occurs in package foo, because you installed bar, and because there's a tiny little issue in frob that only shows up if you install version 2 of frob.

                  Some of these issues do not get fixed, but filed instead as `not a bug' because they can't get reproduced.

                  All other things being equal (number of people working on a project and time they can spend on that project), more choices means less quality.

            2. By Anonymous Coward ( on

              If you don't want all these tools choose another OS and go away, duhh!

              1. By m0rf ( on

                he also doesn't want citrus or acpi support, but he hasn't gone away yet.

                still hanging on for openbsd to become plan9 i guess.

        3. By Anonymous Coward ( on

          Perl has been around so long, and it's so useful, that it's now an essential part of Unix, just as much as /bin/sh, sed, awk and friends. And for that matter, I'm willing to bet there's lots of folks who would feel lost without it on Win32 boxes (even though it's not as powerful on that platform, but it does what it can with what's available...)

        4. By henning ( on

          all I want is to see Perl go, FreeBSD got rid of it a while ago, and it would be sad to see OpenBSD falling behind.

          falling behind? I call keeping perl staying ahead.

        5. By Gary ( on

          all I want is to see Perl go

          who cares what you want anyway??

    2. By Brad ( brad at comstyle dot com on

      Perl will not be removed from the base system.

      1. By xhrl/thomasw ( on

        a smashing interview. what marc stated about the 'cold reality' of coding pkg_add is so true: simplicity in design and execution is a virtue in many tools. i enjoyed marc's thoughful responses, and the care taken to ask him thought provoking questions in the first place.

      2. By Anonymous Coward ( on

        I am curious what you fellas think about how Perl's "artistic" license (man perlartistic) fits in to OBSD's license philosophy. Obviously, it is considered acceptable ... I'm not sure to what extent. It sounds somewhere between BSD and GPL to me (but that is just my take on it). It isn't mentioned on explicitly. Perhaps you guys will decide to do that, since it is being (in a fashion) more deeply integrated with the base system.

        1. By tedu ( on

          perl lives in the gnu part of the tree.

        2. By Marc Espie ( on

          Perl lives in gnu because gnu denotes `everything non bsd' and cvs sucks enough that no-one would seriously consider renaming that.

          That said, the artistic licence is much less obnoxious as the GPL, from a BSD point of view. It's not quite BSD, in particular, it's a bit too long for its own good.

          But if I read it right, it says that you can do whatever you want with the software, as long as you don't attempt to make lots of money from the software itself. You can more or less sell anything you ADD for an outrageous sum, be it support, additional routines, or scripts, and you're not obligated to distribute any kind of source. The only thing this more or less forbids is to distribute extended perl binaries without also providing a basic version, and distributing mutant versions of perl without renaming it.

          Pretty free if you ask me...

    3. By Lars Hansson ( on

      The question is not when he will do it but when *you* will do it.

    4. By pdemb ( on

      AFAIK sh and awk are not intended to be used for making package management systems. IMO Perl is one of the best languages for that task, the other one is Python :>

    5. By lis ( on

      nice interview

  2. By Chris ( on

    He enjoys juggling and riding through Paris on rollerblades.

    What, at the same time?!?

    1. By ViPER ( on

      Now thats multi tasking.

  3. By Jim ( on

    I just want to say that the best thing aout it is it works. For a long time I thought you updated your system, downloaded ports.tar.gz, unzipped it and went through using 'make install'. The dependencies and all just got handled behine the scenes.

    Then, to my surprise, I read somewhere that pkg_add was the way to go, and wow! was that ever easier! But it is only because of unsung heros quietly working away, making it work and building the packages.

    A great interview, giving well deserved recognition.

    My thanks to you Sir Espie!


Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]