linutil icon indicating copy to clipboard operation
linutil copied to clipboard

use dash instead of bash for inlined application-setup commands

Open cartercanedy opened this issue 1 year ago • 11 comments

Use dash instead of bash for inlined application-setup commands

Type of Change

  • [ ] New feature
  • [x] Bug fix
  • [ ] Documentation Update
  • [x] Refactoring
  • [ ] Hotfix
  • [ ] Security patch
  • [x] UI/UX improvement

Description

The setup scripts for both mybash & Chris's custom neovim setup use ANSI escapes to color text, but bash isn't posix compliant in the way that the echo command handles escapes. This change allows for proper presentation of the commands as they emit notifications without distracting escape sequences being emitted without being interpreted.

Testing

Very simple change, just verified that the commands run with the escape sequences being interpreted properly

Impact

Removes a lot of superfluous escape sequences and makes the command output more readable.

Checklist

  • [x] My code adheres to the coding and style guidelines of the project.
  • [x] I have performed a self-review of my own code.
  • [x] I have commented my code, particularly in hard-to-understand areas.
  • [x] I have made corresponding changes to the documentation.
  • [x] My changes generate no errors/warnings/merge conflicts.

cartercanedy avatar Sep 10 '24 17:09 cartercanedy

Instead of doing that I think we should just move those scripts over to this repository and make them posix compliant if they aren't.

ghost avatar Sep 10 '24 22:09 ghost

It's probably better that they stay where they are since they're definitely going to be changing. They're posix enough that they're designed to be run with dash anyway, hence the echo issues

cartercanedy avatar Sep 10 '24 23:09 cartercanedy

I just took a look at the setup scripts in those repositories and it seems there are quite a lot of bashisms, I'm going to make a PR in a bit that will remove those bashisms and move the scripts over to this repository.

ghost avatar Sep 11 '24 07:09 ghost

Considering that one of them is a bash config, it should be fine...

cartercanedy avatar Sep 11 '24 11:09 cartercanedy

Considering that one of them is a bash config, it should be fine...

Running the mybash-installer doesn't have to mean you're on bash; it could mean that you're using zsh or another shell, if that's the case then having bashisms inside of a script that installs the mybash-configuration will be bad and the script won't work properly. If a person is indeed using zsh or some other shell that adheres to posix standards and does not support bashisms they will not be able to use the script to install bash and CTT's mybash config because it contained bashisms. - Exaggerated but could be a real situation. Especially with the neovim config, In the PR I made I rewrote it in posix compliant standards so people using Linutil won't have to worry about being on bash to run the script without errors.

ghost avatar Sep 11 '24 12:09 ghost

The setup script for mybash* has no bashisms

cartercanedy avatar Sep 11 '24 12:09 cartercanedy

The setup script for mybash* has no bashisms

The original script in CTT's repo does have bashisms

image

ghost avatar Sep 11 '24 13:09 ghost

@cartercanedy Also, Chris did say he wanted to eventually move everything over to this repository; so I think it should be fine.

ghost avatar Sep 11 '24 13:09 ghost

The setup script for mybash* has no bashisms

The original script in CTT's repo does have bashisms

image

This warning is part of* the reason that I made the switch. Bash doesn't render escapes by default, which isn't posix compliant, but this is printed normally using dash or any other shell

cartercanedy avatar Sep 11 '24 13:09 cartercanedy

The setup script for mybash* has no bashisms

The original script in CTT's repo does have bashisms image

This warning is pay off the reason that I made the switch. Bash doesn't render escapes by default, which isn't posix compliant, but this is printed normally using dash or any other shell

I see. Could you give me opinions on #335 ?

ghost avatar Sep 11 '24 13:09 ghost

Sorry for the inconvenience. We had a massive restructure of the codebase to improve future development. Because of this can you update your PR to the new structure. Thank you for your assistance and contribution.

ChrisTitusTech avatar Sep 12 '24 18:09 ChrisTitusTech