Bug#290507: vim does not close file upon :sh

James Vega jamessan at debian.org
Wed Jul 29 11:16:31 UTC 2009


On Wed, Jul 29, 2009 at 10:19:32AM +0200, Bram Moolenaar wrote:
> 
> James -
> 
> On Sat, Oct 07, 2006 at 03:32:45PM +0200, Bram Moolenaar wrote:
> 
> ugh, cough, that's a dusty email!

I finally had a chance to look into this and find how we could avoid it.
:)

> On Sat, Oct 07, 2006 at 03:32:45PM +0200, Bram Moolenaar wrote:
> > > Hmm, perhaps the problem is that system() or execvp() doesn't close the
> > > file descriptors in a child process?
> > 
> > Indeed, that is the case.  Children inherit their parent's file
> > descriptors unless the file descriptors are set to close on exec().
> > Attached patch does that.
> 
> I don't think the FD_CLOEXEC flag is always available.  I'm not sure
> when it was added.  Adding an autoconf check for it will help to avoid
> breaking the build on old systems.

I don't know autoconf, so I'm afraid I wouldn't be able to provide this
part of the patch any time soon.  FD_CLOEXEC is required by POSIX
though, so I'm unsure how much this check is really needed.

> This page mentions that one should get the flags first:
> http://www.cs.ui.ac.id/WebKuliah/IKI10100/resources/contest/OnlineJudge/gnudoc/libc/Descriptor_Flags.html

Ah, yes.  Currently FD_CLOEXEC is the only supported flag, but that
would be the proper way to do this for long-term robustness.  Should I
update this part of the patch or will you take care of it with the
autoconf checks?

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20090729/4b168d46/attachment.pgp>


More information about the pkg-vim-maintainers mailing list