[oe-commits] org.oe.dev Output NUL terminated lines with sort -z (busybox#1591). Fixes updatedb.

utx commit openembedded-commits at lists.openembedded.org
Tue Feb 19 23:16:12 UTC 2008


Output NUL terminated lines with sort -z (busybox#1591). Fixes updatedb.

Author: utx at openembedded.org
Branch: org.openembedded.dev
Revision: bd72b021bed4043fc9c546810adf98565821e12e
ViewMTN: http://monotone.openembedded.org/revision/info/bd72b021bed4043fc9c546810adf98565821e12e
Files:
1
packages/busybox/busybox-1.9.1/sort-z-nul.patch
packages/busybox/busybox_1.9.1.bb
Diffs:

#
# mt diff -rce6927ecdedbeb4d51a0e9f5e35a8515cab0ab09 -rbd72b021bed4043fc9c546810adf98565821e12e
#
# 
# 
# add_file "packages/busybox/busybox-1.9.1/sort-z-nul.patch"
#  content [b88c15e782daa61e071866a288ff781d61417aea]
# 
# patch "packages/busybox/busybox_1.9.1.bb"
#  from [3a914925d1165b2233a86cff45de9256eb4eb9d3]
#    to [9b1391f5ce41a8420b8bff9c3d172cb52087d7c2]
# 
============================================================
--- packages/busybox/busybox-1.9.1/sort-z-nul.patch	b88c15e782daa61e071866a288ff781d61417aea
+++ packages/busybox/busybox-1.9.1/sort-z-nul.patch	b88c15e782daa61e071866a288ff781d61417aea
@@ -0,0 +1,50 @@
+Summary: 0001591: inconsistent behavior of sort -z
+
+URL: http://busybox.net/bugs/view.php?id=1591
+http://www.busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/coreutils/sort.c?rev=21004&r1=20435&r2=21004&makepatch=1&diff_format=u
+
+Description:
+
+busybox sort -z does:
+use NUL instead of EOL on input
+
+GNU sort -z does:
+use NUL instead of EOL on input and output
+
+GNU sort -z documents:
+use NUL instead of EOL on input
+
+Additional Information:
+
+Note that sort -z is not part of any standard. But several applications
+(e. g. GNU findutils updatedb) depends on the NUL-on-output behavior.
+
+GNU sort documentation bug was reported to coreutils maintainers.
+
+Notes: 
+
+vda 02-13-08 06:30 (0004364)
+Fixed in revision 21004. Thanks!
+
+--- busybox/coreutils/sort.c	2007/11/16 12:39:16	20435
++++ busybox/coreutils/sort.c	2008/02/13 14:30:33	21004
+@@ -32,7 +32,7 @@
+ 	FLAG_u  = 8,            /* Unique */
+ 	FLAG_c  = 0x10,         /* Check: no output, exit(!ordered) */
+ 	FLAG_s  = 0x20,         /* Stable sort, no ascii fallback at end */
+-	FLAG_z  = 0x40,         /* Input is null terminated, not \n */
++	FLAG_z  = 0x40,         /* Input and output is NUL terminated, not \n */
+ /* These can be applied to search keys, the previous four can't */
+ 	FLAG_b  = 0x80,         /* Ignore leading blanks */
+ 	FLAG_r  = 0x100,        /* Reverse */
+@@ -396,8 +396,9 @@
+ 		if (linecount) linecount = flag+1;
+ 	}
+ 	/* Print it */
++	flag = (option_mask32 & FLAG_z) ? '\0' : '\n';
+ 	for (i = 0; i < linecount; i++)
+-		fprintf(outfile, "%s\n", lines[i]);
++		fprintf(outfile, "%s%c", lines[i], flag);
+ 
+ 	fflush_stdout_and_exit(EXIT_SUCCESS);
+ }
============================================================
--- packages/busybox/busybox_1.9.1.bb	3a914925d1165b2233a86cff45de9256eb4eb9d3
+++ packages/busybox/busybox_1.9.1.bb	9b1391f5ce41a8420b8bff9c3d172cb52087d7c2
@@ -1,5 +1,5 @@ require busybox.inc
 require busybox.inc
-PR = "r1"
+PR = "r2"
 
 SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
            file://busybox-cron \
@@ -12,6 +12,7 @@ SRC_URI = "http://www.busybox.net/downlo
            file://syslog.conf \
            file://udhcpscript.patch;patch=1 \
            file://adduser-longops.patch;patch=1 \
+           file://sort-z-nul.patch;patch=1;status=upstream \
            file://umount.busybox \
            file://run_parts.c \
            file://defconfig"






More information about the Openembedded-commits mailing list