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

POSIX::sigprocmask is non-permanent #5575

Closed
p5pRT opened this issue Jun 16, 2002 · 2 comments
Closed

POSIX::sigprocmask is non-permanent #5575

p5pRT opened this issue Jun 16, 2002 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 16, 2002

Migrated from rt.perl.org#9675 (status was 'resolved')

Searchable as RT9675$

@p5pRT
Copy link
Author

p5pRT commented Jun 16, 2002

From gbacon@mail.hiwaay.net

POSIX​::sigprocmask doesn't seem to permanently alter the signal mask.
Consider​:

  [21​:26] fly% cat ptry
  #! /usr/local/bin/perl

  use strict;
  use warnings;

  use POSIX qw/ :signal_h /;

  END { print "exiting...\n" }

  my $mask = new POSIX​::SigSet;

  $mask->fillset;
  $mask->delset(SIGINT);

  unless (defined sigprocmask SIG_SETMASK, $mask) {
  die "$0​: sigprocmask​: $!";
  }

  unless (defined raise SIGSEGV) {
  die "$0​: raise​: $!";
  }

  print "almost done...\n";
  [21​:28] fly% ./ptry
  almost done...
  Segmentation fault (core dumped)

Compare this to the equivalent C program​:

  [21​:28] fly% cat try.c
  #include <stdio.h>
  #include <signal.h>

  int
  main(void)
  {
  sigset_t mask;

  sigfillset(&mask);
  sigdelset(&mask, SIGINT);

  if (sigprocmask(SIG_SETMASK, &mask, 0) < 0) {
  perror("sigprocmask");
  return 1;
  }

  if (raise(SIGSEGV) < 0) {
  perror("raise");
  return 1;
  }

  return 0;
  }
  [21​:28] fly% gcc -o try try.c
  [21​:28] fly% ./try
  [21​:28] fly% echo $?
  0

Perl Info

Flags:
    category=library
    severity=low

Site configuration information for perl v5.6.1:

Configured by cmadams at Tue Feb 12 12:31:21 CST 2002.

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
    osname=dec_osf, osvers=5.1, archname=alpha-dec_osf
    uname='osf1 dns.hiwaay.net v5.1 1885 alpha '
    config_args='-des -Dinstallprefix=/usr/local -Dprefix=/usr/local -Dvendorprefix=/usr/local/hiwaay -Dvendorlib=/usr/local/hiwaay/lib/perl5 -Dd_dosuid -Dman3ext=3pm -Ubincompat5005 -Dcf_email=cmadams@hiwaay.net -Dperladmin=cmadams@hiwaay.net -Uuseshrplib -Dpager=/usr/bin/more'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=define uselongdouble=undef
  Compiler:
    cc='cc', ccflags ='-std -fprm d -ieee -D_INTRINSICS -I/usr/local/include -DLANGUAGE_C',
    optimize='-O4',
    cppflags='-std -fprm d -ieee -D_INTRINSICS -I/usr/local/include -DLANGUAGE_C'
    ccversion='V6.4-014', gccversion='', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /var/shlib
    libs=-ldbm -ldb -lm -liconv -lutil
    perllibs=-lm -liconv -lutil
    libc=/usr/shlib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-shared -expect_unresolved "*" -O4 -msym -std -s -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.6.1:
    /data/users/g/gbacon/lib/perl/alpha-dec_osf
    /data/users/g/gbacon/lib/perl
    /usr/local/lib/perl5/5.6.1/alpha-dec_osf
    /usr/local/lib/perl5/5.6.1
    /usr/local/lib/perl5/site_perl/5.6.1/alpha-dec_osf
    /usr/local/lib/perl5/site_perl/5.6.1
    /usr/local/lib/perl5/site_perl
    /usr/local/hiwaay/lib/perl5/alpha-dec_osf
    /usr/local/hiwaay/lib/perl5
    /usr/local/hiwaay/lib/perl5
    .


Environment for perl v5.6.1:
    HOME=/data/users/g/gbacon
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/data/users/g/gbacon/bin:/usr/local/nmh/bin:/usr/local/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin
    PERL5LIB=/data/users/g/gbacon/lib/perl
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/tcsh


@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2002

From [Unknown Contact. See original ticket]

On Sun, Jun 16, 2002 at 09​:31​:47PM -0500, Greg Bacon wrote​:

This is a bug report for perl from Greg Bacon <gbacon@​hiwaay.net>,
generated with the help of perlbug 1.33 running under perl v5.6.1.

-----------------------------------------------------------------
[Please enter your report here]

POSIX​::sigprocmask doesn't seem to permanently alter the signal mask.
Consider​:

\[21&#8203;:26\] fly% cat ptry
\#\! /usr/local/bin/perl

use strict;
use warnings;

use POSIX qw/ :signal\_h /;

END \{ print "exiting\.\.\.\\n" \}

my $mask = new POSIX&#8203;::SigSet;

$mask\->fillset;
$mask\->delset\(SIGINT\);

unless \(defined sigprocmask SIG\_SETMASK\, $mask\) \{
    die "$0&#8203;: sigprocmask&#8203;: $\!";
\}

unless \(defined raise SIGSEGV\) \{
    die "$0&#8203;: raise&#8203;: $\!";
\}

print "almost done\.\.\.\\n";
\[21&#8203;:28\] fly% \./ptry
almost done\.\.\.
Segmentation fault \(core dumped\)

I didn't figure out why, but I did verify it's fixed in RC2.

Solaris 2.7​:

  $ /usr/local/bin/perl
  use strict;
  use warnings;

  use POSIX qw/ :signal_h /;
 
  END { print "exiting...\n" }
 
  my $mask = new POSIX​::SigSet;
 
  $mask->fillset;
  $mask->delset(SIGINT);

  unless (defined sigprocmask SIG_SETMASK, $mask) {
  die "$0​: sigprocmask​: $!";
  }

  unless (defined raise SIGSEGV) {
  die "$0​: raise​: $!";
  }

  print "almost done...\n";
  almost done...
  zsh​: segmentation fault (core dumped) /usr/local/bin/perl

  $ /usr/local/perl580/bin/perl
  use strict;
  use warnings;

  use POSIX qw/ :signal_h /;
 
  END { print "exiting...\n" }
 
  my $mask = new POSIX​::SigSet;
 
  $mask->fillset;
  $mask->delset(SIGINT);

  unless (defined sigprocmask SIG_SETMASK, $mask) {
  die "$0​: sigprocmask​: $!";
  }

  unless (defined raise SIGSEGV) {
  die "$0​: raise​: $!";
  }

  print "almost done...\n";
  almost done...
  exiting...
  $

--
Garry Williams, Zvolve Systems, Inc., +1 770 551-4504

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