FS#71381 - [code] Do not depend on bash
Attached to Project:
Community Packages
Opened by Mynacol (mynacol) - Monday, 28 June 2021, 11:37 GMT
Last edited by Massimiliano Torromeo (mtorromeo) - Friday, 28 April 2023, 08:10 GMT
Opened by Mynacol (mynacol) - Monday, 28 June 2021, 11:37 GMT
Last edited by Massimiliano Torromeo (mtorromeo) - Friday, 28 April 2023, 08:10 GMT
|
Details
The /usr/bin/code file currently uses bash.
1. Execution fails for computers without bash. 2. bash is not needed here. Any proper sh should be usable. Might speed up execution. |
This task depends upon
Closed by Massimiliano Torromeo (mtorromeo)
Friday, 28 April 2023, 08:10 GMT
Reason for closing: Won't implement
Friday, 28 April 2023, 08:10 GMT
Reason for closing: Won't implement
To properly implement 2), it would require me to change the shebang to #!/usr/bin/env sh, which would probably actually slow down execution as it introduces a new process spawn, and the script itself is 1 line, I doubt even a very efficient sh implementation will make up for that. Changing the shebang to !#/usr/bin/sh would not do anything as it always points to bash in a proper Arch Linux system.
Anyway, I will change the shebang to #!/usr/bin/sh just as a matter of courtesy.
With that said, I want to highlight this is a micro-optimization and IMO not really worth wasting the maintainer's time, especially when so many of us already are short on it. I understand your motivation, and welcome that, but I think there are more efficient ways to contribute. There are many optimizations far more worth of you spending your time following, there are lots of bugs opened in this bug tracker that would benefit from more information gathering and people looking into solutions, etc.
Please understand my intent here is not to tell you off, but rather to make you understand that when you decide to open a bug, people will have to spend time triaging and looking at it, and so, please consider the actual value added by your proposal :P
[1] https://archlinux.org/packages/core/any/base/
Cheers,
Filipe
[1] https://wiki.archlinux.org/title/Dash
[2] https://unix.stackexchange.com/a/148061
That being said, the initial report was incorrect to state point 1, regardless of the validity of point 2.
The `code` shell script uses arrays and probably other features not supported by dash and I don't see the value in completely rewriting it to support dash, so I am going to close this issue.