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


Groups > gnu.bash.bug > #15924

Re: Procsub.tests on OSes using named pipes

From "CHIGOT, CLEMENT" <clement.chigot@atos.net>
Newsgroups gnu.bash.bug
Subject Re: Procsub.tests on OSes using named pipes
Date 2020-02-20 14:32 +0000
Message-ID <mailman.1249.1582209189.2412.bug-bash@gnu.org> (permalink)
References <96a8e651-ce82-b295-fa3e-53a2f94e53c9@case.edu> <DB7PR02MB4075FD0320086B0A7327AD3CEA130@DB7PR02MB4075.eurprd02.prod.outlook.com>

Show all headers | View raw


I've just figured that the [ -e "$1" ] in the handler might cause some problems. 
Sometimes, the named pipes isn't yet removed thus [ -e "$1" ] will be true and the return part won't be called. 
I'm not sure why it isn't removed directly, but it might just be how the AIX kernel is handling files. 
Therefore, here is the second version of the patch. 

Note that I'm still trying to find a fix for the unkilled subprocesses stuck in the open syscall. 
I might have found a workaround but not a true fix yet. Moreover, I still have some freezes sometimes. 
The workaround consists on forcing an open + unlink of all the FIFOs created by a bash when this one is closing.  
I'll keep you update. 

-----------------------------------------------------

[PATCH] tests: fix procsubs tests on OSes using named pipes

On OSes using named pipes (like AIX), the pipe's file is suppressed
after the first read. Thus every commands trying to read it afterwards
will fail with ENOENT errno.
---
 tests/procsub.tests | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tests/procsub.tests b/tests/procsub.tests
index 01ba46a8..22c0b29f 100644
--- a/tests/procsub.tests
+++ b/tests/procsub.tests
@@ -69,10 +69,12 @@ count_lines()
 {
     wc -l < $1

-#    case "$1" in
-#    *sh-np*)  [ -e "$1" ] || { echo 0; echo 0; echo 0; echo 0; return; } ;;
-#    *) ;;
-#    esac
+    # For OSes using named pipes, $1 will be deleted after the first read and
+    # thus ENOENT error will be returned for every following commands.
+    case "$1" in
+    *sh-np*)    echo 0; echo 0; echo 0; echo 0; return;;
+    *) ;;
+    esac

     wc -l < $1
     wc -l < $1
@@ -88,6 +90,10 @@ echo extern
 FN=$TMPDIR/bashtest-$$
 cat >$FN << \EOF
 wc -l < $1
+case "$1" in
+*sh-np*)    echo 0; echo 0; echo 0; echo 0; return;;
+*) ;;
+esac
 wc -l < $1
 wc -l < $1
 true | wc -l < $1
-- 
2.17.1

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


Thread

Re: Procsub.tests on OSes using named pipes "CHIGOT, CLEMENT" <clement.chigot@atos.net> - 2020-02-20 14:32 +0000

csiph-web