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

Modification of a read-only value attempted at /usr/share/perl5/IPC/Run.pm line 1686, <STDIN> line 1 #139

Open
ken-i opened this issue Jun 2, 2020 · 0 comments

Comments

@ken-i
Copy link

ken-i commented Jun 2, 2020

The above error is being returned from the harness function of IPC::Run.

The trip for the error is passing in undef for a variable during a call to run, but would also of happened if calling start or harness:

run $cmd, undef, \$out, \$err;

The above is passing undef for \$in.

I have not located any documentation indicating \$in is mandatory, and can not be undef.

The error did not occur on stretch IPC::Run version 0.94, with the code:

   my @args;
   if ( @_ == 1 && ! ref $_[0] ) {
      if ( Win32_MODE ) {
         my $command = $ENV{ComSpec} || 'cmd';
         @args = ( [ $command, '/c', win32_parse_cmd_line $_[0] ] );
      }
      else {
         @args = ( [ qw( sh -c ), @_ ] );
      }
   }
   elsif ( @_ > 1 && ! grep ref $_, @_ ) {
      @args = ( [ @_ ] );
   }
   else {
==>      @args = @_;
   }

The error does occur on buster IPC::Run version 20180523.0, with the code:

    my @args;
    if ( @_ == 1 && !ref $_[0] ) {
        if (Win32_MODE) {
            my $command = $ENV{ComSpec} || 'cmd';
            @args = ( [ $command, '/c', win32_parse_cmd_line $_[0] ] );
        }
        else {
            @args = ( [ qw( sh -c ), @_ ] );
        }
    }
    elsif ( @_ > 1 && !grep ref $_, @_ ) {
        @args = ( [@_] );
    }
    else {
==>        @args = map { !defined $_ ? bless(\$_, 'IPC::Run::Undef') : $_ } @_;
    }

Change indicated by ==> above.

I believe the issue here is the introduction of the map or more specifically the bless call trying to modify the read only constant $_.

Please advise if further details required.

A search of open tickets yielded no existing ticket for the above.

Workaround

A workaround for the error is to always pass in the STDIN variable \$in.

Environment

Debian GNU/Linux 10 (buster)

Package: libipc-run-perl
Version: 20180523.0-1
Priority: optional
Section: perl
Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
Installed-Size: 268 kB
Depends: perl, libio-pty-perl
Homepage: https://metacpan.org/release/IPC-Run
Tag: devel::lang:perl, devel::library, implemented-in::perl, role::program,
 works-with::software:running
Download-Size: 101 kB
APT-Manual-Installed: no
APT-Sources: https://friskrepo/debian buster/main amd64 Packages
Description: Perl module for running processes
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

1 participant