public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] IDcheck.sh - awk problem
@ 2009-07-08  6:04 Michal Simek
  2009-07-08 14:19 ` Garrett Cooper
  0 siblings, 1 reply; 10+ messages in thread
From: Michal Simek @ 2009-07-08  6:04 UTC (permalink / raw)
  To: LTP, yanegomi

Hi All,

There will be good to prevent missing /etc/passwd for installing to
different folder.

export DESTDIR=`pwd`/nfs
mkdir -p nfs
make install

Thanks,
Michal


Checking for required user/group ids

awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
such file or directory)
bin => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
such file or directory)
daemon => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
such file or directory)
nobody => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
such file or directory)
bin => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
such file or directory)
daemon => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
such file or directory)
nobody => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
such file or directory)
sys => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
such file or directory)
users => 2
'nobody' user id and group found.
'bin' user id and group found.
'daemon' user id and group found.
Users group found.
Sys group found.
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
such file or directory)
nobody => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
such file or directory)
nobody => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
such file or directory)
bin => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
such file or directory)
bin => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
such file or directory)
daemon => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
such file or directory)
daemon => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
such file or directory)
users => 2
awk: cmd. line:1: fatal: cannot open file
`/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
such file or directory)
sys => 2
Required users/groups exist.


-- 
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] IDcheck.sh - awk problem
  2009-07-08  6:04 [LTP] IDcheck.sh - awk problem Michal Simek
@ 2009-07-08 14:19 ` Garrett Cooper
  2009-07-08 14:36   ` Michal Simek
  0 siblings, 1 reply; 10+ messages in thread
From: Garrett Cooper @ 2009-07-08 14:19 UTC (permalink / raw)
  To: michal.simek; +Cc: LTP

On Tue, Jul 7, 2009 at 11:04 PM, Michal Simek<michal.simek@petalogix.com> wrote:
> Hi All,
>
> There will be good to prevent missing /etc/passwd for installing to
> different folder.
>
> export DESTDIR=`pwd`/nfs
> mkdir -p nfs
> make install
>
> Thanks,
> Michal
>
>
> Checking for required user/group ids
>
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
> such file or directory)
> bin => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
> such file or directory)
> daemon => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
> such file or directory)
> nobody => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
> such file or directory)
> bin => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
> such file or directory)
> daemon => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
> such file or directory)
> nobody => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
> such file or directory)
> sys => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
> such file or directory)
> users => 2
> 'nobody' user id and group found.
> 'bin' user id and group found.
> 'daemon' user id and group found.
> Users group found.
> Sys group found.
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
> such file or directory)
> nobody => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
> such file or directory)
> nobody => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
> such file or directory)
> bin => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
> such file or directory)
> bin => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
> such file or directory)
> daemon => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
> such file or directory)
> daemon => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
> such file or directory)
> users => 2
> awk: cmd. line:1: fatal: cannot open file
> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
> such file or directory)
> sys => 2
> Required users/groups exist.

That's part of the reason why I wanted it to be reviewed before it was
committed, and I halfway expected Mike to provide that assistance but
he didn't... *sigh*.

Does the /etc/passwd // /etc/group file exist?

