[Discussion] Behavior of `SUDO_ASKPASS`
- 主要語言
- Go
- 星號
- 13k
- 分支
- 541
- 平均合併
- 20 小時 47 分鐘
- 30 天內合併 PR
- 4
描述
Is your feature request related to a problem? Please describe.
I created a libvirt container based on [doc](https://distrobox.it/posts/run_libvirt_in_distrobox/). I noticed the desktop entry had `SUDO_ASKPASS` pointing to a generated script.
`Exec=env SUDO_ASKPASS="/var/home/user/.local/bin/distrobox_sudo_askpass" DBX_SUDO_PROGRAM="sudo --askpass" /var/home/user/.local/bin/distrobox-enter --root -n libvirt
-- /usr/bin/virt-manager`
I noticed one of the [useful tips](https://distrobox.it/useful_tips/#using-a-command-other-than-sudo-to-run-a-rootful-container) mentioned that we can override the behavior by setting SUDO_ASKPASS environment variable. But it was not clear if the behavior is for `distrobox-enter` or `distrobox-create` command.
It turns out the `distrobox-assemble` and consequently `distrobox-export` command does not respect the `SUDO_ASKPASS` environment variable. So even if we set the `SUDO_ASKPASS` environment variable before running `distrobox-create` command the desktop entry still points to the generated script.
https://github.com/89luca89/distrobox/blob/3b9f0e8d3d8bd102e1636a22afffafe00777d30b/distrobox-export#L284-L287
Describe the solution you'd like
It would be nice for `distrobox-export` to respect the `SUDO_ASKPASS` environment variable.
Describe alternatives you've considered
The workaround is to manually edit the `SUDO_ASKPASS` in the desktop entry created.
貢獻指南
研究方向
該 issue 指向 distrobox-export 中的第 284-287 行,其中沒有遵循 SUDO_ASKPASS。首先閱讀 distrobox-export,了解桌面項目是如何生成的。檢查是否處理了 DBX_SUDO_PROGRAM 等其他環境變數。在 distrobox-create 或 distrobox-assemble 中尋找類似邏輯。透過設定 SUDO_ASKPASS 並執行 distrobox-export,查看產生的桌面項目來進行測試。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- bash, shell
- 領域
- cli, developer-experience
- Issue 類型
- 功能
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100