[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FDclone-users:00137] Re: "No such file or directory" flood



 しらいです。

 相変わらずエラー処理が甘くてすみません。

In Message-Id <8665pwz0h5.wl%knu@iDaemons.org>
        "Akinori MUSHA" <knu@iDaemons.org>さんwrites:
>  FD 2.03 で、  fd 起動時のカレントディレクトリを消し、 q で終了
> すると「No such file or directory」エラーが延々と出てきて、
> suspend して殺すしかなくなります。h から exit を実行して終了した
> ときは発生しません。(つまり fdsh では発生しない)

 こんな感じの修正でどうでしょう?

---- Cut Here ----
diff -u ../old/FD-2.03/main.c ./main.c
--- ../old/FD-2.03/main.c	Wed Mar 26 00:00:00 2003
+++ ./main.c	Thu Apr  3 19:28:43 2003
@@ -808,10 +808,7 @@
 		}
 	}
 
-#ifdef	_NOORIGSHELL
-	inittty(0);
-	getterment();
-#else
+#ifndef	_NOORIGSHELL
 	if (initshell(optc, optv, envp) < 0) Xexit2(RET_FAIL);
 #endif	/* !_NOORIGSHELL */
 	free(optv);
@@ -884,7 +881,10 @@
 
 static VOID NEAR prepareexitfd(VOID_A)
 {
-	if (_chdir2(origpath) < 0) error(origpath);
+	if (origpath && _chdir2(origpath) < 0) {
+		perror2(origpath);
+		rawchdir(_SS_);
+	}
 	free(origpath);
 #ifndef	_NODOSDRIVE
 	dosallclose();
@@ -1054,6 +1054,8 @@
 	environ[i] = NULL;
 #endif
 
+	inittty(0);
+	getterment();
 	setexecpath(argv[0], envp);
 #ifndef	_NODOSDRIVE
 # ifdef	DATADIR
diff -u ../old/FD-2.03/system.c ./system.c
--- ../old/FD-2.03/system.c	Wed Mar 26 00:00:00 2003
+++ ./system.c	Thu Apr  3 19:31:47 2003
@@ -10171,12 +10171,7 @@
 		name++;
 	}
 
-#ifdef	FD
-	opentty();
-	ttyio = newdup(ttyio);
-	inittty(0);
-	getterment();
-#else
+#ifndef	FD
 	if ((ttyio = open(TTYNAME, O_RDWR, 0600)) < 0
 	&& (ttyio = newdup(Xdup(STDERR_FILENO))) < 0) {
 		doperror(NULL, NULL);
---- Cut Here ----


> [以下止まらない]
> ^Z
> zsh: suspended	fd
> zsh$ kill -9 %1
> [1]  - killed	fd

 FDclone の実行中 ^Z の効くタイミングは殆んどないのですが、
終了処理の最中なので cooked mode になっているんですね。
 上記 patch の中で「error(origpath);」となっている部分が実
は recursive に実行されていて無限 loop と化していました。こ
の症状の対処はその 4 行だけです。


>  ついでに、こうして終了後、カレントディレクトリが消えた状態で
> fd を起動すると segfault します。

 これも絶妙のタイミングで、initialize が完了しないうちに端
末操作を行なおうとして落ちてますね。上の patch では飽くまで
も暫定的な対処しかしていないので、実際は弊害が生じます。
 一番影響が大きいのは file descriptor #3 が端末制御用に食わ
れてしまうので、shell script で 3>&1 とか書けないことですね。
正式 release ではこれもちゃんと直します。

                                               しらい たかし