Thanks,
-Garrett

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] IDcheck.sh - awk problem
  2009-07-08 14:19 ` Garrett Cooper
@ 2009-07-08 14:36   ` Michal Simek
  2009-07-09  5:30     ` Garrett Cooper
  0 siblings, 1 reply; 10+ messages in thread
From: Michal Simek @ 2009-07-08 14:36 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: LTP, Mike Frysinger

Garrett Cooper wrote:
> On Tue, Jul 7, 2009 at 11:04 PM, Michal Simek<michal.simek@petalogix.com> wrote:
>   
>> Hi All,
>>
>> There will be good to prevent missing /etc/passwd for installing to
>> different folder.
>>
>> export DESTDIR=`pwd`/nfs
>> mkdir -p nfs
>> make install
>>
>> Thanks,
>> Michal
>>
>>
>> Checking for required user/group ids
>>
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
>> such file or directory)
>> bin => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
>> such file or directory)
>> daemon => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
>> such file or directory)
>> nobody => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
>> such file or directory)
>> bin => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
>> such file or directory)
>> daemon => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
>> such file or directory)
>> nobody => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
>> such file or directory)
>> sys => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
>> such file or directory)
>> users => 2
>> 'nobody' user id and group found.
>> 'bin' user id and group found.
>> 'daemon' user id and group found.
>> Users group found.
>> Sys group found.
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
>> such file or directory)
>> nobody => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
>> such file or directory)
>> nobody => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
>> such file or directory)
>> bin => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
>> such file or directory)
>> bin => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/group' for reading (No
>> such file or directory)
>> daemon => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
>> such file or directory)
>> daemon => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
>> such file or directory)
>> users => 2
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/projects/xils/ltp-microblaze.git/nfs/etc/passwd' for reading (No
>> such file or directory)
>> sys => 2
>> Required users/groups exist.
>>     
>
> That's part of the reason why I wanted it to be reviewed before it was
> committed, and I halfway expected Mike to provide that assistance but
> he didn't... *sigh*.
>
> Does the /etc/passwd // /etc/group file exist?
>   
Of course not because I cross compile ltp for Microblaze - correct
/etc/passwd - group is on
target system. Maybe worth to remove calling IDcheck.sh from make
install and call it only before
running the test.

Michal

> Thanks,
> -Garrett
>   


-- 
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] IDcheck.sh - awk problem
  2009-07-08 14:36   ` Michal Simek
@ 2009-07-09  5:30     ` Garrett Cooper
  2009-07-09 10:28       ` Michal Simek
  0 siblings, 1 reply; 10+ messages in thread
From: Garrett Cooper @ 2009-07-09  5:30 UTC (permalink / raw)
  To: michal.simek; +Cc: LTP, Mike Frysinger

