Closed p5pRT closed 11 years ago
POSIX::setlocale returns a bizarre value on failure.
$ perl -wle 'use POSIX; print scalar(()= setlocale LC_ALL\, "mtfnpy")' 1
OK\, so it's not an empty list.
$ perl -wle 'use POSIX; print setlocale LC_ALL\, "mtfnpy"'
OK\, so it's some kind of empty string (no "uninitialized" warning from -w)
$ perl -wle 'use POSIX; print "" eq setlocale POSIX::LC_ALL\, "mtfnpy"' 1
Yep\, definitely an empty string.
$ perl -wle 'use POSIX; print defined(setlocale LC_ALL\, "mtfnpy") ? "yes" : "no"' no
Wait\, so it's an empty string that's not undef AND not defined()?
$ perl -wle 'use POSIX; print length setlocale POSIX::LC_ALL\, "mtfnpy"' Use of uninitialized value in print at -e line 1.
... and length doesn't even bother returning a number for it.
On Sun Nov 18 13:59:40 2012\, mauke- wrote:
This is a bug report for perl from l.mai@web.de\, generated with the help of perlbug 1.39 running under perl 5.16.2.
----------------------------------------------------------------- [Please describe your issue here]
POSIX::setlocale returns a bizarre value on failure.
$ perl -wle 'use POSIX; print scalar(()= setlocale LC_ALL\, "mtfnpy")' 1
OK\, so it's not an empty list.
$ perl -wle 'use POSIX; print setlocale LC_ALL\, "mtfnpy"'
OK\, so it's some kind of empty string (no "uninitialized" warning from -w)
$ perl -wle 'use POSIX; print "" eq setlocale POSIX::LC_ALL\, "mtfnpy"' 1
Yep\, definitely an empty string.
$ perl -wle 'use POSIX; print defined(setlocale LC_ALL\, "mtfnpy") ? "yes" : "no"' no
Wait\, so it's an empty string that's not undef AND not defined()?
$ perl -wle 'use POSIX; print length setlocale POSIX::LC_ALL\, "mtfnpy"' Use of uninitialized value in print at -e line 1.
... and length doesn't even bother returning a number for it.
Anything marked PADTMP is exempt from uninit warnings. I have no idea why.
--
Father Chrysostomos
The RT System itself - Status changed from 'new' to 'open'
* l.mai@web.de \perlbug\-followup@​perl\.org [2012-11-18 23:05]:
$ perl -wle 'use POSIX; print length setlocale POSIX::LC_ALL\, "mtfnpy"' Use of uninitialized value in print at -e line 1.
... and length doesn't even bother returning a number for it.
That’s what `length undef` does.
Fixed by commit fbd840dfc9b563b320e11bc4465883053a0487f5 -- Karl Williamson
Fixed by commit fbd840dfc9b563b320e11bc4465883053a0487f5 -- Karl Williamson
@khwilliamson - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#115808 (status was 'resolved')
Searchable as RT115808$