Re: Automatic refresh for local Maildir's mail counts -- an attempt based on named pipes
Sam Varshavchik <[email protected]> Mon, 26 Mar 2018 20:06:26 -0400
| Newsgroups | gmane.mail.cone |
|---|---|
| Message-ID | <[email protected]> |
This is a MIME GnuPG-signed message. If you see this text, it means that
your E-mail or Usenet software does not support MIME signed messages.
The Internet standard for MIME PGP messages, RFC 2015, was published in 1996.
To open this message correctly you will need to install E-mail or Usenet
software that supports modern Internet standards.
--===============1830401100097433197==
Content-Type: multipart/signed;
boundary="=_monster.email-scan.com-62791-1522109186-0001";
micalg=pgp-sha1; protocol="application/pgp-signature"
This is a MIME GnuPG-signed message. If you see this text, it means that
your E-mail or Usenet software does not support MIME signed messages.
The Internet standard for MIME PGP messages, RFC 2015, was published in 1996.
To open this message correctly you will need to install E-mail or Usenet
software that supports modern Internet standards.
--=_monster.email-scan.com-62791-1522109186-0001
Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Linux-Fan writes:
> The actual error (why I initially got endless loops when trying to do t=
his), =20
> was with my understanding of named pipes: What actually caused the endl=
ess =20
> loop was that whenever I notified Cone from offlineimap, the named pipe =
got =20
> closed in the process, causing POLLHUP to be returned (immediately) on =
all =20
> subsequent poll invocations.
Closing and reopening is fine, but the usual approach here is to open the =20
named pipe twice, both for reading and writing, and having the named pipe =20
opened for writing will prevent this POLLHUP. But, again, this is fine. T=
he =20
only problem this might potentially cause is that there's a brief period =
of =20
time when the named pipe is closed, and anything that happens to open it =
for =20
writing, at that time, will fail unless it's specifically coded to handle =20
this eventuality.
>
> I have now fixed this by re-opening the file descriptor once POLLHUP is =20
> returned and now it works as expected. See attached =20
> `patch_cone_refresh_with_named_pipe_2.diff`.
I took a closer look at this code.
The named pipe should have the FD_CLOEXEC flag set, to prevent it from be=
ing =20
inherited by child processes.
You also place the file descriptor into the poll vector even if it's not =20
used, if the file descriptor is -1. I was actually surprised to learn tha=
t =20
this is not an error, and this is actually documented as a no-op, in the =20
poll() manually page. You got lucky there=E2=80=A6
If you'd like to tweak this further and set FD_CLOEXEC on the pipe, you c=
an =20
go ahead and do this, but this looks ok, as is.
--=_monster.email-scan.com-62791-1522109186-0001
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
-----BEGIN PGP SIGNATURE-----
iQIcBAABAgAGBQJauYsCAAoJEGs6Yr4nnb8lAXoQAIDGJ5/uAm1scDsieygYooJI
GdMW+P7yK8kDV72I1/rUI0zsnL1cEnTplI0fgdd/fFBp7UAACW81FsTq3XkNdJ2i
fVX7QLMZupMXPa0BykUL0xA68XjNWccEUOC0iQgva2PBQ1rjGuxl22ZZzcbnWDCH
Ecqnnr6qIeJS5cOZu4XKrYsDVwFhJKQE+mkMDZJyTx32D9rArbC0ZXM9Pkn8DhwC
z59Cy/lCQGMWn/imXlnd6iDoaMP07NwZmMYON5XNK34WvddCrWV9VLywkh/Vb2gD
/BlNdcRnY72wBnixqNc83AUFrik1ZYxasepdVBBYVfg3WoitboHjeAtmfLhG4ymN
jt8XM6onxD5D1p/pScJTSz96gyblijMOfo+45y3D1VJwRLZ0xSPoOCm9jwRRTbtS
c5bBU1cxp1N3zof2S0z7a/BWS2DXBex7BtV88jJFjDi64Emdt0KYeP7/PLU++Lk1
bL5tySEOu7AqoP73pIilxV0/i+tR/fyYTSN8OLf5XF4rXVjZ4zz+wDviIDRW/YtW
XIZsklTx53BFLW03HlnDKrrYP+sgRuWEPcYHgxqo2SCNy+lQNkQ7CI6dsuTxkf4n
hsn4fJlW58j4chN/5IcZS/m5+4iDFQbYZRI1mo4b+HF/AF3iOsmZTagJeZ31DBFE
/hPH1V3hF1ttGscQ8mSx
=ooLl
-----END PGP SIGNATURE-----
--=_monster.email-scan.com-62791-1522109186-0001--
--===============1830401100097433197==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
--===============1830401100097433197==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Courier-cone mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-cone
--===============1830401100097433197==--