[-- Attachment #1: Type: text/plain, Size: 3676 bytes --]

On Wed, Jul 8, 2009 at 7:36 AM, Michal Simek<michal.simek@petalogix.com> wrote:
>
> Of course not because I cross compile ltp for Microblaze - correct
> /etc/passwd - group is on
> target system. Maybe worth to remove calling IDcheck.sh from make
> install and call it only before
> running the test.
>

Michal,
    Please give this patch a try, and instead when you run make
install, do SKIP_IDCHECK=1.
HTH,
-Garrett

This patch does the same as the previous released patch in this
thread, which is:

IDcheck.sh:
1. Fixes the DESTDIR != "" | "/" behavior.
2. Spew out less awk errors if files don't exist by instead
short-circuiting the logic to detect whether or not the file exists in
the fe function subroutine.

In addition to the above, this adds SKIP_IDCHECK behavior, by request
of Michal, so it's no longer required for make install, and can be
disabled by entering specifying the variable SKIP_IDCHECK=1 when
calling make install, e.g...

make \
[make-options-and-variables] \
SKIP_IDCHECK=1 \
install

Warning! This patch has Makefile changes and as such the files patched
contents should be committed directly, NOT the inline text shown below
(for reviewing purposes only).

Signed-off-by: Garrett Cooper <yanegomi@gmail.com>

Index: IDcheck.sh
===================================================================
RCS file: /cvsroot/ltp/ltp/IDcheck.sh,v
retrieving revision 1.19
diff -u -r1.19 IDcheck.sh
--- IDcheck.sh  7 Jul 2009 14:30:27 -0000       1.19
+++ IDcheck.sh  9 Jul 2009 05:21:34 -0000
@@ -22,7 +22,6 @@
 #

 # Prompt user if ids/groups should be created
-clear
 echo "Checking for required user/group ids"
 echo ""

@@ -41,12 +40,11 @@

 # find entry.
 fe() {
-       ID=$1; shift
-       FILE=$1; shift
-       awk "/^$ID:/ { FOUND=1 } END { if (\$FOUND == 1) { exit 0; }
exit 1; }" \
-       "$FILE"
-       ec=$?
-       echo "$ID => $ec"
+    ID=$1; shift
+    FILE=$1; shift
+    [ -e "$FILE" ] || return $?
+    awk "/^$ID:/ { FOUND=1 } END { if (\$FOUND == 1) { exit 1; } exit 0; }" \
+    "$FILE"
 }

 prompt_for_create() {
@@ -70,13 +68,12 @@
        EUID=$(id -u)
 fi

-if [ -e "$passwd" -a ! -r "$passwd" ] ; then
-       echo "/etc/passwd not readable by uid $EUID"
+for i in "$passwd" "$group"; do
+    if [ -e "$i" -a ! -r "$i" ] ; then
+       echo "$i not readable by uid $EUID"
        exit 1
-elif [ -e "$group" -a ! -r "$group" ] ; then
-       echo "$group not readable by uid $EUID"
-       exit 1
-fi
+    fi
+done

 fe bin "$passwd"; NO_BIN_ID=$?
 fe daemon "$passwd"; NO_DAEMON_ID=$?
@@ -110,10 +107,10 @@
 #debug_vals

 if [ $CREATE_ENTRIES -ne 0 ] ; then
-       if ! touch "$group" ; then
-               echo "Couldn't touch $group"
-               exit 1
-       fi
+    if ! touch "$group" "$passwd" 2>/dev/null; then
+        echo "Failed to touch $group or $passwd"
+        exit 1
+    fi
 fi

 make_user_group() {
Index: Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/Makefile,v
retrieving revision 1.39
diff -u -r1.39 Makefile
--- Makefile    25 Mar 2009 06:17:48 -0000      1.39
+++ Makefile    9 Jul 2009 05:27:34 -0000
@@ -14,6 +14,10 @@
 export CFLAGS += -Wall $(CROSS_CFLAGS)
 export CC AR RANLIB CPPFLAGS LDFLAGS HAS_NUMA

+# SKIP_IDCHECK != 1, defaults to previous behavior, which is to execute
+# IDcheck.sh at the end of `make install'.
+SKIP_IDCHECK           ?= 0
+
 -include config.mk

 VPATH += include m4
@@ -36,8 +40,9 @@
        @$(MAKE) -C m4 install
        @$(MAKE) -C doc/man1 install
        @$(MAKE) -C doc/man3 install
-
+ifneq ($(filter $(SKIP_IDCHECK)),1)
        @./IDcheck.sh
+endif

 libltp.a: config.h
        @$(MAKE) -C lib $@

[-- Attachment #2: IDcheck_awk_fix+skip_check.diff --]
[-- Type: application/octet-stream, Size: 2281 bytes --]

Index: IDcheck.sh
===================================================================
RCS file: /cvsroot/ltp/ltp/IDcheck.sh,v
retrieving revision 1.19
diff -u -r1.19 IDcheck.sh
--- IDcheck.sh	7 Jul 2009 14:30:27 -0000	1.19
+++ IDcheck.sh	9 Jul 2009 05:27:34 -0000
@@ -22,7 +22,6 @@
 #
 
 # Prompt user if ids/groups should be created
-clear
 echo "Checking for required user/group ids"
 echo ""
 
@@ -41,12 +40,11 @@
 
 # find entry.
 fe() {
-	ID=$1; shift
-	FILE=$1; shift
-	awk "/^$ID:/ { FOUND=1 } END { if (\$FOUND == 1) { exit 0; } exit 1; }" \
-	"$FILE"
-	ec=$?
-	echo "$ID => $ec"
+    ID=$1; shift
+    FILE=$1; shift
+    [ -e "$FILE" ] || return $?
+    awk "/^$ID:/ { FOUND=1 } END { if (\$FOUND == 1) { exit 1; } exit 0; }" \
+    "$FILE"
 }
 
 prompt_for_create() {
@@ -70,13 +68,12 @@
 	EUID=$(id -u)
 fi
 
-if [ -e "$passwd" -a ! -r "$passwd" ] ; then
-	echo "/etc/passwd not readable by uid $EUID"
+for i in "$passwd" "$group"; do
+    if [ -e "$i" -a ! -r "$i" ] ; then
+	echo "$i not readable by uid $EUID"
 	exit 1
-elif [ -e "$group" -a ! -r "$group" ] ; then
-	echo "$group not readable by uid $EUID"
-	exit 1
-fi
+    fi
+done
 
 fe bin "$passwd"; NO_BIN_ID=$?
 fe daemon "$passwd"; NO_DAEMON_ID=$?
@@ -110,10 +107,10 @@
 #debug_vals
 
 if [ $CREATE_ENTRIES -ne 0 ] ; then
-	if ! touch "$group" ; then
-		echo "Couldn't touch $group"
-		exit 1
-	fi
+    if ! touch "$group" "$passwd" 2>/dev/null; then
+        echo "Failed to touch $group or $passwd"
+        exit 1
+    fi
 fi
 
 make_user_group() {
Index: Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/Makefile,v
retrieving revision 1.39
diff -u -r1.39 Makefile
--- Makefile	25 Mar 2009 06:17:48 -0000	1.39
+++ Makefile	9 Jul 2009 05:27:34 -0000
@@ -14,6 +14,10 @@
 export CFLAGS += -Wall $(CROSS_CFLAGS)
 export CC AR RANLIB CPPFLAGS LDFLAGS HAS_NUMA
 
+# SKIP_IDCHECK	!= 1, defaults to previous behavior, which is to execute
+# IDcheck.sh at the end of `make install'.
+SKIP_IDCHECK		?= 0 
+
 -include config.mk
 
 VPATH += include m4
@@ -36,8 +40,9 @@
 	@$(MAKE) -C m4 install
 	@$(MAKE) -C doc/man1 install
 	@$(MAKE) -C doc/man3 install
-
+ifneq ($(filter $(SKIP_IDCHECK)),1)
 	@./IDcheck.sh
+endif
 
 libltp.a: config.h
 	@$(MAKE) -C lib $@

[-- Attachment #3: Type: text/plain, Size: 389 bytes --]

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] IDcheck.sh - awk problem
  2009-07-09  5:30     ` Garrett Cooper
@ 2009-07-09 10:28       ` Michal Simek
  2009-07-09 17:11         ` Garrett Cooper
  0 siblings, 1 reply; 10+ messages in thread
From: Michal Simek @ 2009-07-09 10:28 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: LTP, Mike Frysinger

Garrett Cooper wrote:
> On Wed, Jul 8, 2009 at 7:36 AM, Michal Simek<michal.simek@petalogix.com> wrote:
>   
>> Of course not because I cross compile ltp for Microblaze - correct
>> /etc/passwd - group is on
>> target system. Maybe worth to remove calling IDcheck.sh from make
>> install and call it only before
>> running the test.
>>
>>     
>
> Michal,
>     Please give this patch a try, and instead when you run make
> install, do SKIP_IDCHECK=1.
> HTH,
> -Garrett
>
> This patch does the same as the previous released patch in this
> thread, which is:
>
> IDcheck.sh:
> 1. Fixes the DESTDIR != "" | "/" behavior.
> 2. Spew out less awk errors if files don't exist by instead
> short-circuiting the logic to detect whether or not the file exists in
> the fe function subroutine.
>
> In addition to the above, this adds SKIP_IDCHECK behavior, by request
> of Michal, so it's no longer required for make install, and can be
> disabled by entering specifying the variable SKIP_IDCHECK=1 when
> calling make install, e.g...
>
> make \
> [make-options-and-variables] \
> SKIP_IDCHECK=1 \
> install
>   
you should add SKIP_IDCHECK to uclinux_install too.

[monstr@monstr ltp-microblaze.git]$ make SKIP_IDCHECK=1 install
Makefile:43: *** insufficient number of arguments (1) to function
`filter'.  Stop.

Michal

> Warning! This patch has Makefile changes and as such the files patched
> contents should be committed directly, NOT the inline text shown below
> (for reviewing purposes only).
>
> Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
>
> Index: IDcheck.sh
> ===================================================================
> RCS file: /cvsroot/ltp/ltp/IDcheck.sh,v
> retrieving revision 1.19
> diff -u -r1.19 IDcheck.sh
> --- IDcheck.sh  7 Jul 2009 14:30:27 -0000       1.19
> +++ IDcheck.sh  9 Jul 2009 05:21:34 -0000
> @@ -22,7 +22,6 @@
>  #
>
>  # Prompt user if ids/groups should be created
> -clear
>  echo "Checking for required user/group ids"
>  echo ""
>
> @@ -41,12 +40,11 @@
>
>  # find entry.
>  fe() {
> -       ID=$1; shift
> -       FILE=$1; shift
> -       awk "/^$ID:/ { FOUND=1 } END { if (\$FOUND == 1) { exit 0; }
> exit 1; }" \
> -       "$FILE"
> -       ec=$?
> -       echo "$ID => $ec"
> +    ID=$1; shift
> +    FILE=$1; shift
> +    [ -e "$FILE" ] || return $?
> +    awk "/^$ID:/ { FOUND=1 } END { if (\$FOUND == 1) { exit 1; } exit 0; }" \
> +    "$FILE"
>  }
>
>  prompt_for_create() {
> @@ -70,13 +68,12 @@
>         EUID=$(id -u)
>  fi
>
> -if [ -e "$passwd" -a ! -r "$passwd" ] ; then
> -       echo "/etc/passwd not readable by uid $EUID"
> +for i in "$passwd" "$group"; do
> +    if [ -e "$i" -a ! -r "$i" ] ; then
> +       echo "$i not readable by uid $EUID"
>         exit 1
> -elif [ -e "$group" -a ! -r "$group" ] ; then
> -       echo "$group not readable by uid $EUID"
> -       exit 1
> -fi
> +    fi
> +done
>
>  fe bin "$passwd"; NO_BIN_ID=$?
>  fe daemon "$passwd"; NO_DAEMON_ID=$?
> @@ -110,10 +107,10 @@
>  #debug_vals
>
>  if [ $CREATE_ENTRIES -ne 0 ] ; then
> -       if ! touch "$group" ; then
> -               echo "Couldn't touch $group"
> -               exit 1
> -       fi
> +    if ! touch "$group" "$passwd" 2>/dev/null; then
> +        echo "Failed to touch $group or $passwd"
> +        exit 1
> +    fi
>  fi
>
>  make_user_group() {
> Index: Makefile
> ===================================================================
> RCS file: /cvsroot/ltp/ltp/Makefile,v
> retrieving revision 1.39
> diff -u -r1.39 Makefile
> --- Makefile    25 Mar 2009 06:17:48 -0000      1.39
> +++ Makefile    9 Jul 2009 05:27:34 -0000
> @@ -14,6 +14,10 @@
>  export CFLAGS += -Wall $(CROSS_CFLAGS)
>  export CC AR RANLIB CPPFLAGS LDFLAGS HAS_NUMA
>
> +# SKIP_IDCHECK != 1, defaults to previous behavior, which is to execute
> +# IDcheck.sh at the end of `make install'.
> +SKIP_IDCHECK           ?= 0
> +
>  -include config.mk
>
>  VPATH += include m4
> @@ -36,8 +40,9 @@
>         @$(MAKE) -C m4 install
>         @$(MAKE) -C doc/man1 install
>         @$(MAKE) -C doc/man3 install
> -
> +ifneq ($(filter $(SKIP_IDCHECK)),1)
>         @./IDcheck.sh
> +endif
>
>  libltp.a: config.h
>         @$(MAKE) -C lib $@
>   


-- 
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] IDcheck.sh - awk problem
  2009-07-09 10:28       ` Michal Simek
@ 2009-07-09 17:11         ` Garrett Cooper
  2009-07-10 18:04           ` Michal Simek
  0 siblings, 1 reply; 10+ messages in thread
From: Garrett Cooper @ 2009-07-09 17:11 UTC (permalink / raw)
  To: michal.simek; +Cc: LTP, Mike Frysinger

[-- Attachment #1: Type: text/plain, Size: 744 bytes --]

On Thu, Jul 9, 2009 at 3:28 AM, Michal Simek<michal.simek@petalogix.com> wrote:
> Garrett Cooper wrote:
>> On Wed, Jul 8, 2009 at 7:36 AM, Michal Simek<michal.simek@petalogix.com> wrote:
>>
>>> Of course not because I cross compile ltp for Microblaze - correct
>>> /etc/passwd - group is on
>>> target system. Maybe worth to remove calling IDcheck.sh from make
>>> install and call it only before
>>> running the test.
>>>
>>>
>>
>> Michal,
>>     Please give this patch a try, and instead when you run make
>> install, do SKIP_IDCHECK=1.
>> HTH,
>> -Garrett

Wow. I must have been tired at the time; no idea why I used filter
instead of strip. Please try this instead.

Signed-off-by: Garrett Cooper <yanegomi@gmail.com>

[-- Attachment #2: IDcheck_awk_fix+skip_check.diff --]
[-- Type: application/octet-stream, Size: 2509 bytes --]

Index: IDcheck.sh
===================================================================
RCS file: /cvsroot/ltp/ltp/IDcheck.sh,v
retrieving revision 1.19
diff -u -r1.19 IDcheck.sh
--- IDcheck.sh	7 Jul 2009 14:30:27 -0000	1.19
+++ IDcheck.sh	9 Jul 2009 17:07:36 -0000
@@ -22,7 +22,6 @@
 #
 
 # Prompt user if ids/groups should be created
-clear
 echo "Checking for required user/group ids"
 echo ""
 
@@ -41,12 +40,11 @@
 
 # find entry.
 fe() {
-	ID=$1; shift
-	FILE=$1; shift
-	awk "/^$ID:/ { FOUND=1 } END { if (\$FOUND == 1) { exit 0; } exit 1; }" \
-	"$FILE"
-	ec=$?
-	echo "$ID => $ec"
+    ID=$1; shift
+    FILE=$1; shift
+    [ -e "$FILE" ] || return $?
+    awk "/^$ID:/ { FOUND=1 } END { if (\$FOUND == 1) { exit 1; } exit 0; }" \
+    "$FILE"
 }
 
 prompt_for_create() {
@@ -70,13 +68,12 @@
 	EUID=$(id -u)
 fi
 
-if [ -e "$passwd" -a ! -r "$passwd" ] ; then
-	echo "/etc/passwd not readable by uid $EUID"
+for i in "$passwd" "$group"; do
+    if [ -e "$i" -a ! -r "$i" ] ; then
+	echo "$i not readable by uid $EUID"
 	exit 1
-elif [ -e "$group" -a ! -r "$group" ] ; then
-	echo "$group not readable by uid $EUID"
-	exit 1
-fi
+    fi
+done
 
 fe bin "$passwd"; NO_BIN_ID=$?
 fe daemon "$passwd"; NO_DAEMON_ID=$?
@@ -110,10 +107,10 @@
 #debug_vals
 
 if [ $CREATE_ENTRIES -ne 0 ] ; then
-	if ! touch "$group" ; then
-		echo "Couldn't touch $group"
-		exit 1
-	fi
+    if ! touch "$group" "$passwd" 2>/dev/null; then
+        echo "Failed to touch $group or $passwd"
+        exit 1
+    fi
 fi
 
 make_user_group() {
Index: Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/Makefile,v
retrieving revision 1.39
diff -u -r1.39 Makefile
--- Makefile	25 Mar 2009 06:17:48 -0000	1.39
+++ Makefile	9 Jul 2009 17:07:36 -0000
@@ -14,6 +14,10 @@
 export CFLAGS += -Wall $(CROSS_CFLAGS)
 export CC AR RANLIB CPPFLAGS LDFLAGS HAS_NUMA
 
+# SKIP_IDCHECK	!= 1, defaults to previous behavior, which is to execute
+# IDcheck.sh at the end of `make install'.
+SKIP_IDCHECK		?= 0 
+
 -include config.mk
 
 VPATH += include m4
@@ -36,8 +40,9 @@
 	@$(MAKE) -C m4 install
 	@$(MAKE) -C doc/man1 install
 	@$(MAKE) -C doc/man3 install
-
+ifneq ($(strip $(SKIP_IDCHECK)),1)
 	@./IDcheck.sh
+endif
 
 libltp.a: config.h
 	@$(MAKE) -C lib $@
@@ -54,7 +59,9 @@
 uclinux_install: uclinux
 	@$(MAKE) -C testcases uclinux_install
 	@$(MAKE) -C tools install
+ifneq ($(strip $(SKIP_IDCHECK)),1)
 	@./IDcheck.sh
+endif
 
 uclinux_libltp.a:
 	@$(MAKE) -C lib UCLINUX=1 libltp.a

[-- Attachment #3: Type: text/plain, Size: 389 bytes --]

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] IDcheck.sh - awk problem
  2009-07-09 17:11         ` Garrett Cooper
@ 2009-07-10 18:04           ` Michal Simek
  2009-07-10 19:21             ` Garrett Cooper
  0 siblings, 1 reply; 10+ messages in thread
From: Michal Simek @ 2009-07-10 18:04 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: LTP, Mike Frysinger

Garrett Cooper wrote:
> On Thu, Jul 9, 2009 at 3:28 AM, Michal Simek<michal.simek@petalogix.com> wrote:
>   
>> Garrett Cooper wrote:
>>     
>>> On Wed, Jul 8, 2009 at 7:36 AM, Michal Simek<michal.simek@petalogix.com> wrote:
>>>
>>>       
>>>> Of course not because I cross compile ltp for Microblaze - correct
>>>> /etc/passwd - group is on
>>>> target system. Maybe worth to remove calling IDcheck.sh from make
>>>> install and call it only before
>>>> running the test.
>>>>
>>>>
>>>>         
>>> Michal,
>>>     Please give this patch a try, and instead when you run make
>>> install, do SKIP_IDCHECK=1.
>>> HTH,
>>> -Garrett
>>>       
>
> Wow. I must have been tired at the time; no idea why I used filter
> instead of strip. Please try this instead.
>
> Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
>   
Sorry for delay.

Tested-by: Michal Simek <monstr@monstr.eu>

-- 
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] IDcheck.sh - awk problem
  2009-07-10 18:04           ` Michal Simek
@ 2009-07-10 19:21             ` Garrett Cooper
  2009-07-10 19:29               ` Subrata Modak
  0 siblings, 1 reply; 10+ messages in thread
From: Garrett Cooper @ 2009-07-10 19:21 UTC (permalink / raw)
  To: michal.simek; +Cc: LTP, Mike Frysinger

On Fri, Jul 10, 2009 at 11:04 AM, Michal
Simek<michal.simek@petalogix.com> wrote:
> Garrett Cooper wrote:
>> On Thu, Jul 9, 2009 at 3:28 AM, Michal Simek<michal.simek@petalogix.com> wrote:
>>
>>> Garrett Cooper wrote:
>>>
>>>> On Wed, Jul 8, 2009 at 7:36 AM, Michal Simek<michal.simek@petalogix.com> wrote:
>>>>
>>>>
>>>>> Of course not because I cross compile ltp for Microblaze - correct
>>>>> /etc/passwd - group is on
>>>>> target system. Maybe worth to remove calling IDcheck.sh from make
>>>>> install and call it only before
>>>>> running the test.
>>>>>
>>>>>
>>>>>
>>>> Michal,
>>>>     Please give this patch a try, and instead when you run make
>>>> install, do SKIP_IDCHECK=1.
>>>> HTH,
>>>> -Garrett
>>>>
>>
>> Wow. I must have been tired at the time; no idea why I used filter
>> instead of strip. Please try this instead.
>>
>> Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
>>
> Sorry for delay.
>
> Tested-by: Michal Simek <monstr@monstr.eu>

Subrata,
    The fix for IDcheck.sh / the top-level Makefile is ready to be
committed to HEAD. Are we ok for commit?
Thanks,
-Garrett

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] IDcheck.sh - awk problem
  2009-07-10 19:21             ` Garrett Cooper
@ 2009-07-10 19:29               ` Subrata Modak
  2009-07-10 23:04                 ` Garrett Cooper
  0 siblings, 1 reply; 10+ messages in thread
From: Subrata Modak @ 2009-07-10 19:29 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: Mike Frysinger, LTP

On Fri, 2009-07-10 at 12:21 -0700, Garrett Cooper wrote:
> On Fri, Jul 10, 2009 at 11:04 AM, Michal
> Simek<michal.simek@petalogix.com> wrote:
> > Garrett Cooper wrote:
> >> On Thu, Jul 9, 2009 at 3:28 AM, Michal Simek<michal.simek@petalogix.com> wrote:
> >>
> >>> Garrett Cooper wrote:
> >>>
> >>>> On Wed, Jul 8, 2009 at 7:36 AM, Michal Simek<michal.simek@petalogix.com> wrote:
> >>>>
> >>>>
> >>>>> Of course not because I cross compile ltp for Microblaze - correct
> >>>>> /etc/passwd - group is on
> >>>>> target system. Maybe worth to remove calling IDcheck.sh from make
> >>>>> install and call it only before
> >>>>> running the test.
> >>>>>
> >>>>>
> >>>>>
> >>>> Michal,
> >>>>     Please give this patch a try, and instead when you run make
> >>>> install, do SKIP_IDCHECK=1.
> >>>> HTH,
> >>>> -Garrett
> >>>>
> >>
> >> Wow. I must have been tired at the time; no idea why I used filter
> >> instead of strip. Please try this instead.
> >>
> >> Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
> >>
> > Sorry for delay.
> >
> > Tested-by: Michal Simek <monstr@monstr.eu>
> 
> Subrata,
>     The fix for IDcheck.sh / the top-level Makefile is ready to be
> committed to HEAD. Are we ok for commit?

Garrett,

Please go ahead. I am making for some final preparations for OLS
2009 ;-). Would you all be interested to see my paper:

http://www.linuxsymposium.org/2009/view_abstract.php?content_key=24,
http://www.linuxsymposium.org/2009/view_abstract.php?content_key=25,

Regards--
Subrata

> Thanks,
> -Garrett


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] IDcheck.sh - awk problem
  2009-07-10 19:29               ` Subrata Modak
@ 2009-07-10 23:04                 ` Garrett Cooper
  0 siblings, 0 replies; 10+ messages in thread
From: Garrett Cooper @ 2009-07-10 23:04 UTC (permalink / raw)
  To: subrata; +Cc: Mike Frysinger, LTP

On Fri, Jul 10, 2009 at 12:29 PM, Subrata
Modak<subrata@linux.vnet.ibm.com> wrote:
> On Fri, 2009-07-10 at 12:21 -0700, Garrett Cooper wrote:
>> On Fri, Jul 10, 2009 at 11:04 AM, Michal
>> Simek<michal.simek@petalogix.com> wrote:
>> > Garrett Cooper wrote:
>> >>
>> >> Wow. I must have been tired at the time; no idea why I used filter
>> >> instead of strip. Please try this instead.
>> >>
>> >> Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
>> >>
>> > Sorry for delay.
>> >
>> > Tested-by: Michal Simek <monstr@monstr.eu>
>>
>> Subrata,
>>     The fix for IDcheck.sh / the top-level Makefile is ready to be
>> committed to HEAD. Are we ok for commit?
>
> Garrett,
>
> Please go ahead. I am making for some final preparations for OLS
> 2009 ;-). Would you all be interested to see my paper:
>
> http://www.linuxsymposium.org/2009/view_abstract.php?content_key=24,
> http://www.linuxsymposium.org/2009/view_abstract.php?content_key=25,

Committed.

Sure! Looks like an interesting read -- feel free to copy the glibc
stuff that we found a few days ago as a reference if you like :}.

If you want me to check in my nose-based python unittests for
IDcheck.sh, I can do that as well.

Thanks!
-Garrett

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-07-10 23:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-08  6:04 [LTP] IDcheck.sh - awk problem Michal Simek
2009-07-08 14:19 ` Garrett Cooper
2009-07-08 14:36   ` Michal Simek
2009-07-09  5:30     ` Garrett Cooper
2009-07-09 10:28       ` Michal Simek
2009-07-09 17:11         ` Garrett Cooper
2009-07-10 18:04           ` Michal Simek
2009-07-10 19:21             ` Garrett Cooper
2009-07-10 19:29               ` Subrata Modak
2009-07-10 23:04                 ` Garrett Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox