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


Groups > gnu.bash.bug > #15214

Re: leaks fd for internal functions but not external command

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Sam Liddicott <sam@liddicott.com>
Newsgroups gnu.bash.bug
Subject Re: leaks fd for internal functions but not external command
Date Tue, 23 Jul 2019 16:40:03 +0100
Lines 47
Approved bug-bash@gnu.org
Message-ID <mailman.2084.1563896445.2688.bug-bash@gnu.org> (permalink)
References <CAOj-5WDk=8kt=J8wO23giFVWRp5=_GbCNB2HQO87Upc4kkTg+g@mail.gmail.com> <5c34ecd5-c8b2-7000-46bc-1bbe3f71f163@case.edu> <CAOj-5WCFbUoU1x2aUvidT1opUbGeG2jFSaM__ch=SUAfzQbQ9w@mail.gmail.com> <78679ee9-fdaf-5180-d32f-81d92b936538@case.edu> <CAOj-5WBei5KMar7c967=jSwZRsW-Rz-0iL20TQMeuQoz61rfkw@mail.gmail.com> <CAOj-5WA_URW5b7a2EU+rR=T_wbTDEpOM_PSo9yNyU-Dqj+cWaA@mail.gmail.com> <f6acdcca-4c7c-b05c-004d-9b8ceab1e169@case.edu> <CAOj-5WA0b5Lv9GhXkK6gwoS1uVd2B1a0048tZ6sUNnhVHS+ixg@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1563896446 18968 209.51.188.17 (23 Jul 2019 15:40:46 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org, bash@packages.debian.org
To Chester Ramey <chet.ramey@case.edu>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=liddicott-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=r07WUTPUtT5MLrg35IBiCGkqXPQIsYxApVaICeruqSU=; b=1brqPqX6NHPFaCuCd2ZunhtRksByOTRxB7TF6JbLYlEQKacXLnErqgxVuXo07NFAh1 rE2kP8VNujR8DhcXYOWmqXQo9li+214MYDFKGf/pyMlMD76CrJPdwBqCv/yjzLPqVtqx o4+gw1KO9xVVBdxfzPmQt48kbNGlarMGqR+8AHPPG+smEBvStkoGA4JRvBg9QTKgqpzB eSk6kanh03MmVyq8dld9zWZ+Gos+VOmBNc0io2blvaCjOrS9bZQYYZvh7L+W1R/GbH3O P/m/zvSOCLQpuqo3VUBeY4nF5z9RqYL+NuxMq1DQ2bx1QPXSQOb7wvEvKK9+IVdDNDZL 3jlg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=r07WUTPUtT5MLrg35IBiCGkqXPQIsYxApVaICeruqSU=; b=Y2H7NAPI2zAAKwiObnGLrBeUd8W928VeGywKlwEZCtJnrUSgnI4LAUyZ5WFUEa2tTL Yzu8ILJdVokwfIXsI+oHtZnxrlkzAbCS6UnKTda+PS1kqaYpdSE67fP1Zsj2dZLZ4Mbt Gs+fNDNPHvtqZuPIgwDpWbCuhkYZ4tJpuLqBb7JBCjNX+F4MhxVMq049LvNlOUllq9WR QMDWmUfUcTYoq4LB7wQWggQfIe4utBOtds/54PU8HWPPkK67SLXHgfQvaxntcWyAnIy6 s0bpvq2nIwJdPVQu5jXojEizRtrHgONeAGA40iT5VcFlmwkPSX9YTBOR24IBZa8b8WVo QEQA==
X-Gm-Message-State APjAAAXjN5YHBNLRORCJeZdV6uouGZtxWOUyhFu3WCqI9K5Hg4PKJgOR xZewu9j0F5qneDiEbSpbiBZFWrkTFPh/sxrIYhTwQQxY
X-Google-Smtp-Source APXvYqwtvhpm8VNd/oO+bIgXV6HzbLhmGM4Qaa59AoAcvdLsfPx/lC1Ft8RbJMu3noOFJWpYC0z2Bu2baWEnSytYcbI=
X-Received by 2002:a2e:89ca:: with SMTP id c10mr24598239ljk.106.1563896440198; Tue, 23 Jul 2019 08:40:40 -0700 (PDT)
In-Reply-To <f6acdcca-4c7c-b05c-004d-9b8ceab1e169@case.edu>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2a00:1450:4864:20::22d
X-Content-Filtered-By Mailman/MimeDel 2.1.23
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAOj-5WA0b5Lv9GhXkK6gwoS1uVd2B1a0048tZ6sUNnhVHS+ixg@mail.gmail.com>
X-Mailman-Original-References <CAOj-5WDk=8kt=J8wO23giFVWRp5=_GbCNB2HQO87Upc4kkTg+g@mail.gmail.com> <5c34ecd5-c8b2-7000-46bc-1bbe3f71f163@case.edu> <CAOj-5WCFbUoU1x2aUvidT1opUbGeG2jFSaM__ch=SUAfzQbQ9w@mail.gmail.com> <78679ee9-fdaf-5180-d32f-81d92b936538@case.edu> <CAOj-5WBei5KMar7c967=jSwZRsW-Rz-0iL20TQMeuQoz61rfkw@mail.gmail.com> <CAOj-5WA_URW5b7a2EU+rR=T_wbTDEpOM_PSo9yNyU-Dqj+cWaA@mail.gmail.com> <f6acdcca-4c7c-b05c-004d-9b8ceab1e169@case.edu>
Xref csiph.com gnu.bash.bug:15214

Show key headers only | View raw


On Tue, 23 Jul 2019 at 16:35, Chet Ramey <chet.ramey@case.edu> wrote:

> On 7/23/19 11:20 AM, Sam Liddicott wrote:
> >
> > On Tue, 23 Jul 2019 at 16:15, Sam Liddicott <sam@liddicott.com
> > <mailto:sam@liddicott.com>> wrote:
> >
> >
> >
> >     On Tue, 23 Jul 2019 at 16:13, Chet Ramey <chet.ramey@case.edu
> >     <mailto:chet.ramey@case.edu>> wrote:
> >
> >         On 7/23/19 11:11 AM, Sam Liddicott wrote:
> >
> >         > The report concerns the different behaviour with internal and
> >         external
> >         > operations.
> >
> >         Right. The close-on-exec is deliberate. That's how it was
> intended.
> >
> >
> >     Doesn't close-on-exec usually takes effect only on the process that
> >     does the exec?
> >     i.e. the fork that does the exec, not the parent process?
> >
> >
> > It got closed in the parent. The lsof is running for the parent, the main
> > process. /bin/echo has quit before the lsof runs.
>
> You mean case 2 in your original post? That's because redirections are
> performed in the child process forked to run /bin/echo, so the fd never
> exists in the parent process. I thought you were talking about case 1,
> with the builtin echo.
>

No doubt, but this report concerns the inconsistency.

Is using {xxx}>... suppose to give me a file handle I can use as I wish (as
you say), or not?

Using explicit descriptors e.g. 10>... behaves consistently whether the the
command is internal or external.

Having bash allocate the descriptor is not consistent.

Sam

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: leaks fd for internal functions but not external command Sam Liddicott <sam@liddicott.com> - 2019-07-23 16:40 +0100

csiph-web