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


Groups > gnu.bash.bug > #15887 > unrolled thread

Procsub.tests on OSes using named pipes

Started by"CHIGOT, CLEMENT" <clement.chigot@atos.net>
First post2020-02-13 10:00 +0000
Last post2020-02-13 10:00 +0000
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Procsub.tests on OSes using named pipes "CHIGOT, CLEMENT" <clement.chigot@atos.net> - 2020-02-13 10:00 +0000

#15887 — Procsub.tests on OSes using named pipes

From"CHIGOT, CLEMENT" <clement.chigot@atos.net>
Date2020-02-13 10:00 +0000
SubjectProcsub.tests on OSes using named pipes
Message-ID<mailman.782.1581601466.2412.bug-bash@gnu.org>
Hi, 

procsub.tests is failing on OSes using named pipes (like AIX). 
As far as I understand, with named pipes, the temporary file (sh-np*) is suppressed once it has been read, therefore every attempts to read the same input will fail with ENOENT. It seems to be the case in "count_lines" function. However, the handler for named pipes has been commented and I haven't found why. Is there any reason behind that ? If no, here is a patch fixing procsub.tests.

----


[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..22f43b83 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*)    [ -e "$1" ] || { 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*)    [ -e "$1" ] || { echo 0; echo 0; echo 0; echo 0; return; } ;;
+*) ;;
+esac
 wc -l < $1
 wc -l < $1
 true | wc -l < $1
-- 
2.17.1





Clément Chigot

ATOS Bull SAS
1 rue de Provence - 38432 Échirolles - France

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web