Skip to contentSkip to conversation

scripts/config: bug fix and improvement

PATCH In review Clement Chauplannaz 3 participants 8 messages May 12, 2013 – May 20, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

cover scripts/config: bug fix and improvement

Hi all,

Here are two tiny patches which deal with scripts/config.

The first sets the reported name of the script to be what it was invoked as - this is of importance for kconfig-frontends package, where the script is renamed.

The second fixes a bug in the assignement of parameters required by options -E/-D/-M; those are the options allowing to position a value below another one.

Clement Chauplannaz (2):
scripts/config: replace hard-coded script name by a dynamic value scripts/config: fix assignment of parameters for short version of
--*-after options

 scripts/config | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
Signature · 1 line
1.8.3.rc1.44.gb387c77.dirty
#1 lore raw

PATCH 1/2 scripts/config: replace hard-coded script name by a dynamic value

The script config' prints its name in usage() function. It is currently hard-coded to value config'. However, the script may be reused under a different name in contexts other than the Linux Kernel.

Replace the hard-coded value `config' by the name of the script at runtime.

---
 scripts/config | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
scripts/config +7 -5
index bb4d3de..6b3272e 100755
@@ -1,6 +1,8 @@
 #!/bin/bash
 # Manipulate options in a .config file from the command line
 
+myname=${0##*/}
+
 # If no prefix forced, use the default CONFIG_
 CONFIG_="${CONFIG_-CONFIG_}"
 
@@ -8,7 +10,7 @@ usage() {
 	cat >&2 <<EOL
 Manipulate options in a .config file from the command line.
 Usage:
-config options command ...
+$myname options command ...
 commands:
 	--enable|-e option   Enable option
 	--disable|-d option  Disable option
@@ -33,14 +35,14 @@ options:
 	--file config-file   .config file to change (default .config)
 	--keep-case|-k       Keep next symbols' case (dont' upper-case it)
 
-config doesn't check the validity of the .config file. This is done at next
+$myname doesn't check the validity of the .config file. This is done at next
 make time.
 
-By default, config will upper-case the given symbol. Use --keep-case to keep
+By default, $myname will upper-case the given symbol. Use --keep-case to keep
 the case of all following symbols unchanged.
 
-config uses 'CONFIG_' as the default symbol prefix. Set the environment
-variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ...
+$myname uses 'CONFIG_' as the default symbol prefix. Set the environment
+variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" $myname ...
 EOL
 	exit 1
 }
Signature · 1 line
1.8.3.rc1.44.gb387c77.dirty
#6 lore raw

PATCH 2/2 scripts/config: fix assignment of parameters for short version of --*-after options

In reply to Clement Chauplannaz

When --*-after options are used, two parameters are parsed from the command-line before the adequate function is called:
- the `before' option, after which the new option will be inserted,
- the name of the option to enable/disable/modularise.

With the short version of --*-after options (namely -E, -D, -M), the parsing step is not performed which leads to processing unset variables.

Add options -E, -D, -M to the test that triggers assignment of parameters for --*-after options.

---
 scripts/config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/config +1 -1
index 6b3272e..567120a 100755
@@ -107,7 +107,7 @@ while [ "$1" != "" ] ; do
 		;;
 	--refresh)
 		;;
-	--*-after)
+	--*-after|-E|-D|-M)
 		checkarg "$1"
 		A=$ARG
 		checkarg "$2"
Signature · 1 line
1.8.3.rc1.44.gb387c77.dirty
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] scripts/config: replace hard-coded script name by a dynamic value

In reply to Clement Chauplannaz
Quoted 7 lines · Clement Chauplannaz

The script config' prints its name in usage() function. It is currently hard-coded to value config'. However, the script may be reused under a different name in contexts other than the Linux Kernel.

Replace the hard-coded value `config' by the name of the script at runtime.

Both patched are fine for me.

-Andi

#3 lore raw

Re: [PATCH 1/2] scripts/config: replace hard-coded script name by a dynamic value

Andy, Clément, All,

On 2013-05-12 21:25 +0200, Andi Kleen spake thusly:

Quoted 11 lines · Clement Chauplannaz
Quoted 7 lines

The script config' prints its name in usage() function. It is currently hard-coded to value config'. However, the script may be reused under a different name in contexts other than the Linux Kernel.

Replace the hard-coded value `config' by the name of the script at runtime.

Both patched are fine for me.

It's too late for 3.10 now, so I'll queue them in my tree for 3.11.

Thank you!

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

Re: [PATCH 1/2] scripts/config: replace hard-coded script name by a dynamic value

Thanks!
Clément

2013/5/12 Yann E. MORIN <[email protected]>:

Quoted 29 lines

Andy, Clément, All,

On 2013-05-12 21:25 +0200, Andi Kleen spake thusly:

Quoted 11 lines · Clement Chauplannaz
Quoted 7 lines

The script config' prints its name in usage() function. It is currently hard-coded to value config'. However, the script may be reused under a different name in contexts other than the Linux Kernel.

Replace the hard-coded value `config' by the name of the script at runtime.

Both patched are fine for me.

It's too late for 3.10 now, so I'll queue them in my tree for 3.11.

Thank you!

Regards,
Yann E. MORIN.

--
.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

'------------------------------^-------^------------------^--------------------'

#7 lore raw

Re: [PATCH 2/2] scripts/config: fix assignment of parameters for short version of --*-after options

In reply to Clement Chauplannaz

Clément, All,

On 2013-05-12 21:08 +0200, Clement Chauplannaz spake thusly:

Quoted 5 lines

When --*-after options are used, two parameters are parsed from the command-line before the adequate function is called:
- the `before' option, after which the new option will be inserted,
- the name of the option to enable/disable/modularise.

Quoted 7 lines

With the short version of --*-after options (namely -E, -D, -M), the parsing step is not performed which leads to processing unset variables.

Add options -E, -D, -M to the test that triggers assignment of parameters for --*-after options.

I've applied this to my tree in the branch yem-kconfig-rc-fixes, for which I've just sent a pull-request to Michal. Thank you!

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

Re: [PATCH 1/2] scripts/config: replace hard-coded script name by a dynamic value

In reply to Clement Chauplannaz

Clément, All,

On 2013-05-12 21:08 +0200, Clement Chauplannaz spake thusly:

Quoted 7 lines

The script config' prints its name in usage() function. It is currently hard-coded to value config'. However, the script may be reused under a different name in contexts other than the Linux Kernel.

Replace the hard-coded value `config' by the name of the script at runtime.

I've applied this in my tree in the branch yem-kconfig-for-next, for inclusion upstream when the 3.11 merge window opens. Thank you!

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'