Shell commands invoke /bin/sh directly

未關閉
#253 7 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
haskell

研究方向

先閱讀 System.Process.shell 的實作與文件,重點了解它如何選擇 /bin/sh 以及呼叫命令。使用 bash 和 dash 重現差異行為,接著檢視 issue 討論,以判斷期望的結果是可設定的 shell、可攜性警告,還是其他已記錄的行為。

由索引模型根據 Issue 內容生成。

描述

I am a maintainer of the obelisk framework. This week, I had to debug a very strange issue where some shell escaping was "working on my machine"™, but not my friend's. obelisk provides an integrated development environment that uses nix to ensure consistent behavior across platforms. In particular, we try to lock down which shell that is used when we invoke other executables.

However, we cannot ensure that our dependencies that use System.Process choose a shell in a way we can modify: In particular, ghcid uses System.Process.shell, and so on my machine, where /bin/sh is bash, and my friend's machine, where /bin/sh is dash, the behavior of shell escaping is different, and this causes ghcid to fail to invoke it's --command argument correctly.

My gut is that, just as one would reflexively invoke #!/usr/bin/env bash in a shell script that one wants to be portable, one would want System.Process to invoke /usr/bin/env sh -c <cmd> instead of /bin/sh -c <cmd> directly. Otherwise, the user cannot control the shell that is used at all without invasively modifying their entire system environment. A user may be surprised that the shell that they use to run their haskell program is not the same shell used to invoke shell commands from within the program, for example. I was surprised, at least!

This would be a rather significant change to the behavior of shell commands, so I'm not sure if that this change is desirable. At the least, a warning about portability would be appreciated.

主要語言
Haskell
星號
91
分支
93
PR 合併指標
30 天內沒有已合併 PR

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

haskell/process 的其他 Issue

查看 haskell/process 的全部 Issue

相似的 Issue

更多 Haskell Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。