Skip to content

Dotfiles fails: /bin/sh: 2: Bad substitution #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jaulz opened this issue Dec 16, 2023 · 6 comments
Open

Dotfiles fails: /bin/sh: 2: Bad substitution #75

jaulz opened this issue Dec 16, 2023 · 6 comments

Comments

@jaulz
Copy link

jaulz commented Dec 16, 2023

The dotfiles modules fails on my side:
image

I added the module like this:

module "dotfiles" {
  source = "https://registry.coder.com/modules/dotfiles"
  agent_id = coder_agent.workspace.id
}

and specified this repository. Is there anything else I need to set up?

@matifali
Copy link
Member

Hi @jaulz, this module uses coder dotfiles to setup/install the dotfiles, which requires the presence of a script. It looks like there is no script in your dotfiles repo.
Please see this for more details: https://coder.com/docs/v2/latest/dotfiles#setup-script-support

@jaulz
Copy link
Author

jaulz commented Dec 17, 2023

@matifali thanks for the feedback! In fact, I checked the documentation but it sounded to me that the script is optional is and if it doesn't exist the configuration files are copied only.

@matifali
Copy link
Member

@jaulz can you manually run coder dotfiles <your-dotfiles-repo> from within your workspace and see if it works? This will help us identify if the issue is with the module or the coder dotfiles command.

@jaulz
Copy link
Author

jaulz commented Dec 17, 2023

@matifali it's also not really working:
image

Maybe because there is already other stuff in the folder (e.g. code-server from other module)?
image

@matifali matifali transferred this issue from coder/modules Dec 17, 2023
@matifali
Copy link
Member

The issue is with coder dotfiles and not the module, so I moved it here to this repo.

@mafredri
Copy link
Member

mafredri commented Dec 19, 2023

@matifali to me this looks problematic: https://github.com/coder/modules/blob/f8faea1855fb5fbb4db99d34421b5d6999b17ca3/dotfiles/main.tf#L31

We should make sure this check is /bin/sh compatible, if we need it at all. That seems to be the source of the bad substitution error.

Perhaps that check is better done in terraform? Or perhaps the trim spaces and then just check for emptyness in the script. Or not create the script if empty.

@stirby stirby transferred this issue from coder/coder Apr 4, 2024
@Parkreiner Parkreiner transferred this issue from coder/modules May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants