Subject: Re: textproc/nbsed broken on non-NetBSD systems
To: Alan Barrett <apb@cequrux.com>
From: Robert Lillack <lillack@mis.mpg.de>
List: tech-pkg
Date: 04/29/2005 21:45:33
Alan Barrett wrote:

> 1.  Don't try to use nbsed like that.  Instead, use

Well. "It wasn't me." Ironically, it's GNU sed's autoconf script which 
does this kind of stuff.

> 3.  Make nbsed (and all other nb* tools) use getopt() in a
>     GNU-getopt-compatible way, by passing '+' as the first char of the
>     option string, and by adding '+' as an explicit error case in the
>     option processing switch.

Sounds good. But this won't help in the Solaris case. See below.

> 4.  Make the autoconf stuff in pkgsrc/sysutils/libnbcompat smarter about
>     deciding when to use its own getopt() implementation instead of the
>     host OS's native getopt().  If it detects that the native getopt()
>     has the bad GNU behaviour, it should decide to use its own getopt()
>     instead.

Unfortunately, this looks like the only real solution. But it smells 
like overkill (ie. libnbcompat's getopt would effectively be used on 
nearly every system).

On SunOS 5.8 this is a real problem for me, because getopt() _does_ 
shuffle the arguments around but does NOT return '-', when --x is given. 
So, if you call "sed 's/a/b/' --x" it is interpreted as "sed 's/a/b/'" 
and therefore hangs.

I think at least a switch to force building getopt, when SunOS <=5.8 is 
detected in libnbcompat's autoconf script is the badly needed.

Well, thanks again,
Rob.
-- 
   +- Robert Lillack ------------------ lillack@mis.mpg.de -+
  /  Max Planck Institute for Mathematics in the Sciences  /
+- Leipzig, Germany ----------- phone: +49-341-9959-693 -+