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

Failure to set server config value, wrong format of sed pattern #371

Open
InsomniacSoftware opened this issue Nov 21, 2018 · 0 comments
Open

Comments

@InsomniacSoftware
Copy link

When trying to set a server config value, the sed replacement could fail causing the value to not be set.

For example, here I am trying to set a server specific config for the invocation of the java command with the -jar argument pointing to a test jar in my home directory.

$ msm mcnewb config msm-invocation "java -Xms{RAM}M -Xmx{RAM}M -XX:+AggressiveOpts -jar /home/ins/test-server.jar nogui"
sed: -e expression #1, char 91: unknown option to `s'

Here is the current sed line.

msm/init/msm

Line 3201 in 1b93ba8

sed -i /$2=/s/.*/"$2=$3"/g "${SERVER_CONF[$1]}"

The expansion of the $3 (value) variable is breaking the sed replacement pattern because it is using / as the pattern delimiter. The / at the start of the -jar path appears as an additional (unknown) option to the search s/ command.

Here is a simplified sed replacement that uses # instead of / as the pattern delimiter, which allows the "value" to contain slashes.

sed -i "s#$2=.*#$2=$3#g" "${SERVER_CONF[$1]}"

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

1 participant