Re: [patch 1/3, resend] scripts: replace gawk, head, bc with shell, update

Previous thread: [patch 3/3, resend] kbuild: correctly skip tilded backups in localversion files by Oleg Verych on Monday, February 5, 2007 - 6:18 pm. (12 messages)

Next thread: [patch 2/3, resend] kbuild: improve option checking, Kbuild.include cleanup by Oleg Verych on Monday, February 5, 2007 - 6:18 pm. (4 messages)
From: Oleg Verych
Date: Monday, February 5, 2007 - 6:18 pm

scripts: replace gawk, head, bc with shell, update

  Replacing overhead of using some (external) programs
  instead of good old `sh'.

Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: William Stearns <wstearns@pobox.com>
Cc: Martin Schlemmer <azarah@nosferatu.za.org>
Signed-off-by: Oleg Verych <olecom@flower.upol.cz>
---

 Whitespace cleanup included.

 scripts/gen_initramfs_list.sh | 43 +++++++++++++++++++++---------------------
 scripts/makelst               | 34 ++++++++++++++++-----------------
 2 files changed, 39 insertions(+), 38 deletions(-)

Index: linux-2.6.20/scripts/makelst
===================================================================
--- linux-2.6.20.orig/scripts/makelst	2007-02-06 02:12:38.811908000 +0100
+++ linux-2.6.20/scripts/makelst	2007-02-06 02:12:43.688212750 +0100
@@ -1,31 +1,31 @@
-#!/bin/bash
+#!/bin/sh
 # A script to dump mixed source code & assembly
 # with correct relocations from System.map
-# Requires the following lines in Rules.make.
-# Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 
-#            William Stearns <wstearns@pobox.com>
+# Requires the following lines in makefile:
 #%.lst: %.c
 #	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $<
-#	$(TOPDIR)/scripts/makelst $*.o $(TOPDIR)/System.map $(OBJDUMP)
+#	$(srctree)/scripts/makelst $*.o $(objtree)/System.map $(OBJDUMP)
 #
-#    Copyright (C) 2000 IBM Corporation
-#    Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 
+# Copyright (C) 2000 IBM Corporation
+# Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
+#            William Stearns <wstearns@pobox.com>
 #
 
-t1=`$3 --syms $1 | grep .text | grep " F " | head -n 1`
+# awk style field access
+field() {
+  shift $1 ; echo $1
+}
+
+t1=`$3 --syms $1 | grep .text | grep -m1 " F "`
 if [ -n "$t1" ]; then
-  t2=`echo $t1 | gawk '{ print $6 }'`
+  t2=`field 6 $t1`
   if [ ! -r $2 ]; then
     echo "No System.map" >&2
-    t7=0
   ...
From: Mark Lord
Date: Tuesday, February 6, 2007 - 7:49 am

Cheers
-

From: Oleg Verych
Date: Tuesday, February 6, 2007 - 9:47 am

`---- here -----'

Without jokes, it even commented:

+# awk style field access
+field() {
+  shift $1 ; echo $1
+}
____
-

From: Mark Lord
Date: Tuesday, February 6, 2007 - 10:13 am

Oleg Verych wrote:

Ack.
-

From: Jesper Juhl
Date: Wednesday, February 7, 2007 - 1:58 am

I don't like this change much.  We don't know what shell /bin/sh is on
a random users system - much better to be explicit and make sure we
use/require bash.
I expect this change to cause pain for users who have zsh, csh, ksh,
ash or some other shell as /bin/sh but also have /bin/bash available.
Previously things would just work, but now it will possibly break due
to using a different shell.

-- 
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
-

From: Oleg Verych
Date: Wednesday, February 7, 2007 - 6:02 am

I've tested on dash, that is `sh'. Everybody is welcome to test on his
favorite `/bin/sh' compatible shell.

It's very unclear from bash man page, where are extentions, and where are
common features. That particular script is small and non-bash oriented,
unlike gen_initramfs_list.sh [s/sh/bash].

Thus it's OK, even in scope of SUSv3 "incompatible" "%ul" in `printf'
(see my other reply on that).

____
-

From: Roman Zippel
Date: Wednesday, February 7, 2007 - 7:28 am

Hi,



Acked-by: Roman Zippel <zippel@linux-m68k.org>

bye, Roman
-

Previous thread: [patch 3/3, resend] kbuild: correctly skip tilded backups in localversion files by Oleg Verych on Monday, February 5, 2007 - 6:18 pm. (12 messages)

Next thread: [patch 2/3, resend] kbuild: improve option checking, Kbuild.include cleanup by Oleg Verych on Monday, February 5, 2007 - 6:18 pm. (4 messages)