Make whats-in-port and clear-port agree on what is in a port

オープン
#796 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
shell
領域
cli

調査の方向性

bin/clear-port と bin/whats-in-port から始め、それぞれの lsof コマンドと、listening 接続と established 接続について説明されている動作を比較します。両方のスクリプトが listening プロセスのみを報告すべきなのか、それとも意図的に異なるべきなのかを maintainer に確認します。完了とは、その判断が両方のスクリプトに実装または文書化され、出力が意図せず誤解を招くものではなくなっていることを意味します。

索引モデルが issue の本文から書いたものです。

説明

bin/clear-port and bin/whats-in-port are a pair. Since #789 they no longer
agree on what "in the port" means.

$ grep lsof bin/clear-port
  lsof -ti4TCP:"$1" -sTCP:LISTEN | xargs -r kill

$ grep lsof bin/whats-in-port
  lsof -ni4TCP:"$1"

clear-port now looks only at the listening process. whats-in-port still
lists every socket on that port, so it includes established connections. A
browser with the page open shows up there.

The result is that whats-in-port 3000 can list processes that clear-port 3000 will not touch. Someone reads the first, runs the second, and the thing
they saw is still running.

#789 was right to narrow clear-port. Killing a browser because it had the
page open was the bug. The question is whether whats-in-port should narrow
to match.

Two ways to settle it:

  • Add -sTCP:LISTEN to whats-in-port, so both answer the same question.
    Simple, and the pair stays honest.
  • Leave it wide on purpose, because seeing every holder of a port is useful
    when you are working out what is going on. If we choose this, say so in a
    comment in both scripts, so the difference reads as deliberate.

Either is defensible. Having it happen by accident is not.

主要言語
Shell
スター
8.2k
フォーク
1.7k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

thoughtbot/dotfiles のほかの issue

thoughtbot/dotfiles の issue をすべて見る

似ている issue

Shell/Bash の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。