ttt

getttyent

(FreeBSD) portaudit -Fdaしたら、sed: invalid option -- E というエラー

2008-09-30 22:38:04 | デジタル・インターネット

なんとかの一つ覚えで、「portaudit -Fda」というコマンドを実行したところ…

# portaudit -Fda
sed: invalid option -- E
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...

  -n, --quiet, --silent
                 suppress automatic printing of pattern space
  -e script, --expression=script
                 add the script to the commands to be executed
  -f script-file, --file=script-file
                 add the contents of script-file to the commands to be executed
      --help     display this help and exit
  -V, --version  output version information and exit
  -W ctype=character-set, --ctype=character-set
                 specify the character set
                 character-set is ASCII, EUC, SJIS, or UTF8

If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret.  All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.

E-mail bug reports to: bug-gnu-utils@gnu.org .
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.

わかりにくいですが、1行目に、「sed: invalid option -- E」という、エラーメッセージ(っぽく見えないですけど)が出ています。

これの原因は、

種類が違うsedが実行されている

ってこと。

「-E」オプションがあるsedは/usr/bin/sedであり、本当は、/usr/bin/sedを実行しなければいけなかった。

ところが

# which sed
/usr/local/bin/sed
# pkg_which /usr/local/bin/sed
ja-sed-3.02_2

ということで、/usr/local/bin/sedが実行されてしまっていたんです。/usr/local/bin/sedは、GNUなsedです。

/usr/bin/sedは、マニュアルを見ると(man -M /usr/share/man sed

HISTORY
A sed command, written by L. E. McMahon, appeared in Version 7 AT&T UNIX.

なんだか、歴史があるもののようで…

環境変数PATHでは、/usr/binを優先して、/usr/local/binは後回しにした方がいいんですかねぇ?

同じ名前のコマンドが、複数箇所に存在するってのも、トラブルの元ですが。

大学などのプログラミング実習の授業で、よくあるある話。

学生からの質問。
「すみません!testという名前のコマンドを作ったんですが、うまく動きません。なぜでしょうか?」


別件。

昨日、portupgradeで、firefoxを2.0.0.17にアップデートしたら、アドオンが全然動かなくなってしまいました。

詳しくはエラーコンソールを見ろ、って出てるんで見てみると

Error: [Exception... "Component returned failure code: 0x80520008 (NS_ERROR_FILE_ALREADY_EXISTS) [nsIFile.create]"  nsresult: "0x80520008 (NS_ERROR_FILE_ALREADY_EXISTS)"  location: "JS frame :: file:///usr/local/lib/firefox/components/nsExtensionManager.js :: anonymous :: line 1242"  data: no]
Source File: file:///usr/local/lib/firefox/components/nsExtensionManager.js
Line: 1242

意味わかりません!!

あれこれ試行錯誤してダメ。結局、profileを作り直しました。