チケット #36966

Uninitialised var as simple arith expr causes silent exit

登録: 2017-02-05 20:40 最終更新: 2017-02-06 00:11

報告者:
担当者:
チケットの種類:
状況:
完了
コンポーネント:
マイルストーン:
(未割り当て)
優先度:
5 - 中
重要度:
5 - 中
解決法:
修正済み
ファイル:
なし
投票
点数: 0
No votes
0.0% (0/0)
0.0% (0/0)

詳細

Using an uninitialised variable in an arithmetic expression that contains only that variable causes yash to exit with exit status 2 and without any error message.

$ yash -c ': $((_Msh_test)) && echo ok || echo oops'
$ echo $?
2

Adding any operator makes it work as expected:

$ yash -c ': $((!_Msh_test)) && echo ok || echo oops'
ok
$ yash -c ': $((_Msh_test==0)) && echo ok || echo oops'
ok

チケットの履歴 (3 件中 3 件表示)

2017-02-05 20:40 更新者: mcdutchie
  • 新しいチケット "Uninitialised var as simple arith expr causes silent exit" が作成されました
2017-02-05 22:24 更新者: magicant
コメント

Thank you. I'm investigating.


Adding any operator makes it work as expected

except the assignment operator

$ yash -c 'echo $((foo=bar)) && echo ok || echo oops'
$ echo $?
2

With "foo" and "bar" unset, this should print "0" followed by "ok" as other shells do.

2017-02-06 00:11 更新者: magicant
  • 解決法なし から 修正済み に更新されました
  • 状況オープン から 完了 に更新されました
  • チケット完了時刻2017-02-06 00:11 に更新されました
コメント

Fixed in r3777

添付ファイルリスト

添付ファイルはありません

編集

ログインしていません。ログインしていない状態では、コメントに記載者の記録が残りません。 » ログインする