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

CPAN-Reporter not functioning on cygwin/Windows due to warnings about deprecated feature use #96

Open
Astara opened this issue Oct 24, 2019 · 3 comments

Comments

@Astara
Copy link

Astara commented Oct 24, 2019

I tried to run one of my progs I built on unix under cygwin using
the installed perl 5.26. CPAN::Reporter info:
http://mirrors.kernel.org/CPAN/authors/id/D/DA/DAGOLDEN/CHECKSUMS
Module id = CPAN::Reporter
CPAN_USERID DAGOLDEN (David Golden [email protected])
CPAN_VERSION 1.2018
CPAN_FILE D/DA/DAGOLDEN/CPAN-Reporter-1.2018.tar.gz
UPLOAD_DATE 2016-06-21
MANPAGE CPAN::Reporter - Adds CPAN Testers reporting to CPAN.pm
INST_FILE /usr/share/perl5/vendor_perl/5.26/CPAN/Reporter.pm
INST_VERSION 1.2018

Got errors:

Generating a Unix-style Makefile
Writing Makefile for Digest::SHA2
Writing MYMETA.yml and MYMETA.json
(/usr/bin/perl Makefile.PL exited with 0)
CPAN::Reporter: couldn't determine exit value for '/usr/bin/perl
Makefile.PL'
CPAN::Reporter: had errors capturing exit value and output. Tests
abandoned
AVAR/Digest-SHA2-1.1.1.tar.gz

So no status is getting uploaded for any CPAN tests I am running.

I put a print in the area where it is running the tests and capturing the
output. I see:
Generating a Unix-style Makefile
Writing Makefile for Digest::SHA2
Writing MYMETA.yml and MYMETA.json
(/usr/bin/perl Makefile.PL exited with 0)
teeout=<<<<sysread() is deprecated on :utf8 handles. This will be a
fatal error in Perl 5.30 at -e line 8.
syswrite() is deprecated on :utf8 handles. This will be a fatal error in
Perl 5.30 at -e line 9.

<15 of the same error messages deleted>

**(/usr/bin/perl Makefile.PL exited with 0)
sysread() is deprecated on :utf8 handles. This will be a fatal error in
Perl 5.30 at -e line 9.

CPAN::Reporter: couldn't determine exit value for '/usr/bin/perl
Makefile.PL'
CPAN::Reporter: had errors capturing exit value and output. Tests
abandoned** AVAR/Digest-SHA2-1.1.1.tar.gz

It seems the wrapper script to read output and status on Cygwin doesn't handle unexpected output (like warnings) -- not to mention, something is using sysread/write on utf8 handles. Given 5.30 is upcoming it seems this problem is likely to get worse. :-(

@eserte
Copy link
Contributor

eserte commented Oct 24, 2019

sysread at line 8 and syswrite at line 9: it looks like Capture::Tiny is involved here: https://github.com/dagolden/Capture-Tiny/blob/master/lib/Capture/Tiny.pm#L74-L75
However, the wrapper script is called with -C0 which is supposed to turn all unicode off...

@Astara
Copy link
Author

Astara commented Oct 25, 2019

I can see what the problem might be. Most utilities have switches on the command line override settings in the environment as its expected that the settings in the environment are to be used as defaults in that user's environment. However, usually settings on the command line override background defaults as they are considered more immediately close to the specific program.

If perl doesn't behave that way, it doesn't give a way to create overrides in an environment that has settings, set, in the environment.

Since my environment is unicode, I tell perl to use unicode for the source, stdio and stdarg (but not other I/O). Namely "-Mutf8 -CSA".

But it was my understanding that values on the command line specifically should override
environment settings for the reasons I describe. If that's not the case, then anyone wanting to
create any 1-time difference in execution needs to wipe out all of the users' local defaults, by setting PERL5OPT to a null value for the duration of those programs that need such.

The alternative is to tell users that use of the environment variables is not supported, which seems draconian.

specifically:

@Leont
Copy link
Contributor

Leont commented Oct 25, 2019

I don't think the bug here is related to the new sysread behavior, or to Capture Tiny.

But it was my understanding that values on the command line specifically should override
environment settings for the reasons I describe. If that's not the case, then anyone wanting to
create any 1-time difference in execution needs to wipe out all of the users' local defaults, by setting PERL5OPT to a null value for the duration of those programs that need such.

The cause of this is easily shown by:

PERL5OPT="-Mutf8 -CSA" perl -C0 -E 'say ${^UNICODE}'

That returns 39, not 0. The reason for this is that PERL5OPT is inserted into the arguments, and its content is no longer treated as an environmental input.

I would recommend setting PERL_UNICODE=SA instead of PERL5OPT=-CSA, that does do exactly what you want, with the right precedence, as shown by:

PERL_UNICODE=SA PERL5OPT=-Mutf8 perl -C0 -E 'say ${^UNICODE}'

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

No branches or pull requests

3 participants