Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Sam Liddicott Newsgroups: gnu.bash.bug Subject: Re: leaks fd for internal functions but not external command Date: Tue, 23 Jul 2019 16:11:30 +0100 Lines: 33 Approved: bug-bash@gnu.org Message-ID: References: <5c34ecd5-c8b2-7000-46bc-1bbe3f71f163@case.edu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1563894733 18362 209.51.188.17 (23 Jul 2019 15:12:13 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org, bash@packages.debian.org To: Chester Ramey 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=cZC/PzQ/u/fMmpxZp85OoWaH5EYdgm5cppSmyubeY2Y=; b=Ppvc5Ky6li4it6B73CB3KcL+vEvgVQh7raNus4AojaWrPYlMdzlJ3nIJ843Mqq9FTk jUyIPalbYWX7xOBWJPOros0uszUitlxI/v8tnL5uvvpfOOKsg7nl4LmXGP+gjo0/QRPJ fSYL1Jmria30JmKdfmRg7agRyML6ufV4g2MUCjHBSYg29XZ9ZQ7j7iUre0luMENBQl9z BWUUzvo+5wneg7kSM5rXkXx1suEAIQt/qYEQqABWr3tgn3lUiZwr6qtl4fmAJN/5zTMG NH6i6oUvfCPft413NhbGf8y5YhP5t9TNlIG/+0kjT5zc/ZXgIX1l94ahZ4ANH2lLKbHM 5nSg== 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=cZC/PzQ/u/fMmpxZp85OoWaH5EYdgm5cppSmyubeY2Y=; b=RSW4vzg7SbK+wglBLgkAlZKVfyZeyxEDPuozGKNcVd6hNrS74vt+ig+92M7rwCSBzU MqCvmIo4tfO1d84quFWTtItUuB7zF5Ogi2Q6ze24vmq0BexquzBXCQvzsERPw+46ASSL C9c13aLOOzRI4BHtxJGyA5sQ5Iv5LyDlJUMscQbIGdYPHchidcBjChjHcpUKHQyoCrst CNb0b9f4Vc2jHxWVfEeoti8jFFsx4qhrIsmB0V3iEkkWh6I5Rk4T/QOOlqTVNxfawV+A onZYv+xWOw0OO585s54DqwDkyslE6qT0LRLPrG127fUWc74LP5Zy1hCc+COaAlcgvlki cKMA== X-Gm-Message-State: APjAAAW6/aiYEWFsKEtjGnfNjZz30dkwzlKzxmcpj6RkkzXd2mAbjcXH FgyI5Tr2c+9fMELvrrcy3hGkN+MV6EDAnMrOzs0= X-Google-Smtp-Source: APXvYqwTRIA9Rb7KNhEiMSY0zsEex8sHcYweJFwwk7tsWnk/rp7YovsTpM9wnMQqhmqynDhXY9OdzJFa1FWMJjLtDDc= X-Received: by 2002:a2e:89ca:: with SMTP id c10mr24520185ljk.106.1563894726709; Tue, 23 Jul 2019 08:12:06 -0700 (PDT) In-Reply-To: <5c34ecd5-c8b2-7000-46bc-1bbe3f71f163@case.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::236 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <5c34ecd5-c8b2-7000-46bc-1bbe3f71f163@case.edu> Xref: csiph.com gnu.bash.bug:15207 On Tue, 23 Jul 2019 at 16:05, Chet Ramey wrote: > On 7/23/19 10:33 AM, Sam Liddicott wrote: > > > Bash Version: 4.4 > > Patch Level: 20 > > Release Status: release > > > > Description: > > Bash redirection sequence cases a file descriptor to be leaked > > if the main command is an internal function but not if it is > > an external command. > > It's not `leaked': you have a handle on it and can manipulate it as you > wish. > evidently not, it got closed for me with /bin/echo so I couldn't use it as I wish > > Based on prior conversation, I suspect it is supposed to leak > > in the internal case (though that is annoying) but it is > > inconsistent that it does not for the external case. > > It's set to close-on-exec. If you want to use it in a child process, > you have a handle that you can use to dup to another fd. > The report concerns the different behaviour with internal and external operations. Sam