Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15887
| From | "CHIGOT, CLEMENT" <clement.chigot@atos.net> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Procsub.tests on OSes using named pipes |
| Date | 2020-02-13 10:00 +0000 |
| Message-ID | <mailman.782.1581601466.2412.bug-bash@gnu.org> (permalink) |
| References | <DB7PR02MB4075AEFED9BEDC6FDC0C2D2EEA1A0@DB7PR02MB4075.eurprd02.prod.outlook.com> |
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
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Procsub.tests on OSes using named pipes "CHIGOT, CLEMENT" <clement.chigot@atos.net> - 2020-02-13 10:00 +0000
csiph-web