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


Groups > gnu.bash.bug > #16039

Re: leaks fd for internal functions but not external command

Path csiph.com!goblin1!goblin.stu.neva.ru!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 Fri, 20 Mar 2020 11:28:38 +0000
Lines 32
Approved bug-bash@gnu.org
Message-ID <mailman.184.1584703772.3020.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> <40109c28-c4a8-2ea0-cc77-e46a584dc011@case.edu> <CAOj-5WBX2h-nwO-u9ocWitmBQ-o=560dJFZw2xLeojNS5ZKs8Q@mail.gmail.com> <38bf161d-8170-69ba-77d0-638aa0852ad9@case.edu> <CAOj-5WAynQLdAJ9y8tWyXAQKpbB8jXujNVvp8VF817Tt=wRgPQ@mail.gmail.com> <7a33daac-16ba-b98a-54ca-e005fd8b041e@case.edu> <CAOj-5WD0jLQN4eX=gf+wqjRAz4YHVw_9wr747-Gh3dsOkNhXjQ@mail.gmail.com> <8761ae1a-f51c-e468-0a32-3447bfa7f287@case.edu> <CAOj-5WBJA_nxhQ=_Y7307darqs2L55mZqCCU8YOvwN64YwkFGQ@mail.gmail.com> <91868af9-f8a6-bbe2-2983-187683ab5a87@case.edu> <CAOj-5WBWF-o3tKiFti+6uQG6kULXk_=N9UD4AvvKxZZK4+TuOA@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 1584703773 27833 209.51.188.17 (20 Mar 2020 11:29:33 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=8cekKyVZjY0ZTk1+qyzQxTZG6urbRt3Lfii7wKeGqBM=; b=p9Syb5/4VWr77l1Gkwbiv63mOEjpN/sk8OlmKfh1lnPYIhKycbzR5MhnLY/O4yKkxx 6kuKZy6+f81X4RRGsdTJtevX8VubbQT2nrOX1MdiWu3IYkm5/8KoCu/N+vSmeWTUFoa6 LqrKBOot+IB+4zAU8w7J5rOHmgNTtPRDMDiLP65tl2eoERtbIVDgyWIRsndsWx9OnHFk XOp1evMZIykUMHS5YTUzMW1TGtgVsoKkr1BLNh3bHRqcvfWgkR6oRp8wUPocJ2/0lPsr tDGEetWO/E7nl8hRytQ/q1qM7JRIALOYYB6xzzwE+kCzIJsnm2WYZbl4ADZc+ZxWez64 Oe0w==
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=8cekKyVZjY0ZTk1+qyzQxTZG6urbRt3Lfii7wKeGqBM=; b=LsQn8T0rQyY5Q7H8l7piypA96dA9lZC7orhN/s9xYA0+30BLJ8vmXY10F5jIJHc0eE EhzE6BuOnYzE/+ELjAug2Dful4nXQq3ccyk44+qonzFPn6cuHKZq2zm9jxqE8M1h1Akq SUikjpRo/YoCoK+KzjSG9aeJWNuAVofZ6T5DInutBdtllYZjCpIFnz29XdHBHwUv1DjG 6ghCsEyYYXIoGWv9dVlKSd5jXxeCl2b4zJuR7eN3iVqj1aON+IxexwMSoEZPp+108gaP gYpvNod9vr5jst7zKJtxN200+wbtdYmDm0nfSsrQvKnctClSwE79RKZTe0ubE9DztacR HXQw==
X-Gm-Message-State ANhLgQ0mneahK6T7MhJ+6Sva3D2DzfT3iCeBLDrToX50GKa2T7PK0Rfi hg/rNJlxdToJeC8T1QE0K1AxK8oI1q8YZCwgtrExsg==
X-Google-Smtp-Source ADFU+vsmj63vbHJn8w/6JJSdq6+XOmvvptqnr+YjpZ/NvCiIEZhvR6KCwPtkcXd4mByXu48E+mfvR/mxWS15lQucJZo=
X-Received by 2002:a2e:97cf:: with SMTP id m15mr4830978ljj.30.1584703765848; Fri, 20 Mar 2020 04:29:25 -0700 (PDT)
In-Reply-To <91868af9-f8a6-bbe2-2983-187683ab5a87@case.edu>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2a00:1450:4864:20::22f
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-5WBWF-o3tKiFti+6uQG6kULXk_=N9UD4AvvKxZZK4+TuOA@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> <CAOj-5WA0b5Lv9GhXkK6gwoS1uVd2B1a0048tZ6sUNnhVHS+ixg@mail.gmail.com> <40109c28-c4a8-2ea0-cc77-e46a584dc011@case.edu> <CAOj-5WBX2h-nwO-u9ocWitmBQ-o=560dJFZw2xLeojNS5ZKs8Q@mail.gmail.com> <38bf161d-8170-69ba-77d0-638aa0852ad9@case.edu> <CAOj-5WAynQLdAJ9y8tWyXAQKpbB8jXujNVvp8VF817Tt=wRgPQ@mail.gmail.com> <7a33daac-16ba-b98a-54ca-e005fd8b041e@case.edu> <CAOj-5WD0jLQN4eX=gf+wqjRAz4YHVw_9wr747-Gh3dsOkNhXjQ@mail.gmail.com> <8761ae1a-f51c-e468-0a32-3447bfa7f287@case.edu> <CAOj-5WBJA_nxhQ=_Y7307darqs2L55mZqCCU8YOvwN64YwkFGQ@mail.gmail.com> <91868af9-f8a6-bbe2-2983-187683ab5a87@case.edu>
Xref csiph.com gnu.bash.bug:16039

Show key headers only | View raw


This just made me sad:

tedious_function() {
  : # lots of stuff
} {BASH_XTRACEFD}>/dev/null

it would be so cool to be able to disable debug output BASH_XTRACEFD like
that whether or not BASH_XTRACEFD was set.
I guess the variable would have to be local to the function invocation too.

Please add it to the wishlist for bash 5 ;-)


On Thu, 25 Jul 2019 at 15:11, Chet Ramey <chet.ramey@case.edu> wrote:

> On 7/25/19 9:03 AM, Sam Liddicott wrote:
>
> > Perhaps if the named fd is also closed on the same statement that opened
> > it, it could be kept closed rather than saved and re-opened.
> > Being closed at the same statement is a strong indicator that it was only
> > used to aid fd transplants. Why keep open what the author closed?
>
> That's an interesting suggestion. I considered it at some point, and
> there's even a comment in the code about it. I'll look at it again.
>
> Chet
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/
>

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


Thread

Re: leaks fd for internal functions but not external command Sam Liddicott <sam@liddicott.com> - 2020-03-20 11:28 +0000

csiph-web