Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CODESET doesn't behave as documented #17064

Closed
p5pRT opened this issue Jun 28, 2019 · 9 comments
Closed

CODESET doesn't behave as documented #17064

p5pRT opened this issue Jun 28, 2019 · 9 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 28, 2019

Migrated from rt.perl.org#134234 (status was 'pending release')

Searchable as RT134234$

@p5pRT
Copy link
Author

p5pRT commented Jun 28, 2019

From choroba@matfyz.cz

Created by choroba@matfyz.cz

The documentation of CODESET in I18N​::Langinfo says​:

  "CODESET"
  Unimplemented, except on Windows, due to the vagaries of vendor
  locale names, returning "" on non-Windows.

But, when running in Linux, it clearly returns something​:

  $ perl -MI18N​::Langinfo=langinfo,CODESET -E 'say langinfo(CODESET)'
  UTF-8

Reading the source code shows the function calls nl_langinfo if it
exists. The documentation should be updated to reflect the fact it can
return something on non-Windows sometimes.

Perl Info

Flags:
     category=library
     severity=medium
     module=I18N::Langinfo

Site configuration information for perl 5.31.1:

Configured by choroba at Tue Jun 18 09:46:42 CEST 2019.

Summary of my perl5 (revision 5 version 31 subversion 1) configuration:
   Commit id: fa068f6da2218ae85bae1e26ee7591c15276555f
   Platform:
     osname=linux
     osvers=4.4.179-99-default
     archname=x86_64-linux-thread-multi
     uname='linux lenonovo 4.4.179-99-default #1 smp tue may 14 18:07:16 utc 2019 (c775d39) x86_64 x86_64 x86_64 gnulinux '
     config_args='-rdes -Dusethreads -Dprefix=~/blead -Dusedevel'
     hint=recommended
     useposix=true
     d_sigaction=define
     useithreads=define
     usemultiplicity=define
     use64bitint=define
     use64bitall=define
     uselongdouble=undef
     usemymalloc=n
     default_inc_excludes_dot=define
     bincompat5005=undef
   Compiler:
     cc='cc'
     ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
     optimize='-O2'
     cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
     ccversion=''
     gccversion='4.8.5'
     gccosandvers=''
     intsize=4
     longsize=8
     ptrsize=8
     doublesize=8
     byteorder=12345678
     doublekind=3
     d_longlong=define
     longlongsize=8
     d_longdbl=define
     longdblsize=16
     longdblkind=3
     ivtype='long'
     ivsize=8
     nvtype='double'
     nvsize=8
     Off_t='off_t'
     lseeksize=8
     alignbytes=8
     prototype=define
   Linker and Libraries:
     ld='cc'
     ldflags =' -fstack-protector -L/usr/local/lib'
     libpth=/usr/local/lib /usr/lib64/gcc/x86_64-suse-linux/4.8/include-fixed /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64
     libs=-lpthread -lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
     perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
     libc=libc-2.22.so
     so=so
     useshrplib=false
     libperl=libperl.a
     gnulibc_version='2.22'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs
     dlext=so
     d_dlsymun=undef
     ccdlflags='-Wl,-E'
     cccdlflags='-fPIC'
     lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'



@INC for perl 5.31.1:
     /home/choroba/blead/lib/perl5/site_perl/5.31.1/x86_64-linux-thread-multi
     /home/choroba/blead/lib/perl5/site_perl/5.31.1
     /home/choroba/blead/lib/perl5/5.31.1/x86_64-linux-thread-multi
     /home/choroba/blead/lib/perl5/5.31.1


Environment for perl 5.31.1:
     HOME=/home/choroba
     LANG=en_US.utf8
     LANGUAGE (unset)
     LC_CTYPE=en_US.UTF-8
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
     PATH=/home/choroba/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/home/choroba/perl5/bin:/home/choroba/opensource/worktime/bin
     PERL_BADLANG (unset)
     SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2019

From @jkeenan

On Fri, 28 Jun 2019 13​:10​:02 GMT, choroba@​matfyz.cz wrote​:

This is a bug report for perl from choroba@​matfyz.cz,
generated with the help of perlbug 1.41 running under perl 5.31.1.

-----------------------------------------------------------------
[Please describe your issue here]

The documentation of CODESET in I18N​::Langinfo says​:

"CODESET"
Unimplemented, except on Windows, due to the vagaries of vendor
locale names, returning "" on non-Windows.

