delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/08/06/10:14:07

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=HoyEK60ZnCIHiy6jVN/gfILh6ZvOQfNM8j1KPLntj9TD7aG3SEeuG
KpqqOAlNuUVbPg1YkXzVmg65cnn4RRYDW8sqWOLsAaFT8Ti/RLRqkBl9y31ue8np
owyCSg4MAFG6W0Dna9dw5hhDr7lKfTG4KT7KItvjVlG0MXwiGH3Vck=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=PSAgy8MZd3sGZP7fNVEWCNUqPMM=; b=MFBruKq7J1sk6IFZpPqYbNuUzvOY
3Tn9tSDbrjKCPz7KvXcVtz1o+f/V66xVtnmACvM0y9CJm+cx2CDvt1Ei7ZWkymAM
8PRIVExOXEiUQL6CH6MK2kfWu0Bjbw7e5DSOhxZxZqxi4lIPgTo80bV1BX23N2yV
5x8YVz10RuPk+CY=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Wed, 6 Aug 2014 16:13:47 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: syslog function: Bad file descriptor
Message-ID: <20140806141347.GL13601@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <53E10628 DOT 3C42FD6F AT boland DOT nl> <20140805164842 DOT GA13601 AT calimero DOT vinschen DOT de> <53E117B7 DOT 4C81186A AT boland DOT nl> <20140805190014 DOT GD13601 AT calimero DOT vinschen DOT de> <53E13FFE DOT E7A33C0D AT boland DOT nl> <20140806091941 DOT GK13601 AT calimero DOT vinschen DOT de> <53E211DD DOT 12F8D5C8 AT boland DOT nl>
MIME-Version: 1.0
In-Reply-To: <53E211DD.12F8D5C8@boland.nl>
User-Agent: Mutt/1.5.23 (2014-03-12)

--9s922KAXlWjPfK/Q
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Aug  6 13:30, D. Boland wrote:
> Hi Corinna,
>=20
> Corinna Vinschen wrote:
> >=20
> > On Aug  5 22:35, D. Boland wrote:
> > > Corinna Vinschen wrote:
> > > >
> > > > Can you produce another strace for the overwriting case (non-R/O al=
iases)
> > > > for comparison?  Also, can you do the same strace with no syslogd r=
unning?
> > > >
> > > > It might be necessary to create a few test versions of Cygwin with =
more
> > > > debug output, but let's please see these straces first.
> > >
> > > I attached all three of them in a zipped file.
> >=20
> > Thanks.  I got it now.  AFAICS it's a bug in sendmail.  Take a look
> > into your newaliases.strace.txt file.  Start at line 260 (stripping
> > off timestamp, thread and process info):
> > [...]
> > Without looking into the sources, I'd assume there's a closelog()
> > call missing prior to the descriptor close orgy.  This closelog()
> > call should fix the problem.
>=20
> It is exactly as you say. I found the close() orgy and put a
> closelog() prior to it.  Now it works perfectly without corrupting the
> aliases file (writable to sendmail).

Nice.

> I'm asking myself if this closing of 253 file descriptors is a
> sensible thing to do.  What would Sendmail be trying to accomplish
> there? It comments "Be shure we have enough file descriptors". And:
> "in 4.4BSD, the table ([of fd's]) can be huge; impose a reasonable
> limit". Bizarre.

I think this is really old stuff, in the sense that this method has been
used on UNIXoid systems for ages.  It depends on how many open fds
sendmail inherited from its parent process (once typically an rc shell
script) which was questionable back in the days sendmail was young I
guess, and if sendmail forks/execs, it's a way to disallow arbitrary fds
inheritance by the child.

> Could it be that incoming e-mail is such a volatile process that
> previous opened file descriptors are not closed quick enough? This
> feels like a crude hack.

Sendmail is not the only one doing this.  There's similar code in
tcsh, for instance, but tcsh doesn't call syslog.  The bug here seems
to be an upstream bug which just hasn't been catched yet because
syslog() works somewhat differently on other systems and hide their
file descriptor usage somehow.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--9s922KAXlWjPfK/Q
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJT4jgaAAoJEPU2Bp2uRE+gXUQP+wdG32LwaYbcIsHXSNiQDzlm
bOm//py3hfd3BCU834wgc+ojw0B1DiG6w/pb9g0EIHtVKaeebwUQKXVebNJqoS2S
BN2xPPVZbEd9o1DUH75RtWRaooaYKmXXXuCXWP/ARcTifR1/wXGQy8k+lGjDSb+4
FPbB4/WsFsiT/VZD+Vuym+nfWgM6e8DtTO62PYc3O6cKkwgiX9/kZhNeoA7Cs8wf
hCuSJdbcGrDxBgiWKb0WPptxsREa6ucEA8hC7WlymSXlJeXP4Rht3K8miw8clWAn
Kao3+0P90DTERucBZ1oHm10NYU5HUvkgO7dPRHe+ocVV79YcatvPHnY8mEBwnzaj
LYGAkieJXm3xXFKM0wiH8z/dPEAWrciJWBizEAmWmR3U8BB4SUhsUFhcoVB5A4j2
XgZzSVSUP1o7Ugs+WNcqiouAfMwt1G4ivvNCKh1+LBhDQtaYdBI5W1psKPy6VCw4
xRZjRemNzsnjPsfXYb0bwOHNyLyX45AHVHiLQQZ+LmquD4QQ0wZQcfMaFRluTL3b
tv7CHfZx2XsMRSxclWVzzpf51jdXJH6nBRIPX9i4GjNillxvh/ia3PobZCkshSxT
aEbyJpgdX5pJnfkAbWQInVx8S8ioXvCqVLsaaHrF1LlaE9lKeTovu1JEaufUriv8
62OlxvaCQaiOYCbfp+/o
=yReK
-----END PGP SIGNATURE-----

--9s922KAXlWjPfK/Q--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019