[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bash closes fd twice.
From: |
Yoriyuki Yamagata |
Subject: |
bash closes fd twice. |
Date: |
Fri, 11 Dec 2015 17:40:27 +0900 |
Dear list,
I found that bash tries to close the same fd twice, consecutively. I’m using
Mac OS X Yosemite, and bash is the newest available (bash-master from
http://tiswww.case.edu/php/chet/bash/bashtop.html yesterday).
To reproduce the phenomenon, just run this shell script.
— begin ---
#!/Users/XXXX/bin/bash
set -- `cat "testfile" | sed '/^\#/d’`
— end ---
Name it testscript
testfile is the empty file.
Then, run druss
$ sudo dtruss -fa sudo -u XXXX ./testscript
The part of output:
96765/0x20858e: 173615 173171 173168 fork() = 96766 0
96766/0x208590: 74: 0: 0 fork() = 0 0
96766/0x208590: 75 5 0 thread_selfid(0x0, 0x0, 0x0)
= 2131344 0
96766/0x208590: 77 3 0 bsdthread_register(0x7FFF95D0E3E0,
0x7FFF95D0E3D0, 0x2000) = -1 Err#22
96765/0x20858e: 173714 4 0 sigprocmask(0x3, 0x7FFF59BFD7A0, 0x0)
= 0x0 0
96765/0x20858e: 173717 3 1 close(0x4) = 0 0
96765/0x20858e: 173739 1 0 close(0x4) = -1 Err#9
I do not know it is an important problem, but closing the same file descriptor
twice could be fishy.
Or maybe I missed something?
Best,
—
Yoriyuki Yamagata
National Institute of Advanced Science and Technology (AIST), Senior Researcher
http://staff.aist.go.jp/yoriyuki.yamagata/en/
- bash closes fd twice.,
Yoriyuki Yamagata <=