* [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in dev-libs/libevent: ChangeLog libevent-1.3e.ebuild [not found] <E1IiT4F-0005qT-Lq@stork.gentoo.org> @ 2007-11-12 8:25 ` Donnie Berkholz 2007-11-12 23:24 ` Jan Kundrát 0 siblings, 1 reply; 9+ messages in thread From: Donnie Berkholz @ 2007-11-12 8:25 UTC (permalink / raw To: gentoo-dev, caleb On 10:57 Thu 18 Oct , Caleb Tennis (caleb) wrote: > 1.1 dev-libs/libevent/libevent-1.3e.ebuild > > file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-libs/libevent/libevent-1.3e.ebuild?rev=1.1&view=markup > plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-libs/libevent/libevent-1.3e.ebuild?rev=1.1&content-type=text/plain > pkg_postinst() { > local ver="${prevver##*/}" > if [[ -n "${ver}" ]] && [[ ${ver//[a-zA-Z-]} != "${PV//[a-zA-Z]}" ]] ; then It isn't terribly likely to become an issue here, but it might be nicer to use [[:alpha:]] than [a-zA-Z]. > ewarn > ewarn "You will need to run revdep-rebuild (included with app-portage/gentoolkit)" > ewarn "to rebuild all packages that were built with libevent-1.0x." > ewarn > ewarn "Run the following to see which packages will be rebuilt:" > ewarn " revdep-rebuild --library ${ver}.so.1 -p" > ewarn > ewarn "If you are satisfied with the output, re-run without the '-p' to rebuild." > ewarn > fi > unset prevver > } Thanks, Donnie -- gentoo-dev@gentoo.org mailing list ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in dev-libs/libevent: ChangeLog libevent-1.3e.ebuild 2007-11-12 8:25 ` [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in dev-libs/libevent: ChangeLog libevent-1.3e.ebuild Donnie Berkholz @ 2007-11-12 23:24 ` Jan Kundrát 2007-11-14 0:20 ` [gentoo-dev] " Steve Long 0 siblings, 1 reply; 9+ messages in thread From: Jan Kundrát @ 2007-11-12 23:24 UTC (permalink / raw To: gentoo-dev [-- Attachment #1: Type: text/plain, Size: 320 bytes --] Donnie Berkholz wrote: >> if [[ -n "${ver}" ]] && [[ ${ver//[a-zA-Z-]} != "${PV//[a-zA-Z]}" ]] ; then > > It isn't terribly likely to become an issue here, but it might be nicer > to use [[:alpha:]] than [a-zA-Z]. Is [[:alpha:]] locale-safe? Cheers. -jkt -- cd /local/pub && more beer > /dev/mouth [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 252 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-dev] Re: Re: [gentoo-commits] gentoo-x86 commit in dev-libs/libevent: ChangeLog libevent-1.3e.ebuild 2007-11-12 23:24 ` Jan Kundrát @ 2007-11-14 0:20 ` Steve Long 2007-11-14 0:33 ` Jan Kundrát 0 siblings, 1 reply; 9+ messages in thread From: Steve Long @ 2007-11-14 0:20 UTC (permalink / raw To: gentoo-dev Jan Kundrát wrote: > Donnie Berkholz wrote: >>> if [[ -n "${ver}" ]] && [[ ${ver//[a-zA-Z-]} != "${PV//[a-zA-Z]}" ]] ; >>> then >> >> It isn't terribly likely to become an issue here, but it might be nicer >> to use [[:alpha:]] than [a-zA-Z]. > > Is [[:alpha:]] locale-safe? > Yes, all POSIX character classes listed here are: http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html -- gentoo-dev@gentoo.org mailing list ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] Re: Re: [gentoo-commits] gentoo-x86 commit in dev-libs/libevent: ChangeLog libevent-1.3e.ebuild 2007-11-14 0:20 ` [gentoo-dev] " Steve Long @ 2007-11-14 0:33 ` Jan Kundrát 2007-11-14 2:36 ` Bo Ørsted Andresen 2007-11-14 7:10 ` [gentoo-dev] " Steve Long 0 siblings, 2 replies; 9+ messages in thread From: Jan Kundrát @ 2007-11-14 0:33 UTC (permalink / raw To: gentoo-dev [-- Attachment #1: Type: text/plain, Size: 561 bytes --] Steve Long wrote: >> Is [[:alpha:]] locale-safe? >> > Yes, all POSIX character classes listed here are: > http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html Thanks for a nice link. If I read section 7.3.1 correctly, [[:alpha:]] always contains those letters, but might contain more, depending on the locale. So it's probably very minor point, but as long as the script runs with user-provided locale, one should be explicit here. Or am I missing something here? Cheers, -jkt -- cd /local/pub && more beer > /dev/mouth [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 252 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] Re: Re: [gentoo-commits] gentoo-x86 commit in dev-libs/libevent: ChangeLog libevent-1.3e.ebuild 2007-11-14 0:33 ` Jan Kundrát @ 2007-11-14 2:36 ` Bo Ørsted Andresen 2007-11-14 20:37 ` Jan Kundrát 2007-11-14 7:10 ` [gentoo-dev] " Steve Long 1 sibling, 1 reply; 9+ messages in thread From: Bo Ørsted Andresen @ 2007-11-14 2:36 UTC (permalink / raw To: gentoo-dev [-- Attachment #1: Type: text/plain, Size: 895 bytes --] On Wednesday 14 November 2007 01:33:54 Jan Kundrát wrote: > Steve Long wrote: > >> Is [[:alpha:]] locale-safe? > > > > Yes, all POSIX character classes listed here are: > > http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html > > Thanks for a nice link. If I read section 7.3.1 correctly, [[:alpha:]] > always contains those letters, but might contain more, depending on the > locale. So it's probably very minor point, but as long as the script > runs with user-provided locale, one should be explicit here. Or am I > missing something here? If you think [a-zA-Z] is being explicit then you are clearly missing something. E.g. if you google for the estonian alphabet you'll see a lot of ansi letters are after z in that alphabet. So on estonian locales those letters won't be included in [a-z] but they will be included in [:alpha:]. -- Bo Andresen [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] Re: Re: [gentoo-commits] gentoo-x86 commit in dev-libs/libevent: ChangeLog libevent-1.3e.ebuild 2007-11-14 2:36 ` Bo Ørsted Andresen @ 2007-11-14 20:37 ` Jan Kundrát 2007-11-14 20:43 ` Bo Ørsted Andresen 0 siblings, 1 reply; 9+ messages in thread From: Jan Kundrát @ 2007-11-14 20:37 UTC (permalink / raw To: gentoo-dev [-- Attachment #1: Type: text/plain, Size: 456 bytes --] Bo Ørsted Andresen wrote: > So on estonian locales those letters won't be included in [a-z] but > they will be included in [:alpha:]. Actually that was exactly my point. If user had some funny locale that has digits or dots in its [:alpha:], the ebuild wouldn't work as desired, but it would rather strip valid stuff from the variable. But that's probably pure sci-fi for now :). Cheers, -jkt -- cd /local/pub && more beer > /dev/mouth [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 252 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-dev] Re: Re: [gentoo-commits] gentoo-x86 commit in dev-libs/libevent: ChangeLog libevent-1.3e.ebuild 2007-11-14 20:37 ` Jan Kundrát @ 2007-11-14 20:43 ` Bo Ørsted Andresen 0 siblings, 0 replies; 9+ messages in thread From: Bo Ørsted Andresen @ 2007-11-14 20:43 UTC (permalink / raw To: gentoo-dev [-- Attachment #1: Type: text/plain, Size: 649 bytes --] On Wednesday 14 November 2007 21:37:46 Jan Kundrát wrote: > Bo Ørsted Andresen wrote: > > So on estonian locales those letters won't be included in [a-z] but > > they will be included in [:alpha:]. > > Actually that was exactly my point. If user had some funny locale that > has digits or dots in its [:alpha:], the ebuild wouldn't work as > desired, but it would rather strip valid stuff from the variable. But > that's probably pure sci-fi for now :). [:alpha:] will never have digits or dots in it. It will, however, sometimes have funny letters in it. And [a-z] will not always have all ansi letters in it. -- Bo Andresen [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-dev] Re: Re: Re: [gentoo-commits] gentoo-x86 commit in dev-libs/libevent: ChangeLog libevent-1.3e.ebuild 2007-11-14 0:33 ` Jan Kundrát 2007-11-14 2:36 ` Bo Ørsted Andresen @ 2007-11-14 7:10 ` Steve Long 2007-11-19 9:28 ` Steve Long 1 sibling, 1 reply; 9+ messages in thread From: Steve Long @ 2007-11-14 7:10 UTC (permalink / raw To: gentoo-dev Jan Kundrát wrote: > Steve Long wrote: >>> Is [[:alpha:]] locale-safe? >>> >> Yes, all POSIX character classes listed here are: >> http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html > > Thanks for a nice link. If I read section 7.3.1 correctly, [[:alpha:]] > always contains those letters, but might contain more, depending on the > locale. So it's probably very minor point, but as long as the script > runs with user-provided locale, one should be explicit here. Or am I > missing something here? > No, that's about the size of it-- if you you'd like to tie it to ASCII, irrespective of locale, that's fair enough. It depends on what you're up to (sorry, I don't have time to go digging through code to see what this applies to) but in the /general/ case it's better to use locale-neutral character-classes, since it makes scripts much more useful. Setting LC_ALL=C temporarily is not a good idea, since it overrides LC_CTYPE. The most common usage for that is for sort order; where that's needed it's better to use LC_COLLATE. (man 7 locale) Quick example showing why the double-bracket appears: if [[ ${v:0:1} != [[:alpha:]_] || $v = *[^[:alnum:]_]* ]]; then errMsg $"$v is not a valid identifier" return 1 fi Getting to know these is really helpful, imo, especially since they apply to _all_ the utilities like tr, sed, grep, awk -- and ed ofc ;) $"text" is for i18n in bash via gettext, akin to _"foo" in C. Can't say I've used it yet, though :p -- gentoo-dev@gentoo.org mailing list ^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-dev] Re: Re: Re: [gentoo-commits] gentoo-x86 commit in dev-libs/libevent: ChangeLog libevent-1.3e.ebuild 2007-11-14 7:10 ` [gentoo-dev] " Steve Long @ 2007-11-19 9:28 ` Steve Long 0 siblings, 0 replies; 9+ messages in thread From: Steve Long @ 2007-11-19 9:28 UTC (permalink / raw To: gentoo-dev Steve Long wrote: > No, that's about the size of it-- if you you'd like to tie it to ASCII, > irrespective of locale, that's fair enough. > I had a feeling this statement was incorrect (what zlin said about a-z) so I asked dalias in #bash who is knowledgeable about locale stuff: <igli> dalias; have a q re: l10n. if we want to restrict allowed chars to ASCII (for config) without affecting user's LC_CTYPE, what's the best way? <dalias> igli, where do you want to restrict chars? <igli> example i've seen is in checking a var <dalias> checking a var to make sure it's all ascii? <igli> yeah <igli> [A-Za-z] isn't locale-safe is it? <dalias> match it to a regex <igli> hmm ok <dalias> it's safe if LC_COLLATE=C <igli> ah thanks :D <dalias> alternatively <dalias> the most safe way is just to write all chars explicitly <dalias> [ABCDEF...xyz] <igli> hehe <igli> ok nice one, i'll pass it on. <dalias> anyway posix guarantees that the collation order in C locale is ascii order <dalias> even if the host's character encoding is something idiotic like ebcdic The odd bit (for me) is that [A-Za-z] is affected by LC_COLLATE not LC_CTYPE, which makes sense if you think of it as a comparison. [[:class:]] is ofc CTYPE. So setting LC_COLLATE=C would appear to make sense, as long as you are never dealing with user filenames, but only the portage tree (which seems a bit yuck). A better general implementation might be a function that checks against the explicit list, since that would have no implications for file handling: isAlphaASCII() { for i; do [[ $i = *[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzxyz]* ]] \ && return 1 done return 0 } I /guess/ in sh the test line would be: case "$i" in *[!ABC..xyz]* ) return 1;; esac -- gentoo-dev@gentoo.org mailing list ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-11-19 9:27 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <E1IiT4F-0005qT-Lq@stork.gentoo.org> 2007-11-12 8:25 ` [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in dev-libs/libevent: ChangeLog libevent-1.3e.ebuild Donnie Berkholz 2007-11-12 23:24 ` Jan Kundrát 2007-11-14 0:20 ` [gentoo-dev] " Steve Long 2007-11-14 0:33 ` Jan Kundrát 2007-11-14 2:36 ` Bo Ørsted Andresen 2007-11-14 20:37 ` Jan Kundrát 2007-11-14 20:43 ` Bo Ørsted Andresen 2007-11-14 7:10 ` [gentoo-dev] " Steve Long 2007-11-19 9:28 ` Steve Long
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox