[#30722] JSON ライブラリの取り込み — "NARUSE, Yui" <naruse@...>

naruseです。

20 messages 2007/04/21

[ruby-dev:30679] IO.popen doesn't fail for non-existent command

From: nobu@...
Date: 2007-04-03 10:26:15 UTC
List: ruby-dev #30679
なかだです。

http://bts.vinelinux.org/guest.cgi?project=VineLinux&action=view_report&id=481
「481: ri で command not found: pager」に関連した話ですが、
IO.popenに存在しないコマンドを指定したときにエラーにならないの
は、少なくとも1.9でバグだと思います。

* io.c (popen_exec): should not close close-on-exec fds.


Index: io.c
===================================================================
--- io.c	(revision 12141)
+++ io.c	(working copy)
@@ -3041,4 +3041,7 @@ popen_exec(void *pp)
     popen_redirect(p);
     for (fd = 3; fd < NOFILE; fd++) {
+#ifdef FD_CLOEXEC
+	if (fcntl(fd, F_GETFD) & FD_CLOEXEC) continue;
+#endif
 	close(fd);
     }


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread

Prev Next