Project

General

Profile

Bug #1097

glob(3c) needs to support non-POSIX options

Added by Gary Mills almost 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
2011-06-09
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

The glob(3c) function in illumos (and Solaris) defines only the set of flags defined
by POSIX 1003.2. Other operating systems add a set of non-standard flags,
for example GLOB_LIMIT to instruct the glob function to limit its path search
before resources are exhausted.

This would have to be done in a manner that maintains binary compatibility, so that existing
applications continue to work. In non-POSIX mode, more flags are available, but the flag
defaults change. In addition, the size of the glob_t structure increases in non-POSIX mode.


Files

glob.c-ill.diff (8.29 KB) glob.c-ill.diff Gary Mills, 2012-11-01 02:58 PM
glob.c-sty.diff (19 KB) glob.c-sty.diff Gary Mills, 2012-11-01 02:58 PM
glob.c-ill.diff (7.63 KB) glob.c-ill.diff Gary Mills, 2012-11-08 02:56 PM
glob.c-sty.diff (19 KB) glob.c-sty.diff Gary Mills, 2012-11-08 02:56 PM
glob.c-mb.diff (19.7 KB) glob.c-mb.diff Gary Mills, 2012-12-10 02:54 PM
glob.c-mb.diff (20.4 KB) glob.c-mb.diff Gary Mills, 2012-12-17 03:53 PM
glob.c-isw.diff (1.9 KB) glob.c-isw.diff Gary Mills, 2013-01-04 07:08 PM
glob.c-asc.diff (552 Bytes) glob.c-asc.diff Gary Mills, 2013-01-12 08:20 PM
glob.c-rev.diff (27.4 KB) glob.c-rev.diff Gary Mills, 2013-01-28 08:00 PM
glob.c-len.diff (2.34 KB) glob.c-len.diff Gary Mills, 2013-01-30 03:42 AM
glob.c-w9.diff (2.53 KB) glob.c-w9.diff Gary Mills, 2013-02-19 08:17 PM

History

#1

Updated by Gary Mills over 7 years ago

  • Status changed from New to Feedback
  • Assignee set to Gary Mills
  • % Done changed from 0 to 50

The best course of action seems to be to replace the glob() function in libc with the Openbsd version, while retaining compatibility with existing callers. This change introduces a well-tested function that contains both POSIX and non-POSIX features.

#2

Updated by Gary Mills over 7 years ago

I'm attaching two diff files. `glob.c-ill.diff' contains the content changes to adapt the Openbsd version of glob.c to illumos. `glob.c-sty.diff' contains the subsequent style changes. A webrev will be posted shortly.

#3

Updated by Gary Mills over 7 years ago

I've updated the two diff files slightly.

#4

Updated by Gary Mills over 7 years ago

The BSD-derived glob() had no support for international character sets. It stored 8-bit characters and flag bits within a single word. I've changed this data structure into a struct with separate members for a wide character and for a flag word. It also uses library functions to convert between wide characters and multi-byte characters. The file `glob.c-mb.diff' contains these changes.

#5

Updated by Gary Mills over 7 years ago

I've made a few more changes to improve the international character handling. I've also fixed a few incorrect return values. The new file `glob.c-mb.diff' contains these changes.

#6

Updated by Gary Mills over 7 years ago

I've changed the comparison test for character classes to use the library functions wctype() and iswctype(), simplifying the code in glob.c . The file glob.c-isw.diff contains these changes.

#7

Updated by Gary Mills over 7 years ago

One more small change, this one to replace wctomb() by iswascii() . See the attached file glob.c-asc.diff for details.

#8

Updated by Gary Mills over 7 years ago

Here are some more changes to glob.c, in response to reviewer's comments. The file `glob.c-rev.diff' contains these changes.

#9

Updated by Gary Mills over 7 years ago

One more change, this one to supply the remaining buffer length to mbtowc() instead of a fixed value. See the file `glob.c-len.diff' for details.

#10

Updated by Gary Mills over 7 years ago

The file /tmp/glob.c-w9.diff contains changes to glob.c to permit the library function to differentiate between legacy and extended callers, along with a number of other small changes suggested by the Advocates.

#11

Updated by Gary Mills over 6 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

Dan McDonald: Just pushed it.

Also available in: Atom PDF