Date: Tue, 14 Oct 2014 03:11:47 +0000 (UTC) From: Devin Teske <dteske@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273067 - in head/usr.sbin/bsdconfig: includes share share/packages Message-ID: <201410140311.s9E3Blgw044111@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dteske Date: Tue Oct 14 03:11:46 2014 New Revision: 273067 URL: https://svnweb.freebsd.org/changeset/base/273067 Log: Fix awk(1) asorti() implementation to work when called in a loop. MFC after: 3 days X-MFC-to: stable/10, stable/9 Modified: head/usr.sbin/bsdconfig/includes/includes head/usr.sbin/bsdconfig/share/device.subr head/usr.sbin/bsdconfig/share/packages/index.subr Modified: head/usr.sbin/bsdconfig/includes/includes ============================================================================== --- head/usr.sbin/bsdconfig/includes/includes Mon Oct 13 22:30:08 2014 (r273066) +++ head/usr.sbin/bsdconfig/includes/includes Tue Oct 14 03:11:46 2014 (r273067) @@ -71,8 +71,10 @@ show_include() -v show_desc=${SHOW_DESC:-0} ' function asorti(src, dest) { + k = nitems = 0; + # Copy src indices to dest and calculate array length - nitems = 0; for (i in src) dest[++nitems] = i + for (i in src) dest[++nitems] = i # Sort the array of indices (dest) using insertion sort method for (i = 1; i <= nitems; k = i++) Modified: head/usr.sbin/bsdconfig/share/device.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/device.subr Mon Oct 13 22:30:08 2014 (r273066) +++ head/usr.sbin/bsdconfig/share/device.subr Tue Oct 14 03:11:46 2014 (r273067) @@ -1118,6 +1118,7 @@ f_device_sort_by_awk=' # -v prop="property" function asorti(src, dest) { + k = nitems = 0 for (i in src) dest[++nitems] = i for (i = 1; i <= nitems; k = i++) { idx = dest[i] Modified: head/usr.sbin/bsdconfig/share/packages/index.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/packages/index.subr Mon Oct 13 22:30:08 2014 (r273066) +++ head/usr.sbin/bsdconfig/share/packages/index.subr Tue Oct 14 03:11:46 2014 (r273067) @@ -243,8 +243,10 @@ f_index_read() eval "$( debug= f_getvar "$var_to_get" | awk -F'|' ' function asorti(src, dest) { + k = nitems = 0 + # Copy src indices to dest and calculate array length - nitems = 0; for (i in src) dest[++nitems] = i + for (i in src) dest[++nitems] = i # Sort the array of indices (dest) using insertion sort method for (i = 1; i <= nitems; k = i++)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410140311.s9E3Blgw044111>