2017-05-10

Rustのパッケージマネージャーでパッケージ名nulを作ったら全Windowsユーザーのパッケージマネージャーが壊れた話

How I Broke Rust's Package Manager for All Windows Users - sasheldon.com

非Windowsユーザーが何気なくRustでnulという名前のパッケージを作って公開した。すると、全Windowsユーザーのパッケージマネージャーが壊れた。

理由は、nulという名前はWindowsでは予約語だからだ。Win32サブシステム経由で、どのディレクトリであれ、nulというファイル名を使おうとすると、それはGNU/Linuxでいう/dev/nullと同じような扱いになる。nulに拡張子がついていても同じだ。

RustはWindowsサポートも重視しているので、これに対処してWindowsの予約語を禁止する変更がなされた。

Reserve windows crate names. by withoutboats · Pull Request #695 · rust-lang/crates.io

これはWindowsがクソだが、他のOSでもファイルシステムには様々な技術的な柵がある。例えばMac OSのファイルシステムはUnicode正規化が特殊でクソだし、POSIXの多くのコマンドは-をSTDINやSTDOUTとして特別扱いする。また、bashは/dev/tcp/host/portというファイル名でhost:portに対するTCP接続を行う。

No comments:

Post a Comment

You can use some HTML elements, such as <b>, <i>, <a>, also, some characters need to be entity referenced such as <, > and & Your comment may need to be confirmed by blog author. Your comment will be published under GFDL 1.3 or later license with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.