[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-changes
Subject:    [Perl/perl5] 3235da: Don't call av_fetch() with TRUE to create an SV th...
From:       Nicholas Clark via perl5-changes <perl5-changes () perl ! org>
Date:       2021-07-28 14:54:34
Message-ID: Perl/perl5/push/refs/heads/blead/fbc413-3235da () github ! com
[Download RAW message or body]

  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 3235da5abd4c96f5ae2ec908dc9c110d2aebf65a
      https://github.com/Perl/perl5/commit/3235da5abd4c96f5ae2ec908dc9c110d2aebf65a
  Author: Nicholas Clark <nick@ccl4.org>
  Date:   2021-07-28 (Wed, 28 Jul 2021)

  Changed paths:
    M os2/os2.c
    M util.c

  Log Message:
  -----------
  Don't call av_fetch() with TRUE to create an SV that is immediately freed.

In Perl_my_pclose() the code as been calling av_fetch() with TRUE (lvalue;
create the SV if not found) since the Perl 4 -> Perl 5 migration. The
code *had* been assuming that the returned result was always a valid SvIV
until commit 25d9202327791097 in Jan 2001:
    Safe fix for Simon's pclose() doing SvIVX of undef -> core bug.

which fixes the bug reported in
https://www.nntp.perl.org/group/perl.perl5.porters/2001/01/msg28651.html

That commit changed the code to default the IV result (the pid) to -1 if the
av_fetch() failed to return SVt_IV. However, that commit failed to notice
that the value -1 was *already* "in use" *only 4 lines later* as a flag for
OS/2 to indicate "Opened by popen."

Hence switch the OS/2 sentinel value to -2.

The that states that OS/2 has a my_pclose implementation in os2.c is wrong.
It was erroneously added by commit 5f05dabc4054964a in Dec 1996:
    [inseparable changes from patch from perl5.003_11 to perl5.003_12]

It appears to be a copy-paste error from the previous comment added about
my_popen.

I tested this fix with the 2001-era code of commit 25d9202327791097 - it
(also) solves the bug reported back then.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic