[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: so-called pipe files (sh-np-*) do not get deleted when processes clo
From: |
Michael Felt |
Subject: |
Re: so-called pipe files (sh-np-*) do not get deleted when processes close. |
Date: |
Wed, 17 Mar 2021 16:52:49 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
OK - this process on github has not gone exactly as I intended - merged
with master - while I wanted to update, ie., merge with branch 5.0.18.
So, the link may not be accurate.
The change is simple:
diff --git a/subst.c b/subst.c
index 843c9d39..3792e45c 100644
--- a/subst.c
+++ b/subst.c
@@ -5926,6 +5926,8 @@ process_substitute (string, open_for_read_in_child)
#if !defined (HAVE_DEV_FD)
/* Open the named pipe in the child. */
fd = open (pathname, open_for_read_in_child ? O_RDONLY : O_WRONLY);
+ /* now that the file is open (or not) * unlink it to keep garbage down */
+ unlink(pathname);
if (fd < 0)
{
/* Two separate strings for ease of translation. */
On 17/03/2021 16:17, Michael Felt wrote:
On 11/03/2021 18:11, Chet Ramey wrote:
On 3/11/21 11:28 AM, Michael Felt wrote:
Hi,
Issue: AdoptOpenJDK build process makes bash calls in a particular
way. An abbreviated (shorter pathnames) example is:
```
bash-5.0$ /usr/bin/printf "Building targets 'product-images
legacy-jre-image test-image' in configuration
'aix-ppc64-normal-server-release'\n" > >(/usr/bin/tee -a
/home/aixtools/build.log) 2> >(/usr/bin/tee -a
/home/aixtools/build.log >&2)
Building targets 'product-images legacy-jre-image test-image' in
configuration 'aix-ppc64-normal-server-release'
I believe this is fixed in bash-5.1.
I added some debug statements to try and catch what is not
happening. It seems that the fifo_list[i].proc value is never being
set to (pid_t)-1 so any call to `unlink_fifo()` or
`unlink_fifo_list()` does not unlink the special file created.
Probably because the process substitution does not exit before the
shell does.
I spent several days debugging - and, basically, they never get
cleared because the fifo_struct never gets the (pid_t) -1 value assigned.
Although the `reap` function does get called - there is never anything
to do.
The routine that does assign the (pid_t) -1 value is `wait`*something
- and this is only called via an interrupt (aka signal) - as far as I
could see.
in the end I came up with a very simple - basically historical
solution - for working with tempoary files that do not need to survive
the process - unlink() the file immediately after open()>
As I need to document for AdoptOpenJDK I created a mirror of savannah
(git) and created a PR: https://github.com/aixtools/bash/pull/2
I expect much more testing is warrented - as to potential side-effects
with the fifo struct (that is no longer accurate as the file may (read
should) already be unlinked.
Hope this helps,
Michael
OpenPGP_0x722BFDB61F396FC2.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
- so-called pipe files (sh-np-*) do not get deleted when processes close., Michael Felt, 2021/03/11
- Re: so-called pipe files (sh-np-*) do not get deleted when processes close., Chet Ramey, 2021/03/11
- Re: so-called pipe files (sh-np-*) do not get deleted when processes close., Michael Felt, 2021/03/17
- Re: so-called pipe files (sh-np-*) do not get deleted when processes close.,
Michael Felt <=
- Re: so-called pipe files (sh-np-*) do not get deleted when processes close., Chet Ramey, 2021/03/17
- Re: so-called pipe files (sh-np-*) do not get deleted when processes close., Michael Felt, 2021/03/17
- Re: so-called pipe files (sh-np-*) do not get deleted when processes close., Chet Ramey, 2021/03/17
- Re: so-called pipe files (sh-np-*) do not get deleted when processes close., Michael Felt, 2021/03/18
- Re: so-called pipe files (sh-np-*) do not get deleted when processes close., Chet Ramey, 2021/03/18
- Re: so-called pipe files (sh-np-*) do not get deleted when processes close., Michael Felt, 2021/03/20
- Re: so-called pipe files (sh-np-*) do not get deleted when processes close., Chet Ramey, 2021/03/22
- Re: so-called pipe files (sh-np-*) do not get deleted when processes close., Chet Ramey, 2021/03/17