ときどきの雑記帖 RE* (新南口)
ファウンデーションの彼方へ
夏休み
某イベントの関係で今年の夏休みはお盆を外した今週だったりする。
Tシャツ
監督のTシャツ、X68000ですかね?
— Jr200Okada (@Jr200Okada) August 1, 2021
昔ユーザーだったこともあるとか。https://t.co/jKPIG0vusu
X の字体といいその後の数字といい確かにX68000 ぽいなあ。 でもこんなTシャツあったっけ?
パリは燃えているか
というわけでAmazonで検索したところ (iTunesで検索してもよかったのだけど、なんか最近はMP3に変換できないものがあるのでとりあえず避けた)、 「パリは燃えているか」を収録しているものが 以前買ったものを含めていくつか見つかった。
「パリは燃えているか =集成= - 加古隆」 にはMP3版 もあったので、これにするかと思ったのだけど よく見るとCDとMP3とで収録曲数が違う?
なんじゃこれ。
狼の口
そう言えば「狼の口 ヴォルフスムント」の最終巻が出たあたりでもそういう話を目にしたなあと思うなど。 内容が気になる本だけど、ドイツ語ではさすがに手が出ないなあ。
「ハプスブルクへの抵抗」は虚構?スイス建国史の真実 - SWI swissinfo.ch
the perfect storm
以前書いた 「パーフェクトストーム」が取り上げられてるのを発見。
サラッと使いたい英語フレーズ “the perfect storm” ってどういう意味? | 一目置かれる「慣用句」 | クーリエ・ジャポン
今週のしずえさん
夏休みでJR東の電車に乗っていないのでしずえさんに会えない…
色
8/1放送の「サイエンスZERO」 「宇宙誕生から“1秒間”の謎に挑む ニュートリノ科学の大実験」 - サイエンスZERO - NHK を観ていたら、「青いニュートリノ」とか「黄色いニュートリノ」みたいな (正確には違う言い方だったと思うけど「色」に言及していたのは確か) 言い回しが出てきたので 「へー」と思いつつちょいと調べてみると
クォークは光の波長(10-5cm程度)よりずっと小さい(大きさが無い)ので私たちが感じる色彩を持っているわけではなくて、 単に電荷のようにそれを区別する量があるだけです。電荷のようにプラス幾つとかマイナス幾らという量ではなくて3種類の値しかとることが出来ないので、 それを「赤」「青」「緑」と光の3原色と同じ名前を付けたのです。
そしてクォークとグルーオンの相互作用を決めている法則を量子色力学といいます。
ふむふむ。
それゆえ、電子やニュートリノなどのレプトンや電磁相互作用のゲージ粒子である光子はカラーチャージを持っていない。
……あれ?
再放送でもう一度確認するか。 …と思ったら名前を出してはいけない某イベントのあおりで この回の再放送は予定にないのか!
bash
- bashのコンパイルについて - Qiita
- bashのexecute_command_internal()に関する疑問(メモ) - Qiita
- bashのinvert変数の使われ方(メモ) - Qiita
- bashのTMOUT周りについて - Qiita
このシリーズ(?)がなかなか興味深いんだけど、 bashのexecute_command_internal()に関する疑問(メモ) - Qiita この回の記述でちょっと気になった点があった (間違いの指摘ではない)。
ローカル変数sは親プロセスでは使われておらず、サブシェル内で終了方法を判定する以外に使われていない。
プロセスはフォークするとそのプロセスのコピーがつくられつので、スタックやヒープの情報は保存されている。 なので、sを親プロセスで定義しているのはなんのためなのかがわからない。 つまり、上記のコードを以下のようにしたほうが良いのではないかと思った。
bash/execute_cmd.c at ce23728687ce9e584333367075c9deef413553fa · bminor/bash
(表現に多少引っかかるところはあるけれども)ごもっとも。
ということで、この変数sがいつ頃からあるものなのかを調べてみた。 というのは、どこかで入った修正が影響してそうなってしまったのではないか と思ったから。
まずは、自分の知るところで一番古い1.05 Index of /Linux.old/bin/old/bash-1.05/ から。
execute_command_internal (command, asynchronous, pipe_in, pipe_out)
COMMAND *command;
int asynchronous;
int pipe_in, pipe_out;
{
int exec_result;
REDIRECT *my_undo_list = (REDIRECT *)NULL;
if (!command || breaking || continuing)
return (EXECUTION_SUCCESS);
/* If a command was being explicitly run in a subshell, or if it is
a shell control-structure, and it has a pipe, then we do the command
in a subshell. */
if (command->subshell ||
(shell_control_structure (command->type) &&
(pipe_out != NO_PIPE || pipe_in != NO_PIPE || asynchronous)))
{
int paren_pid;
/* Fork a subshell, turn off the subshell bit, turn off job
control and call execute_command () on the command again. */
paren_pid = make_child (savestring (make_command_string (command)),
asynchronous);
if (paren_pid == 0)
{
extern int interactive, login_shell;
command->subshell = 0;
/* Don't fork again, we are already in a subshell. */
asynchronous = 0;
/* Subshells are neither login nor interactive. */
login_shell = interactive = 0;
#ifdef JOB_CONTROL
/* Delete all traces that there were any jobs running. This is
only for subshells. */
without_job_control ();
#endif
do_piping (pipe_in, pipe_out);
if (command->redirects)
if (!(do_redirections (command->redirects, 1, 0) == 0))
exit (EXECUTION_FAILURE);
exit (execute_command_internal
(command, asynchronous, NO_PIPE, NO_PIPE));
}
else
{
close_pipes (pipe_in, pipe_out);
/* If we are part of a pipeline, and not the end of the pipeline,
then we should simply return and let the last command in the
pipe be waited for. If we are not in a pipeline, or are the
last command in the pipeline, then we wait for the subshell
and return its exit status as usual. */
if (pipe_out != NO_PIPE)
return (EXECUTION_SUCCESS);
stop_pipeline (asynchronous, (COMMAND *)NULL);
if (!asynchronous)
return (last_command_exit_value = wait_for (paren_pid));
else
{
extern int interactive;
if (interactive)
describe_pid (paren_pid);
return (EXECUTION_SUCCESS);
}
}
}
以下略
いやあ現在のと比べるとだいぶシンプルすな。 で、問題の変数 s はまだない。 ということは初めからあったものではなく現在に至るまでのどこかで入ったということ。
ここから細かく追いかけた経過を書いてもいいのだけど 今一つ面白みに欠けるので結論を書いちゃうと、 4.2.53までにはなくて4.3で現れる。
4.2.53→4.3の差分で問題の部分付近を見るとこう。
--- "bash-4.2.53\\execute_cmd.c" 2012-05-03 05:52:40.000000000 +0900
+++ "bash-4.3\\execute_cmd.c" 2014-02-01 00:54:52.000000000 +0900
@@ -528,18 +536,18 @@ execute_command_internal (command, async
{
int exec_result, user_subshell, invert, ignore_return, was_error_trap;
REDIRECT *my_undo_list, *exec_undo_list;
+ char *tcmd;
volatile int last_pid;
volatile int save_line_number;
+#if defined (PROCESS_SUBSTITUTION)
+ volatile int ofifo, nfifo, osize, saved_fifo;
+ volatile char *ofifo_list;
+#endif
-#if 0
- if (command == 0 || breaking || continuing || read_but_dont_execute)
- return (EXECUTION_SUCCESS);
-#else
if (breaking || continuing)
return (last_command_exit_value);
if (command == 0 || read_but_dont_execute)
return (EXECUTION_SUCCESS);
-#endif
QUIT;
run_pending_traps ();
@@ -578,21 +586,47 @@ execute_command_internal (command, async
(pipe_out != NO_PIPE || pipe_in != NO_PIPE || asynchronous)))
{
pid_t paren_pid;
+ int s;
/* Fork a subshell, turn off the subshell bit, turn off job
control and call execute_command () on the command again. */
line_number_for_err_trap = line_number;
- paren_pid = make_child (savestring (make_command_string (command)),
- asynchronous);
+ tcmd = make_command_string (command);
+ paren_pid = make_child (savestring (tcmd), asynchronous);
+
+ if (user_subshell && signal_is_trapped (ERROR_TRAP) &&
+ signal_in_progress (DEBUG_TRAP) == 0 && running_trap == 0)
+ {
+ FREE (the_printed_command_except_trap);
+ the_printed_command_except_trap = savestring (the_printed_command);
+ }
+
if (paren_pid == 0)
- exit (execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close));
- /* NOTREACHED */
+ {
+ /* We want to run the exit trap for forced {} subshells, and we
+ want to note this before execute_in_subshell modifies the
+ COMMAND struct. Need to keep in mind that execute_in_subshell
+ runs the exit trap for () subshells itself. */
+ /* This handles { command; } & */
+ s = user_subshell == 0 && command->type == cm_group && pipe_in == NO_PIPE && pipe_out == NO_PIPE && asynchronous;
+ /* run exit trap for : | { ...; } and { ...; } | : */
+ /* run exit trap for : | ( ...; ) and ( ...; ) | : */
+ s += user_subshell == 0 && command->type == cm_group && (pipe_in != NO_PIPE || pipe_out != NO_PIPE) && asynchronous == 0;
+
+ last_command_exit_value = execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close);
+ if (s)
+ subshell_exit (last_command_exit_value);
+ else
+ exit (last_command_exit_value);
+ /* NOTREACHED */
+ }
else
{
close_pipes (pipe_in, pipe_out);
#if defined (PROCESS_SUBSTITUTION) && defined (HAVE_DEV_FD)
- unlink_fifo_list ();
+ if (variable_context == 0) /* wait until shell function completes */
+ unlink_fifo_list ();
#endif
/* If we are part of a pipeline, and not the end of the pipeline,
then we should simply return and let the last command in the
s を使っているところに詳しいコメントが書かれているので、 コメントで説明されている状況のために導入されたものだったのだろう。
じゃあこの変更が入ったコミットを見れば…と思ったが、 他で行われた変更をまとめてマージしたコミットで入っているような? bash.git - bash
ということで初心に戻ってChangeLogを、と思ったらサイズが0バイトだよ>BashのChangeLog
なんじゃそりゃあと思いつつソースディレクトリを眺めていると CWRUというディレクトリの下に changelog(全部小文字)というファイルがあるのに気がついた。
フォーマットもGNU一般のそれとはだいぶ違うのだけど いつどのファイルをどのように変更したかという情報はあったので 問題の部分があるファイル(execute_cmd.c)に関するものを抜き出してみると… 結構あった。
2011
8/6
---
execute_cmd.c
- execute_command_internal: the parent branch of the subshell code
(where the child calls execute_in_subshell) should not close all
open FIFOs with unlink_fifo_list if it's part of a shell function
that's still executing. Fixes bug reported by Maarten Billemont
<lhunath@lyndir.com>
10/1
----
execute_cmd.c
- execute_command_internal: avoid fd exhaustion caused by using
process substitution in loops inside shell functions by using
copy_fifo_list and close_new_fifos (). Fixes debian bash bug
642504
12/15
-----
execute_cmd.c
- execute_intern_function: second argument is now FUNCTION_DEF *
instead of COMMAND *
- execute_command_internal: call execute_intern_function with the
new second argument (the entire FUNCTION_DEF instead of just the
command member)
- execute_intern_function: if DEBUGGER is defined, call
bind_function_def before calling bind_function, just like
make_function_def does (might be able to take out the call in
make_function_def depending on what the debugger does with it).
Fixes bug reported by <dethrophes@motd005>
2012
2/14
----
execute_cmd.c
- execute_command_internal: if redirections into or out of a loop fail,
don't try to free ofifo_list unless saved_fifo is non-zero. It's
only valid if saved_fifo is set
7/28
----
execute_cmd.c
- execute_command_internal: case cm_simple: decide whether or not to
wait_for a child if already_making_children is non-zero, indicates
that there is an unwaited-for child. More of fix for bug report
from Michael Haubenwallner <michael.haubenwallner@salomon.at>
7/29
----
execute_cmd.c
- execute_command_internal: make sure to call subshell_exit for
{} group commands executed asynchronously (&). Part of fix for
EXIT trap bug reported by Maarten Billemont <lhunath@lyndir.com>
8/22
----
execute_cmd.c
- execute_command_internal: set the_printed_command_except trap when
about to execute a ( ... ) user subshell. For now, set it only if
ERR is trapped; can relax that later. Fixes bug reported by
Mike Frysinger <vapier@gentoo.org>
11/24
-----
execute_cmd.c
- execute_command_internal: save make_command_string () result in a
temp variable before calling savestring() on it; avoids evaluating
make_command_string() result twice. Fix from John E. Malmberg
<wb8tyw@qsl.net>
2013
1/23
----
execute_cmd.c
- execute_command_internal: make sure any subshell forked to run a
group command or user subshell at the end of a pipeline runs any
EXIT trap it sets. Fixes debian bash bug 698411
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698411
4/15
----
execute_cmd.c
- execute_command_internal: make sure to run the EXIT trap for group
commands anywhere in pipelines, not just at the end. From a point
raised by Andreas Schwab <schwab@linux-m68k.org>
12/13
-----
execute_cmd.c
- execute_command_internal: make sure last_command_exit_value is set
to 0 after any command executed in the background. Fixes bug
reported by Martin Kealey <martin@kurahaupo.gen.nz>
2012年7月29日のかなあ。 メーリングリストのアーカイブでこのあたりの日付のものを探してみたけど、 それらしい報告とそれに対するリプライはあったものの バグに対するパッチはついていなかった (往年のruby-devとかじゃないんだから当然か)。
Hugo メモ
0.86.1と0.87.0がリリースされていた。
86.1はバグフィックス1件のみだったぽい。
This is a bug-fix release with one important fix.
config: Fix a potential deadlock in config reading 94b616bd @bep #8791
自分には影響なさげなので(本当か?)現状0.86のまま。
7月分
- 2021/07/03 かくしごと
- 2021/07/08 前略、道の上より
- 2021/07/12 オーソゴナルダイアゴナライザー
- 2021/07/15 渚にて
- 2021/07/17 星巡る方舟
- 2021/07/20 宇宙からのメッセージ
- 2021/07/23 東京ワッショイ
- 2021/07/25 続・東京ワッショイ
- 2021/07/31 パリは燃えているか