Shell commands invoke /bin/sh directly

Đang mở
#253 7 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
haskell
Lĩnh vực
operating-systems

Hướng nghiên cứu

Bắt đầu bằng cách đọc phần triển khai và tài liệu của System.Process.shell, tập trung vào cách nó chọn /bin/sh và gọi các lệnh. Tái hiện hành vi khác biệt với bash và dash, sau đó xem lại phần thảo luận của issue để xác định liệu kết quả mong muốn là một shell có thể cấu hình, một cảnh báo về tính di động hay một hành vi khác đã được ghi lại hay không.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Haskell
Star
91
Fork
93
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của haskell/process

Tất cả issue của haskell/process

Issue tương tự

Thêm issue về Haskell

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.