Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91961

Re: fork/exec & close file descriptors

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <random832@fastmail.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'tries': 0.05; 'subject:file': 0.07; 'naturally': 0.09; 'received:internal': 0.09; 'zero.': 0.09; 'wed,': 0.15; 'all?': 0.16; 'descriptor.': 0.16; 'descriptors': 0.16; 'kernel.': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.44': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:compute4.internal': 0.16; 'received:messagingengine.com': 0.16; 'wrote:': 0.16; 'header:In- Reply-To:1': 0.24; 'linux': 0.26; 'error': 0.27; "doesn't": 0.28; 'subject:/': 0.29; 'parent': 0.29; 'returned': 0.32; 'file': 0.34; 'to:addr:python-list': 0.35; 'except': 0.36; 'child': 0.36; 'should': 0.37; 'received:10': 0.37; 'subject:: ': 0.37; 'received:66': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'seem': 0.39; 'why': 0.40; 'your': 0.60; 'close': 0.61; 'from:no real name:2**0': 0.61; 'header:Message-Id:1': 0.62; 'subject: & ': 0.73; 'child,': 0.84
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=/si9puEFoNRYwCCe6dEioOt4npI=; b=NIuPwh 5WSwqDuHucn6Vo7b5qZQY0GWnTF4qm0NmpAIz/vKoG1ed3tC8/r8a+QmSNtyhn82 UY6HBpFgtJyyV8JL5sCUYSrdtl9vUPaLuytOZB7LrwPpwBdN547sokuWu3xHOntd WCy2n+hlFQWeiSaOKcT/U3Ity82WboLCVnJvE=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=/si9puEFoNRYwCC e6dEioOt4npI=; b=cxxnvSIkHaIfd3EK4XsktQX3FnSNx7ZI5awI5H/NJV1NlVG QuNF4LyD24AJWQn7xil1nJsK4zLP5hZ56zvNnbC+CTTWkDJ3sEAmWqxw+G2ydOO/ q1ORvaclucA4/rD98oQ7smqg8379N3M6xG/4UjEa8gXfBgHcdDLxDui7bzwY=
X-Sasl-Enc lPXrLadjouv3MMvQ0qKuTibZUIzpaxsgxDBRrGJ73tTc 1433337679
From random832@fastmail.us
To python-list@python.org
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Content-Type text/plain
X-Mailer MessagingEngine.com Webmail Interface - ajax-073992ec
Subject Re: fork/exec & close file descriptors
Date Wed, 03 Jun 2015 09:21:19 -0400
In-Reply-To <87wpzl3pnn.fsf@elektro.pacujo.net>
References <CANc-5UyeaWqThGFSAuGskz+S2Lrgq0ia9W9DHAie28t9GY+sww@mail.gmail.com> <mailman.59.1433253538.13271.python-list@python.org> <87pp5eksnc.fsf@universite-de-strasbourg.fr.invalid> <87eglt7u5i.fsf@elektro.pacujo.net> <87lhg1lt00.fsf@universite-de-strasbourg.fr.invalid> <87a8wh7nq6.fsf@elektro.pacujo.net> <87d21dl0jc.fsf@universite-de-strasbourg.fr.invalid> <877frl6xxj.fsf@elektro.pacujo.net> <mkmhus$1sr$1@speranza.aioe.org> <556eee15$0$12975$c3e8da3$5496439d@news.astraweb.com> <878uc1567j.fsf@elektro.pacujo.net> <mailman.104.1433336055.13271.python-list@python.org> <87wpzl3pnn.fsf@elektro.pacujo.net>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.107.1433337681.13271.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1433337681 news.xs4all.nl 2890 [2001:888:2000:d::a6]:37692
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:91961

Show key headers only | View raw


On Wed, Jun 3, 2015, at 09:08, Marko Rauhamaa wrote:
> random832@fastmail.us:
> 
> > Why does the child process need to report the error at all? The parent
> > process will find out naturally when *it* tries to close the same file
> > descriptor.
> 
> That's not how it goes.
> 
> File descriptors are reference counted in the Linux kernel. Closes are
> no-ops except for the last one that brings the reference count to zero.
> 
> If the parent should close the file before the child, no error is
> returned to the parent.

Why would the parent close it before the child? Your scenario doesn't
seem to have anything to do with how people actually use subprocesses.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: fork/exec & close file descriptors Skip Montanaro <skip.montanaro@gmail.com> - 2015-06-02 08:58 -0500
  Re: fork/exec & close file descriptors Marko Rauhamaa <marko@pacujo.net> - 2015-06-02 18:28 +0300
    Re: fork/exec & close file descriptors Skip Montanaro <skip.montanaro@gmail.com> - 2015-06-02 10:42 -0500
      Re: fork/exec & close file descriptors Marko Rauhamaa <marko@pacujo.net> - 2015-06-02 19:24 +0300
        Re: fork/exec & close file descriptors Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2015-06-02 16:37 +0000
    Re: fork/exec & close file descriptors MrJean1 <MrJean1@gmail.com> - 2015-06-12 13:43 -0700
  Re: fork/exec & close file descriptors Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2015-06-02 17:59 +0200
    Re: fork/exec & close file descriptors Marko Rauhamaa <marko@pacujo.net> - 2015-06-02 23:05 +0300
      Re: fork/exec & close file descriptors Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2015-06-02 23:06 +0200
        Re: fork/exec & close file descriptors Marko Rauhamaa <marko@pacujo.net> - 2015-06-03 01:24 +0300
          Re: fork/exec & close file descriptors Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2015-06-03 09:21 +0200
            Re: fork/exec & close file descriptors Marko Rauhamaa <marko@pacujo.net> - 2015-06-03 10:41 +0300
              Re: fork/exec & close file descriptors alister <alister.nospam.ware@ntlworld.com> - 2015-06-03 09:38 +0000
                Re: fork/exec & close file descriptors Steven D'Aprano <steve@pearwood.info> - 2015-06-03 22:07 +1000
                Re: fork/exec & close file descriptors alister <alister.nospam.ware@ntlworld.com> - 2015-06-03 12:18 +0000
                Re: fork/exec & close file descriptors Marko Rauhamaa <marko@pacujo.net> - 2015-06-03 15:27 +0300
                Re: fork/exec & close file descriptors alister <alister.nospam.ware@ntlworld.com> - 2015-06-03 13:05 +0000
                Re: fork/exec & close file descriptors Marko Rauhamaa <marko@pacujo.net> - 2015-06-03 17:49 +0300
                Re: fork/exec & close file descriptors Marko Rauhamaa <marko@pacujo.net> - 2015-06-03 15:25 +0300
                Re: fork/exec & close file descriptors random832@fastmail.us - 2015-06-03 08:54 -0400
                Re: fork/exec & close file descriptors Marko Rauhamaa <marko@pacujo.net> - 2015-06-03 16:08 +0300
                Re: fork/exec & close file descriptors random832@fastmail.us - 2015-06-03 09:21 -0400
                Re: fork/exec & close file descriptors Chris Angelico <rosuav@gmail.com> - 2015-06-03 23:32 +1000
                Re: fork/exec & close file descriptors Marko Rauhamaa <marko@pacujo.net> - 2015-06-03 16:33 +0300
                Re: fork/exec & close file descriptors Marko Rauhamaa <marko@pacujo.net> - 2015-06-03 17:43 +0300
                Re: fork/exec & close file descriptors random832@fastmail.us - 2015-06-03 16:08 -0400
                Re: fork/exec & close file descriptors Marko Rauhamaa <marko@pacujo.net> - 2015-06-04 00:09 +0300
                Re: fork/exec & close file descriptors random832@fastmail.us - 2015-06-03 16:07 -0400
                Re: fork/exec & close file descriptors Chris Angelico <rosuav@gmail.com> - 2015-06-04 07:54 +1000
        Re: fork/exec & close file descriptors Chris Angelico <rosuav@gmail.com> - 2015-06-03 09:54 +1000
          Re: fork/exec & close file descriptors Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2015-06-03 09:11 +0200
            Re: fork/exec & close file descriptors random832@fastmail.us - 2015-06-03 08:21 -0400
              Re: fork/exec & close file descriptors Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2015-06-03 15:16 +0200
        Re: fork/exec & close file descriptors Skip Montanaro <skip.montanaro@gmail.com> - 2015-06-02 20:21 -0500

csiph-web