Which sed version is not GNU sed 4.0

busyboxsedversion

I'm trying to figure out which version of sed that I've got on BusyBox 1.18.3. The --version output is cryptic.

$ sed --version
This is not GNU sed version 4.0

The following code is from the relevant sed.c.

    /* Lie to autoconf when it starts asking stupid questions. */
if (argv[1] && !strcmp(argv[1], "--version")) {
    puts("This is not GNU sed version 4.0");
    return 0;
}

This is the header:

/*
 * sed.c - very minimalist version of sed
 *
 * Copyright (C) 1999,2000,2001 by Lineo, inc. and Mark Whitley
 * Copyright (C) 1999,2000,2001 by Mark Whitley <markw@codepoet.org>
 * Copyright (C) 2002  Matt Kraai
 * Copyright (C) 2003 by Glenn McGrath
 * Copyright (C) 2003,2004 by Rob Landley <rob@landley.net>
 *
 * MAINTAINER: Rob Landley <rob@landley.net>
 *
 * Licensed under GPLv2, see file LICENSE in this source tree.
 */

There is also a list of "supported features and commands in this version of sed". It looks like a special sed, but how is it special? Is it custom-made for BusyBox, or does it come from another source?

How should I refer to this sed, e.g. in SE questions?

Best Answer

BusyBox sed doesn't really support --version. As the comment indicates, the output is intended for configure scripts, not for humans. (It's confusing to humans in a rather silly way!) Describe it as BusyBox sed indicating the Busybox version (obtained with busybox | head -n 1).

Some BusyBox commands have optional features, and there is no generic way to find which ones were compiled in. sed doesn't have any.

As for why BusyBox sed reports that it's not GNU sed, the point is in fact that it is trying to pass off as GNU sed because it is sufficiently compatible. Some configure scripts look for the string GNU sed version nnn, and this way BusyBox sed is acceptable. Specifically, the configure script of GNU libc needed to be “[shot] in the head with a bazooka full of broken glass and rusty nails” (© Rob Landley).

Related Question