Closed rutgoff closed 7 years ago
This doesn't immediately look like a linter-puppet-lint issue. Would you mind cross-posting this issue at sb-exec
's github project and seeing if it can be resolved from there?
I sure can, thanks!
Submitted as: https://github.com/steelbrain/exec/issues/72
@mschuchard This is neither an issue with sb-exec
, nor an issue with linter-puppet-lint
, this is an issue with the user configuration or the programs being executed externally. sb-exec
shows up in stack because that's where the error object is constructed from stderr
.
Thanks @rutgoff for opening the issue on that repo, appreciate you trying to find the root case of the bug. There's a lot of possibilities on what could be the real cause of the error, one of them is having CRLF line endings in bash files being executed. There have been similar issues for users of linter-flake8
as well as linter-puppet-lint
. Perhaps their solution works for you, I wish you luck
Thanks @steelbrain for jumping in to help. @rutgoff If this is indeed what steelbrain is hypothesizing, then this could be the famous Fedora BASH bug that has come up three times for me already. Are you using Fedora by any chance? If so, please consult the link steelbrain provided above.
@mschuchard SOrry for the delay in getting back to you. No I am not using Fedora, I am using macOS
OS version: macOS Sierra 10.12.2
I have also checked my ~/.profile and there are no CRLF line endings.
@rutgoff I'm on macOS as well, can you please provide some repro steps? They'll help me narrow it down
@steelbrain I sure can.
With those functions in your ~/.profile, do:
Here's a screencast of it happening: https://youtu.be/iHadltR0ET0
@rutgoff I think I found the error
So there's different types of .profile
files, there's the global ones that are executed regardless of the shell, then there are ones that are specific to the shell.
The cross-shell scripting language syntax of declaring a function is
function assumerole {
echo "hi $1"
}
but the syntax you are using is
function assumerole() {
...
}
It's not very portable and breaks shells that don't support it (it broke my zsh), therefore the solution would be to move that specific code from ~/.profile
to ~/.bash_profile
or ~/.zshrc
depending on you shell, let me know if it works
@steelbrain Will try that now
@steelbrain That didn't help, but not exporting them (commenting out the export lines) DID make the error go away. And to boot even with a new shell (so a new env) the functions (now in ~/.bash_profile) still work!
Something about exporting them is the root cause, but I am happy with not exporting them as they still work for my needs.
(TBH I can't remember why I exported them in the first place)
linter-puppet-lint version: 0.8.1 Atom Version: 1.12.8 OS version: macOS Sierra 10.12.2
When saving any puppet file and the linter is kicked off the following error is given:
The functions referenced
droprole
andassumerole
are custom ones from my ~/.profile. They are reproduced below and are used to change roles into other AWS accounts that I work with.They are exported and so show up in my environment, reproduced below.