Skip to content
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

gitlab service: fix preStart script #26000

Merged
merged 1 commit into from
May 22, 2017
Merged

Conversation

disassembler
Copy link
Member

Motivation for this change

I noticed this bash comparison problem when copy/pasting some code from this service into one I was writing. Here's a simple one line fix to make sure string comparison is done.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

@mention-bot
Copy link

@disassembler, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fpletz, @teh and @offlinehacker to be potential reviewers.

@fpletz
Copy link
Member

fpletz commented May 22, 2017

Thanks!

@fpletz fpletz merged commit 31a5e06 into NixOS:master May 22, 2017
@joachifm
Copy link
Contributor

Not that it's too important, but I'm curious how this fixes anything? [ "x" = "y" ] is perfectly valid (a single = is the string equality operator understood by test), whereas [ "x" == "y" ] seems to be a bashism (breaks on ash and zsh).

@bjornfor
Copy link
Contributor

Yes, please don't use unnecessary bashisms.

@fpletz
Copy link
Member

fpletz commented May 22, 2017

Oops, sorry, wasn't aware of that. Will revert after more feedback.

@disassembler What was the exact problem you were trying to solve? In what context did the the single = not work for you?

@joachifm
Copy link
Contributor

Afaik, the point of == is to perform pattern matching, but it's an extended syntax as far as traditional test is concerned. I suspect Bash is being helpful by supporting the extended syntax in its test builtin.

@fpletz
Copy link
Member

fpletz commented May 22, 2017

After some reading I found that the bash manpage states:

When the == and != operators are used, the string to the right of the operator is considered a pattern […]. The = operator is equivalent to ==.

And test indeed only supports = for string matching. So I'll revert for now. Thanks for the explanation.

@joachifm
Copy link
Contributor

The joys of shell programming :)

fpletz added a commit that referenced this pull request May 22, 2017

Verified

This commit was signed with the committer’s verified signature.
fpletz Franz Pletz
This reverts commit 31a5e06.

See #26000.
@disassembler
Copy link
Member Author

sorry for the confusion. Learned something new. I'll update my preStart script as well in the module I'm working on.

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

Successfully merging this pull request may close these issues.

None yet

5 participants