Backslashed escape sequences

Rob Landley rob at landley.net
Mon Sep 22 23:15:37 UTC 2008


On Monday 22 September 2008 11:20:02 Roy Marples wrote:
> On Mon, 2008-09-22 at 10:30 -0500, Rob Landley wrote:
> > > No, busybox has adopted a few shells, of which ash is probably the most
> > > POSIX compliant one. busybox has never adopted bash.
> >
> > Bash as a codebase to use, no.  Bash as a de-facto Linux standard against
> > which to compare its shell behavior, yes.  (CONFIG_ASH_BASH_COMPAT
> > anyone?)
>
> Pretty sure that's broken. Or at least it was when I last looked at it.

It's selected by defconfig and I'm building that with busybox 1.11.1.  Dunno 
what it does, but it hasn't screwed up anything obvious yet...

> > > > Now these were mostly old versions of bash.  I stopped paying
> > > > attention to anything that went in after 2.04b.  But things like
> > > > curly bracket file listing syntax, or echo needing -e?  You encounter
> > > > them all over the place in Linux.
> > > >
> > > > (And note that if you use dash, echo doesn't support options at all.
> > > > No "echo -e" or "echo -n".  Yeah, that breaks things.)
> > >
> > > Such scripts should use #!/bin/bash instead of #!/bin/sh.
> >
> > No scripts should use #!/bin/sh anymore, Ubuntu broke that symlink with
> > the Defective Annoying SHell.  Which means that at some point, Busybox is
> > going to have to provide a #!/bin/bash symlink if it wants to be able to
> > run things like the linux kernel's scripts/gen_initramfs_list.sh.
>
> No, you provide bash or recode the script for POSIX sh.

Rewriting the code of everybody else in the world to achieve your objective is 
certainly a point of view.

And I currently _am_ providing bash.

> To give a trivial example, I've attached a patch for
> gen_initramfs_list.sh (untested) that should allow it to work for
> busybox ash.
>
> By your argument, you could have #!/usr/bin/perl and expect it to run
> your python script.

Have fun with your straw man, I'll be over here.

> > In the meantime, the minimal self-bootstrapping environment is still
> > seven packages, one of which is bash.
>
> So is GCC or are you imlying that busybox should have that also?

Actually, I maintained my own fork of tinycc for a couple years, but I gave up 
on it a while back because messing with CVS is not something I do for fun.

But the point is that Busybox does not provide a compiler.  If it _did_, that 
compiler should be good enough to not need to be replaced with another 
compiler in order to rebuild a Linux system under itself.

Busybox _does_ provide a shell.  If it provides a shell, it should be a GOOD 
shell.  Busybox's shell is not currently good enough to operate in a 
development environment without being replaced.  (If only because it can't be 
called using the name "bash", not sure what else is missing yet.  Last time I 
tried there was too much wrong to bother tracking down anything specific, but 
it's been a while...)

> > > If you want bash features then explicitly use bash. If you want bash
> > > features in /bin/sh then get the The Open Group to adopt them :)
> >
> > If you want to use Solaris, you know where it is.
>
> Eh? Solaris has nothing todo with this discussion.

Ok, I'll explain:

Busybox uses /proc.  Show me where /proc is standardized by the open group.  
Feel free to rip all uses of /proc out of your copy of busybox until such a 
time as you get The Open Group to adopt them.

Busybox has never claimed to be a posix tool, it's always been a _Linux_ tool.  
Somebody once used a subset of it on bare metal (newlib+libgloss I think), 
somebody was trying to make it work on Apple back in 2006, and I think 
Bernhard used bits of it on Digital Unix.  There might be others.  (There was 
enough of this stuff I moved it to  "include/platform.h" to keep it out of 
the rest of the code.)

But only a subset of the applets ever worked on any other platform, very few 
people ever got it to _work_ on any other platform.  Things like mdev and 
insmod make no _sense_ on other operating systems, and everything from ps to 
ifconfig would need a rewrite.  Busybox has always been a Linux project.

> > > > I have several scripts that use \e as the start of ansi escape
> > > > sequences, by the way.  (Octal's a bit 1970's for my tastes...)
> > >
> > > Again, suggest your idea to the The Open Group or just use bash.
> >
> > Please delete the "mount" command off your system, since it's not in The
> > Open Group Base Specifications, so obviously you can't possibly need it.
>
> mount command is system specific.

Which is not the same as saying you can easily live without it.  SUSv3 doesn't 
specify any kind of "init" command.  It's got _lots_ of holes.

> The Open Group Base Specifications are just that - where specified it's
> an agreed way of working. sh is an agreed way of working, so if sh is
> used it can expect to behave in the specified maner from system to
> system.

Ok,do you need to remove support for -e from your copy of "echo" then?

> > > I like the ability to use /bin/sh so my scripts work on default base
> > > systems such as NetBSD where bash not available by default.
> >
> > You've used busybox on netbsd?  (Without a Linux compatability layer?) 
> > This is new...
>
> No, I've not used busybox on NetBSD, nor have I ever made such a claim.
> However, my scripts (of which I have many) work with the system
> provided /bin/sh which includes (but is not limited to) NetBSD, FreeBSD,
> OpenBSD. They also work on the myriad of other shells - bash, dash,
> busybox (ash), zsh. I've not tried others personally, but people report
> success.

You can write to a subset of the available functionality, sure.  We should 
support that subset.  You seem to be arguing that we shouldn't support 
anything _beyond_ that subset, even if real-world scripts use those features 
and we already have config symbols concerning them.

Making your scripts portable to netbsd is not the same thing as saying busybox 
should restrict itself to providing only netbsd's default shell behavior.

> These are not trivial scripts - they boot the OS
> (http://roy.marples.name/openrc)

I've written my own on more than one occasion, thanks.

Rob



More information about the busybox mailing list