RT notifier: parse templates without header correctly
[openxpki.git] / trunk / package / suse / external-dependencies / Sys-SigAction.spec
blob3256703b6bb356037e166bd65ccfdc0d9df9f37d
2 # - Sys::SigAction -
3 # This spec file was automatically generated by cpan2rpm [ver: 2.027]
4 # The following arguments were used:
5 # --spec-only --version=0.10 '--author=Lincoln A Baxter' Sys-SigAction-0.10.tar.gz
6 # For more information on cpan2rpm please visit: http://perl.arix.com/
9 %define pkgname Sys-SigAction
10 %define filelist %{pkgname}-%{version}-filelist
11 %define NVR %{pkgname}-%{version}-%{release}
12 %define maketest 1
14 name: perl-Sys-SigAction
15 summary: Sys-SigAction - Perl extension for Consistent Signal Handling
16 version: 0.10
17 release: 1
18 vendor: Lincoln A Baxter
19 packager: Arix International <cpan2rpm@arix.com>
20 license: Artistic
21 group: Applications/CPAN
22 url: http://www.cpan.org
23 buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n)
24 buildarch: noarch
25 prefix: %(echo %{_prefix})
26 source: Sys-SigAction-0.10.tar.gz
28 %description
29 Prior to version 5.8.0 perl implemented 'unsafe' signal handling.
30 The reason it is consider unsafe, is that there is a risk that a
31 signal will arrive, and be handled while perl is changing internal
32 data structures. This can result in all kinds of subtle and not so
33 subtle problems. For this reason it has always been recommended that
34 one do as little as possible in a signal handler, and only variables
35 that already exist be manipulated.
37 Perl 5.8.0 and later versions implements 'safe' signal handling
38 on platforms which support the POSIX sigaction() function. This is
39 accomplished by having perl note that a signal has arrived, but deferring
40 the execution of the signal handler until such time as it is safe to do
41 so. Unfortunately these changes can break some existing scripts, if they
42 depended on a system routine being interupted by the signal's arrival.
43 The perl 5.8.0 implementation was modified further in version 5.8.2.
45 From the perl 5.8.2 perlvar man page:
47 The default delivery policy of signals changed in Perl 5.8.0
48 from immediate (also known as "unsafe") to deferred, also
49 known as "safe signals".
52 The implementation of this changed the "sa_flags" with which
53 the signal handler is installed by perl, and it causes some
54 system routines (like connect()) to return EINTR, instead of another error
55 when the signal arrives. The problem comes when the code that made
56 the system call sees the EINTR code and decides it's going to call it
57 again before returning. Perl doesn't do this but some libraries do, including for
58 instance, the Oracle OCI library.
60 Thus the 'deferred signal' approach (as implemented by default in
61 perl 5.8 and later) results in some system calls being
62 retried prior to the signal handler being called by perl.
63 This breaks timeout logic for DBD-Oracle which works with
64 earlier versions of perl. This can be particularly vexing,
65 the host on which a database resides is not available: "DBI->connect()"
66 hangs for minutes before returning an error (and cannot even be interupted
67 with control-C, even when the intended timeout is only seconds).
68 This is because SIGINT appears to be deferred as well. The
69 result is that it is impossible to implement open timeouts with code
70 that looks like this in perl 5.8.0 and later:
72 eval {
73 local $SIG{ALRM} = sub { die "timeout" };
74 alarm 2;
75 $sth = DBI->connect(...);
76 alarm 0;
78 alarm 0;
79 die if $@;
81 The solution, if your system has the POSIX sigaction() function,
82 is to use perl's "POSIX::sigaction()" to install the signal handler.
83 With "sigaction()", one gets control over both the signal mask, and the
84 "sa_flags" that are used to install the handler. Further, with perl
85 5.8.2 and later, a 'safe' switch is provided which can be used to ask
86 for safe(r) signal handling.
88 Using sigaction() ensures that the system call won't be
89 resumed after it's interrupted, so long as die is called
90 within the signal handler. This is no longer the case when
91 one uses $SIG{name} to set signal
92 handlers in perls >= 5.8.0.
94 The usage of sigaction() is not well documented however, and in perl
95 versions less than 5.8.0, it does not work at all. (But that's OK, because
96 just setting $SIG does work in that case.) Using sigaction() requires
97 approximately 4 or 5 lines of code where previously one only had to set
98 a code reference into the %SIG hash.
100 Unfortunately, at least with perl 5.8.0, the result is that doing this
101 effectively reverts to the 'unsafe' signals behavior. It is not clear
102 whether this would be the case in perl 5.8.2, since the safe flag can be used
103 to ask for safe signal handling. I suspect this separates the logic
104 which uses the "sa_flags" to install the handler, and whether deferred
105 signal handling is used.
107 The reader should also note, that the behavior of the 'safe'
108 attribute is not consistent with what this author expected.
109 Specifically, it appears to disable signal masking. This can be
110 examined further in the t/safe.t and the t/mask.t regression tests.
111 Never-the-less, Sys::SigAction provides an easy mechanism for
112 the user to recover the pre-5.8.0 behavior for signal handling, and the
113 mask attribute clearly works. (see t/mask.t) If one is looking for
114 specific safe signal handling behavior that is considered broken,
115 and the breakage can be demonstrated, then a patch to t/safe.t would be
116 most welcome.
118 This module wraps up the POSIX:: routines and objects necessary to call
119 sigaction() in a way that is as efficient from a coding perspective as just
120 setting a localized $SIG{SIGNAL} with a code reference. Further, the
121 user has control over the "sa_flags" passed to sigaction(). By default,
122 if no additional args are passed to sigaction(), then the signal handler
123 will be called when a signal (such as SIGALRM) is delivered.
125 Since sigaction() is not fully functional in perl versions less than
126 5.8, this module implements equivalent behavior using the standard
127 %SIG array. The version checking and implementation of the 'right'
128 code is handled by this module, so the user does not have to write perl
129 version dependent code. The attrs hashref argument to set_sig_handler()
130 is silently ignored, in perl versions less than 5.8. This module has
131 been tested with perls as old as 5.005 on solaris.
133 It is hoped that with the use of this module, your signal handling
134 behavior can be coded in a way that does not change from one perl version
135 to the next, and that sigaction() will be easier for you to use.
138 # This package was generated automatically with the cpan2rpm
139 # utility. To get this software or for more information
140 # please visit: http://perl.arix.com/
143 %prep
144 %setup -q -n %{pkgname}-%{version}
145 chmod -R u+w %{_builddir}/%{pkgname}-%{version}
147 %build
148 grep -rsl '^#!.*perl' . |
149 grep -v '.bak$' |xargs --no-run-if-empty \
150 %__perl -MExtUtils::MakeMaker -e 'MY->fixin(@ARGV)'
151 CFLAGS="$RPM_OPT_FLAGS"
152 %{__perl} Makefile.PL `%{__perl} -MExtUtils::MakeMaker -e ' print qq|PREFIX=%{buildroot}%{_prefix}| if \$ExtUtils::MakeMaker::VERSION =~ /5\.9[1-6]|6\.0[0-5]/ '`
153 %{__make}
154 %if %maketest
155 %{__make} test
156 %endif
158 %install
159 [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
161 %{makeinstall} `%{__perl} -MExtUtils::MakeMaker -e ' print \$ExtUtils::MakeMaker::VERSION <= 6.05 ? qq|PREFIX=%{buildroot}%{_prefix}| : qq|DESTDIR=%{buildroot}| '`
163 cmd=/usr/share/spec-helper/compress_files
164 [ -x $cmd ] || cmd=/usr/lib/rpm/brp-compress
165 [ -x $cmd ] && $cmd
167 # SuSE Linux
168 if [ -e /etc/SuSE-release -o -e /etc/UnitedLinux-release ]
169 then
170 %{__mkdir_p} %{buildroot}/var/adm/perl-modules
171 %{__cat} `find %{buildroot} -name "perllocal.pod"` \
172 | %{__sed} -e s+%{buildroot}++g \
173 > %{buildroot}/var/adm/perl-modules/%{name}
176 # remove special files
177 find %{buildroot} -name "perllocal.pod" \
178 -o -name ".packlist" \
179 -o -name "*.bs" \
180 |xargs -i rm -f {}
182 # no empty directories
183 find %{buildroot}%{_prefix} \
184 -type d -depth \
185 -exec rmdir {} \; 2>/dev/null
187 %{__perl} -MFile::Find -le '
188 find({ wanted => \&wanted, no_chdir => 1}, "%{buildroot}");
189 print "%doc Changes README";
190 for my $x (sort @dirs, @files) {
191 push @ret, $x unless indirs($x);
193 print join "\n", sort @ret;
195 sub wanted {
196 return if /auto$/;
198 local $_ = $File::Find::name;
199 my $f = $_; s|^\Q%{buildroot}\E||;
200 return unless length;
201 return $files[@files] = $_ if -f $f;
203 $d = $_;
204 /\Q$d\E/ && return for reverse sort @INC;
205 $d =~ /\Q$_\E/ && return
206 for qw|/etc %_prefix/man %_prefix/bin %_prefix/share|;
208 $dirs[@dirs] = $_;
211 sub indirs {
212 my $x = shift;
213 $x =~ /^\Q$_\E\// && $x ne $_ && return 1 for @dirs;
215 ' > %filelist
217 [ -z %filelist ] && {
218 echo "ERROR: empty %files listing"
219 exit -1
222 %clean
223 [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
225 %files -f %filelist
226 %defattr(-,root,root)
228 %changelog
229 * Thu Nov 23 2006 root@dca02
230 - Initial build.