But, when running in Linux, it clearly returns something​:

$ perl -MI18N​::Langinfo=langinfo,CODESET -E 'say langinfo(CODESET)'
UTF-8

Reading the source code shows the function calls nl_langinfo if it
exists. The documentation should be updated to reflect the fact it can
return something on non-Windows sometimes.

Indeed, I get a non-empty return value on Linux as far back as 5.10.1.

Karl, this documentation was added in commit 8d72e74. Can you take a look?

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2019

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2019

From choroba@matfyz.cz

Indeed, I get a non-empty return value on Linux as far back as 5.10.1.

Oh, I just noticed I might have misread the documentation. In fact, several
paragraphs above, it says​:

Starting in Perl 5.28, this module is available even on systems that
lack a native "nl_langinfo". On such systems, it uses various methods to
construct what that function, if present, would return. But there are
potential glitches. These are the items that could be different​:

So, the whole list is irrelevant to Linux. What confused me was the
formatting, I didn't read the cited paragraph as I thought I belonged to the
previous list, not the following one. Maybe adding a =head before it would
help?

Ch.

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2019

From @jkeenan

On Thu, 04 Jul 2019 14​:15​:53 GMT, choroba@​matfyz.cz wrote​:

Indeed, I get a non-empty return value on Linux as far back as
5.10.1.

Oh, I just noticed I might have misread the documentation. In fact,
several
paragraphs above, it says​:

Starting in Perl 5.28, this module is available even on systems that
lack a native "nl_langinfo". On such systems, it uses various methods
to
construct what that function, if present, would return. But there are
potential glitches. These are the items that could be different​:

So, the whole list is irrelevant to Linux. What confused me was the
formatting, I didn't read the cited paragraph as I thought I belonged
to the
previous list, not the following one. Maybe adding a =head before it
would
help?

Ch.

We'll get some feedback from the original committer and figure out what to do from there. It may be as simple as reformatting.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2019

From @khwilliamson

On 7/4/19 8​:22 AM, James E Keenan via RT wrote​:

On Thu, 04 Jul 2019 14​:15​:53 GMT, choroba@​matfyz.cz wrote​:

Indeed, I get a non-empty return value on Linux as far back as
5.10.1.

Oh, I just noticed I might have misread the documentation. In fact,
several
paragraphs above, it says​:

Starting in Perl 5.28, this module is available even on systems that
lack a native "nl_langinfo". On such systems, it uses various methods
to
construct what that function, if present, would return. But there are
potential glitches. These are the items that could be different​:

So, the whole list is irrelevant to Linux. What confused me was the
formatting, I didn't read the cited paragraph as I thought I belonged
to the
previous list, not the following one. Maybe adding a =head before it
would
help?

Ch.

We'll get some feedback from the original committer and figure out what to do from there. It may be as simple as reformatting.

Attached is a patch to add a heading. Revisions welcome

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2019

From @khwilliamson

0005-Add-heading.patch
From 5eea237de8b83c26a500b975841f2fb1e943d791 Mon Sep 17 00:00:00 2001
From: Karl Williamson <khw@cpan.org>
Date: Thu, 4 Jul 2019 11:49:14 -0600
Subject: [PATCH 5/5] Add heading

---
 ext/I18N-Langinfo/Langinfo.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ext/I18N-Langinfo/Langinfo.pm b/ext/I18N-Langinfo/Langinfo.pm
index a0fc52a9f3..6fee6752c8 100644
--- a/ext/I18N-Langinfo/Langinfo.pm
+++ b/ext/I18N-Langinfo/Langinfo.pm
@@ -180,6 +180,8 @@ For the eras based on typically some ruler, such as the Japanese Emperor
 
 =back
 
+=head2 For systems without C<nl_langinfo>
+
 Starting in Perl 5.28, this module is available even on systems that lack a
 native C<nl_langinfo>.  On such systems, it uses various methods to construct
 what that function, if present, would return.  But there are potential
-- 
2.17.1

@p5pRT
Copy link
Author

p5pRT commented Aug 20, 2019

From @khwilliamson

Since there was no further discussion, I've applied the patch as
96b6979
and am closing this ticket
--
Karl Williamson

@p5pRT
Copy link
Author

p5pRT commented Aug 20, 2019

@khwilliamson - Status changed from 'open' to 'pending release'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant