2002-07-07 01:00:42

by Justin Hibbits

[permalink] [raw]
Subject: Patch for Menuconfig script

This is just a patch to the Menuconfig script (can be easily adapted to
the other ones) that allows you to configure the kernel without the
requirement of bash (I tested it with ksh, in POSIX-only mode). Feel
free to flame me :P

(Yes it is kinda big, but that's because I had to hack a bunch of parts
with it)

Justin Hibbits

--- ../../linux/scripts/Menuconfig Sun Aug 5 16:12:41 2001
+++ Menuconfig Sat Jul 6 20:48:15 2002
@@ -83,11 +83,6 @@
single_menu_mode=

#
-# Make sure we're really running bash.
-#
-[ -z "$BASH" ] && { echo "Menuconfig requires bash" 1>&2; exit 1; }
-
-#
# Cache function definitions, turn off posix compliance
#
set -h +o posix
@@ -101,7 +96,7 @@
# This function looks for: (1) the current value, or (2) the default value
# from the arch-dependent defconfig file, or (3) a default passed by the caller.

-function set_x_info () {
+set_x_info () {
eval x=\$$1
if [ -z "$x" ]; then
eval `sed -n -e 's/# \(.*\) is not set.*/\1=n/' -e "/^$1=/p" arch/$ARCH/defconfig`
@@ -126,7 +121,7 @@
#
# Additional comments
#
-function comment () {
+comment () {
comment_ctr=$[ comment_ctr + 1 ]
echo -ne "': $comment_ctr' '--- $1' " >>MCmenu
}
@@ -134,23 +129,23 @@
#
# Define a boolean to a specific value.
#
-function define_bool () {
+define_bool () {
eval $1=$2
}

-function define_tristate () {
+define_tristate () {
eval $1=$2
}

-function define_hex () {
+define_hex () {
eval $1=$2
}

-function define_int () {
+define_int () {
eval $1=$2
}

-function define_string () {
+define_string () {
eval $1="$2"
}

@@ -158,7 +153,7 @@
# Create a boolean (Yes/No) function for our current menu
# which calls our local bool function.
#
-function bool () {
+bool () {
set_x_info "$2" "n"

case $x in
@@ -168,7 +163,7 @@

echo -ne "'$2' '[$flag] $1$info' " >>MCmenu

- echo -e "function $2 () { l_bool '$2' \"\$1\" ;}\n" >>MCradiolists
+ echo -e "$2 () { l_bool '$2' \"\$1\" ;}\n" >>MCradiolists
}

#
@@ -177,7 +172,7 @@
#
# Collapses to a boolean (Yes/No) if module support is disabled.
#
-function tristate () {
+tristate () {
if [ "$CONFIG_MODULES" != "y" ]
then
bool "$1" "$2"
@@ -193,7 +188,7 @@
echo -ne "'$2' '<$flag> $1$info' " >>MCmenu

echo -e "
- function $2 () { l_tristate '$2' \"\$1\" ;}" >>MCradiolists
+ $2 () { l_tristate '$2' \"\$1\" ;}" >>MCradiolists
fi
}

@@ -209,7 +204,7 @@
# are nested, and one module requires the presence of something
# else in the kernel.
#
-function dep_tristate () {
+dep_tristate () {
ques="$1"
var="$2"
dep=y
@@ -238,7 +233,7 @@
# Same as above, but now only Y and N are allowed as dependency
# (i.e. third and next arguments).
#
-function dep_bool () {
+dep_bool () {
ques="$1"
var="$2"
dep=y
@@ -258,7 +253,7 @@
fi
}

-function dep_mbool () {
+dep_mbool () {
ques="$1"
var="$2"
dep=y
@@ -281,41 +276,41 @@
#
# Add a menu item which will call our local int function.
#
-function int () {
+int () {
set_x_info "$2" "$3"

echo -ne "'$2' '($x) $1$info' " >>MCmenu

- echo -e "function $2 () { l_int '$1' '$2' '$3' '$x' ;}" >>MCradiolists
+ echo -e "$2 () { l_int '$1' '$2' '$3' '$x' ;}" >>MCradiolists
}

#
# Add a menu item which will call our local hex function.
#
-function hex () {
+hex () {
set_x_info "$2" "$3"
x=${x##*[x,X]}

echo -ne "'$2' '($x) $1$info' " >>MCmenu

- echo -e "function $2 () { l_hex '$1' '$2' '$3' '$x' ;}" >>MCradiolists
+ echo -e "$2 () { l_hex '$1' '$2' '$3' '$x' ;}" >>MCradiolists
}

#
# Add a menu item which will call our local string function.
#
-function string () {
+string () {
set_x_info "$2" "$3"

echo -ne "'$2' ' $1: \"$x\"$info' " >>MCmenu

- echo -e "function $2 () { l_string '$1' '$2' '$3' '$x' ;}" >>MCradiolists
+ echo -e "$2 () { l_string '$1' '$2' '$3' '$x' ;}" >>MCradiolists
}

#
# Add a menu item which will call our local One-of-Many choice list.
#
-function choice () {
+choice () {
#
# Need to remember params cause they're gonna get reset.
#
@@ -346,7 +341,7 @@
echo -ne "'$firstchoice' '($current) $title' " >>MCmenu

echo -e "
- function $firstchoice () \
+ $firstchoice () \
{ l_choice '$title' \"$choices\" \"$current\" ;}" >>MCradiolists
}

@@ -363,7 +358,7 @@
# Most of this function was borrowed from the original kernel
# Configure script.
#
-function extract_help () {
+extract_help () {
if [ -f Documentation/Configure.help ]
then
#first escape regexp special characters in the argument:
@@ -396,7 +391,7 @@
#
# Activate a help dialog.
#
-function help () {
+help () {
if extract_help $1 >help.out
then
$DIALOG --backtitle "$backtitle" --title "$2"\
@@ -411,7 +406,7 @@
#
# Show the README file.
#
-function show_readme () {
+show_readme () {
$DIALOG --backtitle "$backtitle" \
--textbox scripts/README.Menuconfig $ROWS $COLS
}
@@ -420,7 +415,7 @@
# Begin building the dialog menu command and Initialize the
# Radiolist function file.
#
-function menu_name () {
+menu_name () {
echo -ne "$DIALOG --title '$1'\
--backtitle '$backtitle' \
--menu '$menu_instructions' \
@@ -432,14 +427,14 @@
#
# Add a submenu option to the menu currently under construction.
#
-function submenu () {
+submenu () {
echo -ne "'activate_menu $2' '$1 --->' " >>MCmenu
}

#
# Handle a boolean (Yes/No) option.
#
-function l_bool () {
+l_bool () {
if [ -n "$2" ]
then
case "$2" in
@@ -460,7 +455,7 @@
#
# Same as bool() except options are (Module/No)
#
-function mod_bool () {
+mod_bool () {
if [ "$CONFIG_MODULES" != "y" ]; then
define_bool "$2" "n"
else
@@ -473,14 +468,14 @@

echo -ne "'$2' '<$flag> $1$info' " >>MCmenu

- echo -e "function $2 () { l_mod_bool '$2' \"\$1\" ;}" >>MCradiolists
+ echo -e "$2 () { l_mod_bool '$2' \"\$1\" ;}" >>MCradiolists
fi
}

#
# Same as l_bool() except options are (Module/No)
#
-function l_mod_bool() {
+l_mod_bool() {
if [ -n "$2" ]
then
case "$2" in
@@ -508,7 +503,7 @@
#
# Handle a tristate (Yes/No/Module) option.
#
-function l_tristate () {
+l_tristate () {
if [ -n "$2" ]
then
eval x=\$$1
@@ -533,7 +528,7 @@
#
# Create a dialog for entering an integer into a kernel option.
#
-function l_int () {
+l_int () {
while true
do
if $DIALOG --title "$1" \
@@ -567,7 +562,7 @@
#
# Create a dialog for entering a hexadecimal into a kernel option.
#
-function l_hex () {
+l_hex () {
while true
do
if $DIALOG --title "$1" \
@@ -600,7 +595,7 @@
#
# Create a dialog for entering a string into a kernel option.
#
-function l_string () {
+l_string () {
while true
do
if $DIALOG --title "$1" \
@@ -628,7 +623,7 @@
#
# Handle a one-of-many choice list.
#
-function l_choice () {
+l_choice () {
#
# Need to remember params cause they're gonna get reset.
#
@@ -693,14 +688,14 @@
#
# Call awk, and watch for error codes, etc.
#
-function callawk () {
+callawk () {
awk "$1" || echo "Awk died with error code $?. Giving up." || exit 1
}

#
# A faster awk based recursive parser. (I hope)
#
-function parser1 () {
+parser1 () {
callawk '
BEGIN {
menu_no = 0
@@ -722,7 +717,7 @@
printf("submenu %s MCmenu%s\n", $0, menu_no) >>menu

newmenu = sprintf("MCmenu%d", menu_no);
- printf( "function MCmenu%s () {\n"\
+ printf( "MCmenu%s () {\n"\
"default=$1\n"\
"menu_name %s\n",\
menu_no, $0) >newmenu
@@ -749,7 +744,7 @@
#
# Secondary parser for single menu mode.
#
-function parser2 () {
+parser2 () {
callawk '
BEGIN {
parser("'$CONFIG_IN'","MCmenu0")
@@ -777,10 +772,10 @@
#
# Parse all the config.in files into mini scripts.
#
-function parse_config_files () {
+parse_config_files () {
rm -f MCmenu*

- echo "function MCmenu0 () {" >MCmenu0
+ echo "MCmenu0 () {" >MCmenu0
echo 'default=$1' >>MCmenu0
echo "menu_name 'Main Menu'" >>MCmenu0

@@ -807,7 +802,7 @@
for i in MCmenu*
do
echo -n "."
- source ./$i
+ . ./$i
done
rm -f MCmenu*
}
@@ -819,7 +814,7 @@
# one per configuration option. These functions will in turn execute
# dialog commands or recursively call other menus.
#
-function activate_menu () {
+activate_menu () {
rm -f lxdialog.scrltmp
while true
do
@@ -1047,13 +1042,13 @@
# Load config options from a file.
# Converts all "# OPTION is not set" lines to "OPTION=n" lines
#
-function load_config_file () {
+load_config_file () {
awk '
/# .* is not set.*/ { printf("%s=n\n", $2) }
! /# .* is not set.*/ { print }
' $1 >.tmpconfig

- source ./.tmpconfig
+ . ./.tmpconfig
rm -f .tmpconfig
}

@@ -1070,17 +1065,17 @@
#
# Nested function definitions, YIPEE!
#
- function bool () {
+ bool () {
set_x_info "$2" "n"
eval define_bool "$2" "$x"
}

- function tristate () {
+ tristate () {
set_x_info "$2" "n"
eval define_tristate "$2" "$x"
}

- function dep_tristate () {
+ dep_tristate () {
set_x_info "$2" "n"
var="$2"
shift 2
@@ -1096,7 +1091,7 @@
define_tristate "$var" "$x"
}

- function dep_bool () {
+ dep_bool () {
set_x_info "$2" "n"
var="$2"
shift 2
@@ -1110,7 +1105,7 @@
define_bool "$var" "$x"
}

- function dep_mbool () {
+ dep_mbool () {
set_x_info "$2" "n"
var="$2"
shift 2
@@ -1124,47 +1119,47 @@
define_bool "$var" "$x"
}

- function int () {
+ int () {
set_x_info "$2" "$3"
echo "$2=$x" >>$CONFIG
echo "#define $2 ($x)" >>$CONFIG_H
}

- function hex () {
+ hex () {
set_x_info "$2" "$3"
echo "$2=$x" >>$CONFIG
echo "#define $2 0x${x##*[x,X]}" >>$CONFIG_H
}

- function string () {
+ string () {
set_x_info "$2" "$3"
echo "$2=\"$x\"" >>$CONFIG
echo "#define $2 \"$x\"" >>$CONFIG_H
}

- function define_hex () {
+ define_hex () {
eval $1="$2"
echo "$1=$2" >>$CONFIG
echo "#define $1 0x${2##*[x,X]}" >>$CONFIG_H
}

- function define_int () {
+ define_int () {
eval $1="$2"
echo "$1=$2" >>$CONFIG
echo "#define $1 ($2)" >>$CONFIG_H
}

- function define_string () {
+ define_string () {
eval $1="$2"
echo "$1=\"$2\"" >>$CONFIG
echo "#define $1 \"$2\"" >>$CONFIG_H
}

- function define_bool () {
+ define_bool () {
define_tristate "$1" "$2"
}

- function define_tristate () {
+ define_tristate () {
eval $1="$2"

case "$2" in
@@ -1192,7 +1187,7 @@
esac
}

- function choice () {
+ choice () {
#
# Find the first choice that's already set to 'y'
#
@@ -1236,19 +1231,19 @@
done
}

- function mainmenu_name () {
+ mainmenu_name () {
:
}

- function mainmenu_option () {
+ mainmenu_option () {
comment_is_option=TRUE
}

- function endmenu () {
+ endmenu () {
:
}

- function comment () {
+ comment () {
if [ "$comment_is_option" ]
then
comment_is_option=




2002-07-07 22:19:53

by Riley Williams

[permalink] [raw]
Subject: Re: Patch for Menuconfig script

Hi Justin.

> This is just a patch to the Menuconfig script (can be easily adapted
> to the other ones) that allows you to configure the kernel without
> the requirement of bash (I tested it with ksh, in POSIX-only mode).
> Feel free to flame me :P

Does it also work in the case where the current shell is csh or tcsh
(for example)? If not, you will need to replace the test for bash with a
test for bash or ksh or ... instead, as otherwise it will still fail.
Certainly on the systems I've used where bash isn't available, tcsh has
been far commoner than ksh.

Best wishes from Riley.

2002-07-08 15:12:20

by Tom Rini

[permalink] [raw]
Subject: Re: Patch for Menuconfig script

On Sun, Jul 07, 2002 at 11:22:10PM +0100, Riley Williams wrote:
> Hi Justin.
>
> > This is just a patch to the Menuconfig script (can be easily adapted
> > to the other ones) that allows you to configure the kernel without
> > the requirement of bash (I tested it with ksh, in POSIX-only mode).
> > Feel free to flame me :P
>
> Does it also work in the case where the current shell is csh or tcsh
> (for example)?

Er.. why wouldn't it?
$ head -1 scripts/Menuconfig
#! /bin/sh

So this removes the /bin/sh is not bash test, yes?

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

2002-07-08 15:19:37

by Justin Hibbits

[permalink] [raw]
Subject: Re: Patch for Menuconfig script

This removes the test, and also fixes the function declarations ( changes them
from 'function blah ()' to just 'blah ()' ) to make it more of a POSIX sh
script. As I put in my other reply (started another thread...problems
explained there :P ), I've only tested it on my system with 2.4.18 and ksh (but
should work out of the box on any 2.4.xx, and with little modification on
2.5.xx).

Justin Hibbits


On 07/08/02 11:14:12, Tom Rini <[email protected]> wrote:
> On Sun, Jul 07, 2002 at 11:22:10PM +0100, Riley Williams wrote:
> > Hi Justin.
> >
> > > This is just a patch to the Menuconfig script (can be easily adapted
> > > to the other ones) that allows you to configure the kernel without
> > > the requirement of bash (I tested it with ksh, in POSIX-only mode).
> > > Feel free to flame me :P
> >
> > Does it also work in the case where the current shell is csh or tcsh
> > (for example)?
>
> Er.. why wouldn't it?
> $ head -1 scripts/Menuconfig
> #! /bin/sh
>
> So this removes the /bin/sh is not bash test, yes?
>
> --
> Tom Rini (TR1265)
> http://gate.crashing.org/~trini/

2002-07-08 17:59:52

by Riley Williams

[permalink] [raw]
Subject: Re: Patch for Menuconfig script

Hi Tom.

>>> This is just a patch to the Menuconfig script (can be easily adapted
>>> to the other ones) that allows you to configure the kernel without
>>> the requirement of bash (I tested it with ksh, in POSIX-only mode).
>>> Feel free to flame me :P

>> Does it also work in the case where the current shell is csh or tcsh
>> (for example)?

> Er.. why wouldn't it?
> $ head -1 scripts/Menuconfig
> #! /bin/sh

> So this removes the /bin/sh is not bash test, yes?

Q> # ls -l /bin/sh | tr -s '\t' ' '
Q> lrwxrwxrwx 1 root root 4 May 7 1999 /bin/sh -> tcsh
Q> #

You tell me - the above is from one of the systems I regularly use,
which does not even have bash installed...

Best wishes from Riley.

2002-07-08 18:16:20

by Tom Rini

[permalink] [raw]
Subject: Re: Patch for Menuconfig script

On Mon, Jul 08, 2002 at 06:44:55PM +0100, Riley Williams wrote:
> Hi Tom.
>
> >>> This is just a patch to the Menuconfig script (can be easily adapted
> >>> to the other ones) that allows you to configure the kernel without
> >>> the requirement of bash (I tested it with ksh, in POSIX-only mode).
> >>> Feel free to flame me :P
>
> >> Does it also work in the case where the current shell is csh or tcsh
> >> (for example)?
>
> > Er.. why wouldn't it?
> > $ head -1 scripts/Menuconfig
> > #! /bin/sh
>
> > So this removes the /bin/sh is not bash test, yes?
>
> Q> # ls -l /bin/sh | tr -s '\t' ' '
> Q> lrwxrwxrwx 1 root root 4 May 7 1999 /bin/sh -> tcsh
> Q> #
>
> You tell me - the above is from one of the systems I regularly use,
> which does not even have bash installed...

So does tcsh work as a POSIX-sh when invoked as /bin/sh ?

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

2002-07-08 22:50:57

by Keith Owens

[permalink] [raw]
Subject: Re: Patch for Menuconfig script

On Mon, 8 Jul 2002 08:14:12 -0700,
Tom Rini <[email protected]> wrote:
>On Sun, Jul 07, 2002 at 11:22:10PM +0100, Riley Williams wrote:
>> > This is just a patch to the Menuconfig script (can be easily adapted
>> > to the other ones) that allows you to configure the kernel without
>> > the requirement of bash (I tested it with ksh, in POSIX-only mode).
>> > Feel free to flame me :P
>>
>> Does it also work in the case where the current shell is csh or tcsh
>> (for example)?
>
>Er.. why wouldn't it?
>$ head -1 scripts/Menuconfig
>#! /bin/sh

The #! line is irrelevant. The script is invoked via

$(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in

Large chunks of kbuild assume that CONFIG_SHELL is bash. Don't bother
trying to cleanup all the code that assumes bash, just
make CONFIG_SHELL=/path/to/bash ...

2002-07-08 23:23:25

by Sanctus Evanidus

[permalink] [raw]
Subject: Re: Patch for Menuconfig script


Keith Owens <[email protected]> wrote:

> The #! line is irrelevant. The script is invoked via
>
> $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
>
> Large chunks of kbuild assume that CONFIG_SHELL is bash. Don't bother
> trying to cleanup all the code that assumes bash, just
> make CONFIG_SHELL=/path/to/bash ...

I personaly don't think it should be assumed that every systems even has bash installed, but instead that every systems have a POSIX compilant sh.

In other words, without cleanups, someone who want to execute that script would be "forced" to install bash.

-Evan

2002-07-08 23:37:56

by Thunder from the hill

[permalink] [raw]
Subject: Re: Patch for Menuconfig script

Hi,

On Mon, 8 Jul 2002, Sanctus Evanidus wrote:
> I personaly don't think it should be assumed that every systems even has
> bash installed, but instead that every systems have a POSIX compilant
> sh.
>
> In other words, without cleanups, someone who want to execute that
> script would be "forced" to install bash.

Cool. Same discussion as for GCC once.

Regards,
Thunder
--
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o? K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y-
------END GEEK CODE BLOCK------

2002-07-10 23:11:20

by David Weinehall

[permalink] [raw]
Subject: Re: Patch for Menuconfig script

On Tue, Jul 09, 2002 at 08:53:27AM +1000, Keith Owens wrote:
> On Mon, 8 Jul 2002 08:14:12 -0700,
> Tom Rini <[email protected]> wrote:
> >On Sun, Jul 07, 2002 at 11:22:10PM +0100, Riley Williams wrote:
> >> > This is just a patch to the Menuconfig script (can be easily adapted
> >> > to the other ones) that allows you to configure the kernel without
> >> > the requirement of bash (I tested it with ksh, in POSIX-only mode).
> >> > Feel free to flame me :P
> >>
> >> Does it also work in the case where the current shell is csh or tcsh
> >> (for example)?
> >
> >Er.. why wouldn't it?
> >$ head -1 scripts/Menuconfig
> >#! /bin/sh
>
> The #! line is irrelevant. The script is invoked via
>
> $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
>
> Large chunks of kbuild assume that CONFIG_SHELL is bash. Don't bother
> trying to cleanup all the code that assumes bash, just
> make CONFIG_SHELL=/path/to/bash ...

As long as the new, bash-ignorant code is as good as the old one, and
works equally well with bash and hopefully better with other shells,
I see no harm, and a lot of benefit, in accepting the patch.

Yes, a lot of code assumes bash is there, but unlike the case of gcc,
there are good alternatives. Let us enable people who use
ksh/tcsh/rc/whatever as their main shell to remove the bash they keep
installed simply to be able to build their kernels.

For those who wonders: I use bash, nothing else. Still I think it is
silly to argue against this kind of patches because a lot of other
parts of the build-system/config-systems till depends on bash.

Getting rid of the bash:isms everywhere is far from impossible; look at
Debian, they are mostly there.


/David
_ _
// David Weinehall <[email protected]> /> Northern lights wander \\
// Maintainer of the v2.0 kernel // Dance across the winter sky //
\> http://www.acc.umu.se/~tao/ </ Full colour fire </

2002-07-10 23:37:59

by Mukesh Rajan

[permalink] [raw]
Subject: HDD test bench

hi,

i am currently exploring some power optimization algorithm for HDs
exploiting multiple power states.

i am looking for suggestions to generate a test bench simulating user
activity. i will have to open and read/write to files on the basis of a
trace file. currently i'm doing it in a very ad hoc fashion. i have some
100 dummy files of varying sizes and generating random read/write
requests. any better way would be appreciated.

thanks,
mukesh

2002-07-10 23:47:33

by Mr. James W. Laferriere

[permalink] [raw]
Subject: Re: HDD test bench


Hello Mukesh , This is one that Benno Senoner <[email protected]>
announced to the linux-fsdevel list some time back . Hth , JimL

http://www.linuxdj.com/hdrbench

On Wed, 10 Jul 2002, Mukesh Rajan wrote:

> hi,
>
> i am currently exploring some power optimization algorithm for HDs
> exploiting multiple power states.
>
> i am looking for suggestions to generate a test bench simulating user
> activity. i will have to open and read/write to files on the basis of a
> trace file. currently i'm doing it in a very ad hoc fashion. i have some
> 100 dummy files of varying sizes and generating random read/write
> requests. any better way would be appreciated.
>
> thanks,
> mukesh
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network Engineer | P.O. Box 854 | Give me Linux |
| [email protected] | Coudersport PA 16915 | only on AXP |
+------------------------------------------------------------------+


2002-07-11 07:33:14

by Adrian Bunk

[permalink] [raw]
Subject: Re: Patch for Menuconfig script

On Thu, 11 Jul 2002, David Weinehall wrote:

>...
> Getting rid of the bash:isms everywhere is far from impossible; look at
> Debian, they are mostly there.

Nothing in the Debian policy says that packages mustn't use bash in
scripts (see section 11.4. of the Debian policy [1]) and since bash is an
essential package in Debian it's garuanteed to be available on every
Debian installation.

It isn't allowed to use bash in a script that calls
#!/bin/sh
but if a script uses
#!/bin/bash
instead it can use all of bash's features.

> /David

cu
Adrian

[1] http://www.debian.org/doc/debian-policy/index.html

--

You only think this is a free country. Like the US the UK spends a lot of
time explaining its a free country because its a police state.
Alan Cox

2002-07-11 20:04:15

by Riley Williams

[permalink] [raw]
Subject: Re: Patch for Menuconfig script

Hi Tom.

>>>>> This is just a patch to the Menuconfig script (can be easily adapted
>>>>> to the other ones) that allows you to configure the kernel without
>>>>> the requirement of bash (I tested it with ksh, in POSIX-only mode).
>>>>> Feel free to flame me :P
>>>>
>>>> Does it also work in the case where the current shell is csh or tcsh
>>>> (for example)?
>>>
>>> Er.. why wouldn't it?
>>> $ head -1 scripts/Menuconfig
>>> #! /bin/sh
>>>
>>> So this removes the /bin/sh is not bash test, yes?
>>
>> Q> # ls -l /bin/sh | tr -s '\t' ' '
>> Q> lrwxrwxrwx 1 root root 4 May 7 1999 /bin/sh -> tcsh
>> Q> #
>>
>> You tell me - the above is from one of the systems I regularly use,
>> which does not even have bash installed...
>
> So does tcsh work as a POSIX-sh when invoked as /bin/sh ?

You tell me - what exactly defines "a POSIX-sh" ???

All I know is, the system in question does the job it's intended to, and
that's about all the operators care about.

Probably of more interest is this: Prior to your tweaks, the Menuconfig
script just reported that one was trying to run it under the wrong
shell. What happens when one tries to run your modified version under
those conditions? There are only two valid answers:

1. It runs successfully.

2. It reports that it can't run under that shell.

You're the one proposing the patch, so you're the one who needs to
answer that question.

Best wishes from Riley.

2002-07-11 20:20:54

by Tom Rini

[permalink] [raw]
Subject: Re: Patch for Menuconfig script

On Thu, Jul 11, 2002 at 09:06:50PM +0100, Riley Williams wrote:
> Hi Tom.
>
> >>>>> This is just a patch to the Menuconfig script (can be easily adapted
> >>>>> to the other ones) that allows you to configure the kernel without
> >>>>> the requirement of bash (I tested it with ksh, in POSIX-only mode).
> >>>>> Feel free to flame me :P
> >>>>
> >>>> Does it also work in the case where the current shell is csh or tcsh
> >>>> (for example)?
> >>>
> >>> Er.. why wouldn't it?
> >>> $ head -1 scripts/Menuconfig
> >>> #! /bin/sh
> >>>
> >>> So this removes the /bin/sh is not bash test, yes?
> >>
> >> Q> # ls -l /bin/sh | tr -s '\t' ' '
> >> Q> lrwxrwxrwx 1 root root 4 May 7 1999 /bin/sh -> tcsh
> >> Q> #
> >>
> >> You tell me - the above is from one of the systems I regularly use,
> >> which does not even have bash installed...
> >
> > So does tcsh work as a POSIX-sh when invoked as /bin/sh ?
>
> You tell me - what exactly defines "a POSIX-sh" ???

http://www.opengroup.org/onlinepubs/007904975/toc.htm

> Probably of more interest is this: Prior to your tweaks, the Menuconfig
> script just reported that one was trying to run it under the wrong
> shell. What happens when one tries to run your modified version under
> those conditions? There are only two valid answers:

Remember, Keith Owens pointed out that it's really a test of
CONFIG_SHELL, not /bin/sh.

> 1. It runs successfully.
>
> 2. It reports that it can't run under that shell.
>
> You're the one proposing the patch, so you're the one who needs to
> answer that question.

Well, my understanding of the patch is that it removes all of the
bash'ism and related from the script, so that any shell which will
accept things from the above URL will work. So one of two things will
happen when /bin/sh != /bin/bash

1. The shell is complaint, and modulo bugs in the shell or script, it
will work. This should be the common case.

2. The shell is not compliant, and the system is misconfigured.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/