docs/54391: Document that glob(3) respects LC_COLLATE

Thomas Seck tmseck at netcologne.de
Fri Jul 11 17:50:17 UTC 2003


>Number:         54391
>Category:       docs
>Synopsis:       Document that glob(3) respects LC_COLLATE
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 11 10:50:14 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Seck
>Release:        FreeBSD HEAD as of July 11, 2003
>Organization:
>Environment:
FreeBSD 4-STABLE

	
>Description:
	glob(3)'s description of GLOB_NOSORT claims that glob(3) always
	sorts in alphabetical order as specified by ASCII.
	This is not true if LC_COLLATE (or LANG, resp.) are set.
>How-To-Repeat:
	Create the files a.test, b.test and <aumlaut>.test with <aumlaut>
	being the "a with dots" present in ISO8859-1.
	Then compare the output of
	env LC_COLLATE=en_US.US-ASCII ls *.test
	(<aumlaut>.test ist sorted last)
	with
	env LC_COLLATE=en_US.ISO8859-1 ls *.test
	(<aumlaut is sorted between a and b).
>Fix:
	Reword glob(3) like this:

	Index: glob.3
	===================================================================
	RCS file: /home/ncvs/src/lib/libc/gen/glob.3,v
	retrieving revision 1.23
	diff -u -r1.23 glob.3
	--- glob.3	4 Feb 2003 16:27:42 -0000	1.23
	+++ glob.3	11 Jul 2003 17:05:58 -0000
	@@ -197,10 +197,10 @@
	 .Dv GLOB_NOESCAPE
	 is set, backslash escaping is disabled.
	 .It Dv GLOB_NOSORT
	-By default, the pathnames are sorted in ascending
	-.Tn ASCII
	-order;
	-this flag prevents that sorting (speeding up
	+By default, the pathnames are sorted in locale specific ascending order
	+as specified by
	+.Ev LC_COLLATE .
	+This flag prevents that sorting (speeding up
	 .Fn glob ) .
	 .El
	 .Pp
	@@ -421,7 +421,8 @@
	 .Sh SEE ALSO
	 .Xr sh 1 ,
	 .Xr fnmatch 3 ,
	-.Xr regexp 3
	+.Xr regexp 3 ,
	+.Xr setlocale 3
	 .Sh STANDARDS
	 The
	 .Fn glob


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-doc mailing list