Article View: news.software.nntp
Article #84506Re: The mailpost perl script from inn-2.5.3rc1.
From: Julien ÉLIE
Date: Wed, 16 Nov 2011 21:58
Date: Wed, 16 Nov 2011 21:58
48 lines
2903 bytes
2903 bytes
Hi Dennis,
> While doing stuff
> with the database locked, error conditions can cause the script to
> terminate early. Typically this is done by calling mailArtAndDie.
> This will leave a lock in place, which is untidy. This isn't a big
> problem as the shlock program will detect and remove stale locks.
> The simple patches appended below will try to prevent stale locks
> being left behind.
The same problem affects:
- contrib/thdexpire.in
- control/controlchan.in + newgroup.pl and rmgroup.pl modules
- frontends/pullnews.in
(backends/send-uucp.in already deals with the "untidy exit".)
> # Acquire a lock.
> INN::Utils::Shlock::lock($lockfile, 5) or mailArtAndDie ("cannot create lockfile $lockfile");
> + $locked = 1;
[...]
> # Unlock.
> INN::Utils::Shlock::unlock($lockfile) or mailArtAndDie ("cannot unlock $lockfile");
> + $locked = 0;
[...]
> +END {
> + INN::Utils::Shlock::unlock($lockfile) if $locked;
> }
Instead of using a $locked variable, wouldn't it be better to add a
INN::Utils::Shlock::releaselocks() function?
INN::Utils::Shlock would then keep track of still used lock files during
the run of a Perl script (through an array because several lock files
can exist at the same time for a script).
Then, it would be enough to add INN::Utils::Shlock::releaselocks() in an
END section in all the Perl scripts using this module.
--
Julien ÉLIE
« Videt non te diu. »
Technical Details
Message-ID:
<ja1blc$13g$1@news.trigofacile.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!weretis.net!feeder4.news.weretis.net!news.matabio.net!jeffrey.matabio.net!news.trigofacile.com!.POSTED.aaubervilliers-552-1-72-197.w83-200.abo.wanadoo.fr!not-for-mailReferences:
<LuC8By.M8s.B.shoe@bath.ac.uk>Show Full Headers
Complete Article Headers
Message-ID: <ja1blc$13g$1@news.trigofacile.com> Subject: Re: The mailpost perl script from inn-2.5.3rc1. Date: Wed, 16 Nov 2011 22:58:04 +0100 From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> References: <LuC8By.M8s.B.shoe@bath.ac.uk> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!weretis.net!feeder4.news.weretis.net!news.matabio.net!jeffrey.matabio.net!news.trigofacile.com!.POSTED.aaubervilliers-552-1-72-197.w83-200.abo.wanadoo.fr!not-for-mail Newsgroups: news.software.nntp Organization: TrigoFACILE -- http://www.trigofacile.com/ Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 16 Nov 2011 21:58:05 +0000 (UTC) Injection-Info: news.trigofacile.com; posting-host="aaubervilliers-552-1-72-197.w83-200.abo.wanadoo.fr:83.200.71.197"; logging-data="1136"; mail-complaints-to="abuse@trigofacile.com" User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.7; fr; rv:1.9.2.24) Gecko/20111103 Thunderbird/3.1.16 In-Reply-To: <LuC8By.M8s.B.shoe@bath.ac.uk> Lines: 47 X-Original-Bytes: 2607