Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15220
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Chet Ramey <chet.ramey@case.edu> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: leaks fd for internal functions but not external command |
| Date | Tue, 23 Jul 2019 20:20:41 -0400 |
| Organization | ITS, Case Western Reserve University |
| Lines | 61 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.2121.1563927651.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> <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> |
| Reply-To | chet.ramey@case.edu |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | usenet.stanford.edu 1563927651 2701 209.51.188.17 (24 Jul 2019 00:20:51 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | chet.ramey@case.edu, bug-bash@gnu.org, bash@packages.debian.org |
| To | Sam Liddicott <sam@liddicott.com> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1563927647; bh=ziyHWRcvTCgxFCYmgspIbnY0GH0vn03gXSLhODSe6lE=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=obaJ2/wbOycxTH5UnB6b31+AL6+DSUbRilgyA4wDgtgnko72Jtf+03Tbpf4kBNFw/U 49/LHq29OWIU/oflnVlzAQ1pwONYwRxIQji0hN5TQSARAQjJyuHuq83ni8scYNJZxoi kYJKQrysyFmA9PDU3ef+V03odcrvmkQhgsJl20ve0gHQlb81ZUYeXS+yOmqX/6acaj8 jMCubvzMvQQzd3PPv+lkm41qKARb33k6l00gGMb+rtZ4nUfta8armDf74IoQxb9TeCg 9W3zBeVrpHMjOE0nQuPuzdL80e6KI8IeoJEbWjFknfr3E1f99geRLHFyKEPAaOUQ5L+ D9myo5cA== |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1563927645; bh=9a2y12F+YHRfUpx/flAD5BZdpVMLceu7ZiJhLelh5XI=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=VV5fUQFYw60Uovt02H2F22hdFmgCJG2K2D+cg9jRrL+JRgKeyQalSJizzVErEBvE4Y hgbuTPXmkceef06MXdlR+tCBl+w1FW+nIYL+beDr0unkNUvZRvgUUULzjQxrMBIhvev 1u/ATZ7qBOCCt4RkfOTxE+vIZXgiulqiZsTTFIMbWOAcUWuC3/g5KW1MfsyUv54RRte jVDX0PbhpW9db0nk5M9pfsQAcLrZEy4oiahiYDJB9X2GNkftee3lZOul/tXmTu5iW5p tQytNPMfHgYWdRvn8ut2HRbFaBrV8YmsqsMCiZdN46ZwWf+/66Bx9Nxwh6XwNRnkwvW Jm8d/w9g== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:cc:subject:to:references:from:openpgp :autocrypt:organization:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=9a2y12F+YHRfUpx/flAD5BZdpVMLceu7ZiJhLelh5XI=; b=fvHlxASw1NLC2eHyak6sE43/5KLEoVz+tvaIEbX3HKoFMaSxU2Nt29NrEg2WdjI9JD hTXhbVY1LGBcZAjiJUcIUGCvZs73Xa59GyMYN7Bs9KQAGkGDCt5Emnc9XNh/JAYROGtU Tmdk8eHqw5U6ezt2TKqf2AbBCzE9131o095Jyp4NxZOZvpsCsYaFPQLr0904g/C1UWnn oLvrPUT2ft62S0OGkCvVR+flAQdHrV9BxFyytMMP1gyEtVOV3jrJtfw58HRYwSlAJ7B5 FfaJMk0LniqugBFAkdlPzMXjQAmizCfXidIgBXTBOJzZ7ZMtO0FEmdKEOcudb4RETCjH BIbg== |
| X-Gm-Message-State | APjAAAVWvS9ZzngFYbRuN2tnzNoT+0lvqkZf2qrhuRAJbWSRn7nKl1ps oHBKg3VrMK8lV/odv4VrFhzKiNihSRUii+U7IxUct4C79ovaUeh6AgO0okNOHebIEfrMcnKzc2i 27oc/89/o0BU= |
| X-Received | by 2002:a81:6d90:: with SMTP id i138mr50438661ywc.471.1563927644647; Tue, 23 Jul 2019 17:20:44 -0700 (PDT) |
| X-Google-Smtp-Source | APXvYqzF7AE1fccsFoMdM3rbYYR9Q//Z3FPIY0wULzFEVFHefPxWp/HpQVH26vznbOuLTHlYVscuuQ== |
| X-Received | by 2002:a81:6d90:: with SMTP id i138mr50438640ywc.471.1563927644313; Tue, 23 Jul 2019 17:20:44 -0700 (PDT) |
| Openpgp | preference=signencrypt |
| Autocrypt | addr=chet.ramey@case.edu; prefer-encrypt=mutual; keydata= mQGiBEEOsGwRBACFa0A1oa71HSZLWxAx0svXzhOZNQZOzqHmSuGOG92jIpQpr8DpvgRh40Yp AwdcXb8QG1J5yGAKeevNE1zCFaA725vGSdHUyypHouV0xoWwukYO6qlyyX+2BZU+okBUqoWQ koWxiYaCSfzB2Ln7pmdys1fJhcgBKf3VjWCjd2XJTwCgoFJOwyBFJdugjfwjSoRSwDOIMf0D /iQKqlWhIO1LGpMrGX0il0/x4zj0NAcSwAk7LaPZbN4UPjn5pqGEHBlf1+xDDQCkAoZ/VqES GZragl4VqJfxBr29Ag0UDvNbUbXoxQsARdero1M8GiAIRc50hj7HXFoERwenbNDJL86GPLAQ OTGOCa4W2o29nFfFjQrsrrYHzVtyA/9oyKvTeEMJ7NA3VJdWcmn7gOu0FxEmSNhSoV1T4vP2 1Wf7f5niCCRKQLNyUy0wEApQi4tSysdz+AbgAc0b/bHYVzIf2uO2lIEZQNNt+3g2bmXgloWm W5fsm/di50Gm1l1Na63d3RZ00SeFQos6WEwLUHEB0yp6KXluXLLIZitEJLQwQ2hldCBSYW1l eSAoQ2FzZSBzdGFuZGFyZCkgPGNoZXQucmFtZXlAY2FzZS5lZHU+iF8EExECAB8FAkPi19EC GwMHCwkIBwMCAQMVAgMDFgIBAh4BAheAAAoJELtYafBk6nSrelkAn31Gsuib7GcCZHbv5L5t VKYR9LklAJ4hzUHKA49Z0QXR+qCb80osIcmPSbkBDQRBDrBvEAQAkK6TAOKBEM+EC4j6V/7o /riVZqcgU5cid2qG9TXdwNtD9a3kvA/ObZBO93sX59wc6Bnwo4VJxsOmMlpGrAjJsxNwg3QH akEtf8LXRbVpj5xStdmBdQZUhIQyalo/2/TZq5OijtddUQcL5cs70hTv/FpT3wUvr2Xr8rjF 41IFEz8AAwcD/A0CZEGlzIrT5WCBnl6xBog/8vKiUCbarByat3d1mL6DbizvKNXQRTC9E/vE dENAWCQCjr75Bu55xT8n3SXGtWdDC5xmZ/P3OBYORP8yl8H8I1FIosWOFirbIeYdZPq8SPD1 HL+EXo9zSiHVrrZRJ19ooCKKbSdXHFCY+aJG+0KZiEkEGBECAAkFAkEOsG8CGwwACgkQu1hp 8GTqdKvjcACfZlkVCDwaz/NTO9cy3t69oWpVPNwAnRwe0qk/WL/gfhH346xh5B3HFbFN |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
| In-Reply-To | <CAOj-5WAynQLdAJ9y8tWyXAQKpbB8jXujNVvp8VF817Tt=wRgPQ@mail.gmail.com> |
| Content-Language | en-US |
| X-Junkmail-Status | score=8/90, host=mpv2-2015.case.edu |
| X-Junkmail-PrAS-Raw | score=8/90, refid=2.7.2:2019.7.23.235117:17:8.317, ip=, rules=__YOUTUBE_RCVD, DKIM_SIGNATURE, __X_GOOGLE_DKIM_SIGNATURE, __HAS_REPLYTO, __HAS_CC_HDR, __MULTIPLE_RCPTS_CC_X2, __SUBJ_REPLY, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC, __HAS_REFERENCES, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN, __DKIM_ALIGNS_1, __DKIM_ALIGNS_2, __ANY_URI, __URI_WITH_PATH, __URI_NO_WWW, __CP_NAME_BODY, __CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG, __BODY_NO_MAILTO, __NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_2000_2999, __MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138 |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] |
| X-Received-From | 129.22.103.227 |
| 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 | <7a33daac-16ba-b98a-54ca-e005fd8b041e@case.edu> |
| 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> |
| Xref | csiph.com gnu.bash.bug:15220 |
Show key headers only | View raw
On 7/23/19 5:15 PM, Sam Liddicott wrote:
> I'm very surprised that you continue to insist that it should be a *design*
> decision that it should be hard for a script writer to be able to tell if a
> handle will be left open or not.
What? The design decision is that a file descriptor opened with {var} will
remain open after the command completes.
> What could be the rationale for such a design decision?
To make the redirection operator a little more useful than simple syntactic
sugar.
> The vague justification you provide "there are plenty of things that depend
> on whether or not a command is builtin, or whether it's run in the parent
> shell" is true but more relevant to an implementation constraint than a
> design decision.
An implementation constraint? That doesn't make any sense.
The bash documentation makes it pretty clear which commands are builtin and
the circumstances under which commands are run in child processes and which
are run by the shell itself.
> I'm confident that most of these things you hint at are too *avoid* the
> scripter needing to be aware of the difference between internal and
> external commands.
Bash doesn't make it particularly obscure about which commands are builtin,
and, as I said, the man page documents all of them.
The builtin commands all provide functionality that can't be duplicated
outside the shell itself, even the builtins that duplicate external
commands (e.g., printf -v). Someone who writes shell scripts should be
aware of what's builtin and what's not.
But that's not the problem here.
>
> A design decision may well be to leave a variable handle open, but what
> *design* decision would add the proviso that it not be an external command?
This makes me believe that you have a fundamental misunderstanding about
how the shell operates.
The design decision is to leave the file descriptor open, as I said above.
It's left open in all cases. The difference is that commands that are run
from the file system perform redirections in the child process, and child
processes cannot affect their parent's environment. That means, among other
things, that a file descriptor that a child process opens does not affect
the parent's descriptor set. That has nothing to do with the behavior of
{var} per se; it's a consequence of the relationship between Unix
processes.
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 | Unroll thread
Re: leaks fd for internal functions but not external command Chet Ramey <chet.ramey@case.edu> - 2019-07-23 20:20 -0400
csiph-web