Koji Arai
jca02****@nifty*****
2005年 10月 14日 (金) 00:06:13 JST
新井です。 In message "[Lha-users] Re: test scripts for more broader shells" on 11 Oct 2005 01:09:37 +0900, Koji Arai <jca02****@nifty*****> wrote: > old shell (と呼べば良いでしょうか? traditional shell?) もター > ゲットに据えると関数ローカルな変数など使えず、そんな環境でシェ > ルプログラミングしたくなかったし、これからもしたくないと考え > ています。 > > シェルの書式は今のままで > > 1. ksh, pdksh, bash, zsh の存在を確認する。 > 2. なければ、sh を試す。(それが POSIX shell でなければエラー > になるが気にしない) > > ぐらいでどうでしょうか?これでほとんどの環境は救えると思うのですが。 この方針を実装して、CVS にコミットしました。 そして、Autoconf のマニュアルに以下の記述があるのを思い出し ました。(というか、再発見しました) | The following discussion between Russ Allbery and Robert Lipe is |worth reading: | |Russ Allbery: | | The GNU assumption that `/bin/sh' is the one and only shell leads | to a permanent deadlock. Vendors don't want to break users' | existing shell scripts, and there are some corner cases in the | Bourne shell that are not completely compatible with a POSIX | shell. Thus, vendors who have taken this route will _never_ | (OK..."never say never") replace the Bourne shell (as `/bin/sh') | with a POSIX shell. | |Robert Lipe: | | This is exactly the problem. While most (at least most System | V's) do have a Bourne shell that accepts shell functions most | vendor `/bin/sh' programs are not the POSIX shell. | | So while most modern systems do have a shell _somewhere_ that | meets the POSIX standard, the challenge is to find it. 実際、Solaris あたりは /usr/xpg4/bin/sh が POSIX shell で、 同 autoconf のマニュアルにもオプションのパッケージと書いてあ ります。(これは以前、実際に私も経験しました。今は Solaris 触 れないので最新の状況を知らないのですが、たぶん変わらないだろ うしそれこそ上の引用の通り変えないでしょう) というわけで、パッチを受け入れる選択肢も捨てきれないとも言え ます。 ただ、そのような環境でも ksh が存在してて、LHa のテストくら いなら問題なく動くのではないかと想像してたりします。 もし、今回の改修でも問題がある環境があればお知らせください。 -- 新井康司 (Koji Arai)