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.

> > > 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.
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.

> 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?

> 
> > 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.

>
> > > 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.
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.

> 
> > 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.

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

Thanks

Roy
--- gen_initramfs_list.sh.orig	2008-09-22 16:46:25.000000000 +0100
+++ gen_initramfs_list.sh	2008-09-22 16:54:07.000000000 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # Copyright (C) Martin Schlemmer <[EMAIL PROTECTED]>
 # Copyright (C) 2006 Sam Ravnborg <[EMAIL PROTECTED]>
 #
@@ -105,9 +105,7 @@
 # for links, devices etc the format differs. See gen_init_cpio for details
 parse() {
 	local location="$1"
-	local name="${location/${srcdir}//}"
-	# change '//' into '/'
-	name="${name//\/\///}"
+	local name="$(echo "${location}" | sed -e "s,${srcdir},,g;s,/,//,g")"
 	local mode="$2"
 	local uid="$3"
 	local gid="$4"
@@ -117,8 +115,8 @@
 	[ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0
 	local str="${mode} ${uid} ${gid}"
 
-	[ "${ftype}" == "invalid" ] && return 0
-	[ "${location}" == "${srcdir}" ] && return 0
+	[ "${ftype}" = "invalid" ] && return 0
+	[ "${location}" = "${srcdir}" ] && return 0
 
 	case "${ftype}" in
 		"file")
@@ -192,18 +190,18 @@
 	if [ -f "$1" ]; then
 		${dep_list}header "$1"
 		is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')"
-		if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then
+		if [ $2 -eq 0 -a "${is_cpio}" = "cpio" ]; then
 			cpio_file=$1
 			echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed"
-			[ ! -z ${dep_list} ] && echo "$1"
+			[ -n "${dep_list}" ] && echo "$1"
 			return 0
 		fi
-		if [ -z ${dep_list} ]; then
+		if [ -z "${dep_list}" ]; then
 			print_mtime "$1" >> ${output}
 			cat "$1"         >> ${output}
 		else
 			cat "$1" | while read type dir file perm ; do
-				if [ "$type" == "file" ]; then
+				if [ "$type" = "file" ]; then
 					echo "$file \\";
 				fi
 			done
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to