|
From: | Max Nikulin |
Subject: | Re: [PATCH] Re: [BUG] ob-shell: :shebang changes interpretation of :cmdline |
Date: | Sat, 27 Apr 2024 17:31:07 +0700 |
User-agent: | Mozilla Thunderbird |
On 26/04/2024 18:49, Ihor Radchenko wrote:
+ shell-file-name...+ (list shell-command-switch + (concat (file-local-name script-file) " " cmdline))))
Max Nikulin writes:Using `shell-command-switch' unconditionally may lead to executing /bin/sh instead of shell specified by `shell-file-name' for script files having no shebang, see https://superuser.com/questions/502984/writing-shell-scripts-that-will-run-on-any-shell-using-multiple-shebang-linesI conclude that your concern, while being valid, is a _different_ bug. Thus, I do not see it as a blocker for my patch - my patch will fix the *original bug reported on top of this thread*.
My concern is that your patch trying to fix one bug (I am not convinced it is an improvement despite it is a step toward consistency) introduces another one that is not currently present in the code.
(with-temp-file script-file (if shebang (insert shebang "\n") (insert "#!" shell-file-name "\n")) (when padline (insert "\n")) (insert body))
This code has an issue. Interpretation of relative file names in shebangs varies across shells.
If you insist on parsing :cmdline by shell (I do not like it) then you may try
<shell-file-name> <shell-command-switch> '<shell-file-name> <script-file> <cmdline>'
[Prev in Thread] | Current Thread | [Next in Thread] |