Skip Menu |
 

To: source-reviewers@MIT.EDU
Subject: tail portability bug in k5srvutil
Date: Sat, 24 Feb 2007 18:12:40 -0500
From: Robert A Basch <rbasch@MIT.EDU>
Cc: krb5-bugs@MIT.EDU
"k5srvutil change" failed on a RHEL-5 beta machine, where the tail
command, in an apparent effort to be more POSIX compliant, no longer
recognizes the "+<number>" option. This patch fixes the problem by
making use of awk's NR variable, thereby obviating the use of tail.
(Note that the POSIX tail's "-n" option is not portable, and in
particular is not accepted on Solaris),


Index: k5srvutil.sh
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/third/krb5/src/kadmin/cli/k5srvutil.sh,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 k5srvutil.sh
--- k5srvutil.sh 27 Feb 2004 04:01:52 -0000 1.1.1.1
+++ k5srvutil.sh 24 Feb 2007 21:41:47 -0000
@@ -4,7 +4,7 @@
# returns a list of principals in the keytab
# sorted and uniquified
list_princs() {
- klist -k $keytab | tail +4 | awk '{print $2}' | sort | uniq
+ klist -k $keytab | awk '(NR > 3) {print $2}' | sort | uniq
}

set_command() {
Subject: Re: tail portability bug in k5srvutil
From: Greg Hudson <ghudson@MIT.EDU>
To: Robert A Basch <rbasch@MIT.EDU>
Date: Sat, 24 Feb 2007 22:13:35 -0500
Cc: source-reviewers@MIT.EDU, krb5-bugs@MIT.EDU
Yay.

The FSF upstream maintainers have an odd desire to deprecate tail +n,
and every so often a distribution version falls prey to it. My guess is
that Red Hat will fix it if someone reports it as a bug, but we can also
work around it easily enough.
From: raeburn@mit.edu
Subject: SVN Commit
Fix tail portability problem by adding an expression test to the
existing awk invocation instead. Patch from Robert Basch at MIT.

Commit By: raeburn



Revision: 19225
Changed Files:
U trunk/src/kadmin/cli/k5srvutil.sh
From: tlyu@mit.edu
Subject: SVN Commit
pull up r19225 from trunk

r19225@cathode-dark-space: raeburn | 2007-03-13 20:52:47 -0400
ticket: 5447

Fix tail portability problem by adding an expression test to the
existing awk invocation instead. Patch from Robert Basch at MIT.



Commit By: tlyu



Revision: 19414
Changed Files:
_U branches/krb5-1-6/
U branches/krb5-1-6/src/kadmin/cli/k5srvutil.sh