[krbdev.mit.edu #5447] tail portability bug in k5srvutil

rbasch@MIT.EDU via RT rt-comment at krbdev.mit.edu
Sat Feb 24 19:12:31 EST 2007


"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() {




More information about the krb5-bugs mailing list