localedef/ctype.sh requires sed -E for no reason
|Assignee:||Albert Lee||% Done:|
|Category:||cmd - userland programs|
The introduction of ctype.sh in cset 13399:a1d28d03839f added a dependency on illumos sed's -E option for extended regex (inherited from FreeBSD). -E was not previously supported by Solaris sed and this has led to an additional bootstrapping step on some platforms (announced as a "flag day"). The use of -E seems to have been purely a stylistic decision as the same sed commands can use basic RE with only minor syntax changes (brackets for char matches, backslash before parens for substrings). The script itself also look like could be simplified.
#4 Updated by Albert Lee almost 6 years ago
As for "simplifying" it, I really just don't understand the overall transformation being done here. The use of the buffer swap and purpose of adding ";/" and removing it in the first expression, and the "s,\([>)]\)$,\1;/," in the second is still mysterious to me. I'm looking at convert_map.pl which does some related parsing...
#5 Updated by Yuri Pankov almost 6 years ago
First sed invocation is for corner-case (currently found only in hy_AM.UTF-8.src) - "alpha <ARMENIAN_MODIFIER_LETTER_LEFT_HALF_RING>", as sed can't match both range patterns on the same line... we make it look like:
alpha <ARMENIAN_MODIFIER_LETTER_LEFT_HALF_RING>;/ <ARMENIAN_MODIFIER_LETTER_LEFT_HALF_RING>
so it could be parsed by the second sed call...
"s,\([>)]\)$,\1;/," makes all definitions look like <......>;/, so the data gathered from all files looks continuous to localedef...
last sed call adds keyword (upper, lower, etc.) to the first line and removes ;/ from the last one, so we get something like the following:
upper <DEFINITION>;/ <DEFINITION>;/ [....] <DEFINITION>;/ <DEFINITION>
#6 Updated by Garrett D'Amore almost 6 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
- Tags deleted (
user: Yuri Pankov <email@example.com>
date: Thu Aug 04 17:38:16 2011 -0700
1314 localedef/ctype.sh requires sed -E for no reason
Reviewed by: Albert Lee <firstname.lastname@example.org>
Reviewed by: Garrett D'Amore <email@example.com>
Approved by: Garrett D'Amore <firstname.lastname@example.org>
Also available in: Atom