Closed Tiscan closed 4 years ago
Issue-Label Bot is automatically applying the label type: bug
to this issue, with a confidence of 0.95. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
I have the same issue with sdtdserver release A19 on Fedora. sdtdserver with the same version of LGSM but release A18.4 (installation was moved from CentOS few weeks ago) is on Fedora without this issue. I probably could test it on CentOS if necessary.
Here is postdetails pastebin https://termbin.com/iaug3
Hello, I think I found the issue. There are numbers in the comment on the same line as the port number, see here:
$ grep ServerPort /home/sdtdhost2/serverfiles/sdtdserver.xml
<property name="ServerPort" value="26900"/> <!-- Port you want the server to listen on. Keep it in the ranges 26900 to 26905 or 27015 to 27020 if you want PCs on the same LAN to find it as a LAN server. -->
$ grep ServerPort /home/sdtdhost2/serverfiles/sdtdserver.xml | tr -cd '[:digit:]'
2690026900269052701527020
Sorry, wrong line, sdtd is here https://github.com/GameServerManagers/LinuxGSM/blob/7e3df5d43479d3cc9f053688386d8ff8a92c8f80/lgsm/functions/info_config.sh#L1213
Can confirm this is the issue.
I moved the comment to a line on it's own in sdtdserver.xml and neither error occurs anymore.
The solution to this problem could be parsing xml files properly. There is an xmlstarlet package available in centos, fedora, debian and ubuntu (these I checked, it's probably elsewhere too), which can be used to extract xml values. For example in this case it looks like this:
$ grep ServerPort /home/sdtdhost2/serverfiles/sdtdserver.xml
<property name="ServerPort" value="26900"/>
$ xmlstarlet sel -t -v '//property[@name="ServerPort"]/@value' /home/sdtdhost2/serverfiles/sdtdserver.xml
26900
The selector there says: give me @value
attribute of property
with attribute @name == "ServerPort"
.
Also confirmed that xmlstarlet works on my install. However this would add a new dependency to LGSM.
Seems like a good path though as there will bound to be additional instances where digits are outside of the actual XML attribute.
sdtd@jinnix:~$ xmlstarlet sel -t -v '//property[@name="ServerPort"]/@value' sdtdserver.xml
26900
Alternative: put a egrep for the value in the original command:
port=$(grep "ServerPort" "${servercfgfullpath}" | egrep -o 'value="([0-9+])"' | tr -cd '[:digit:]')
The problem with a new dependency is here that only a few gameserver will need this.
@h3o66 this would be the best solution to avoid another dependency. If you are happy too could you do a PR and I will merge
@h3o66 this would be the best solution to avoid another dependency. If you are happy too could you do a PR and I will merge
done - see the connected pr
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
User Story
When running ./sdtdserver I get the error messages:
jq: error (at:0): Cannot iterate over null (null)
jq: error (at :0): Cannot iterate over null (null)
Before the command executes.
Also the ./sdtserver monitor command fails as the port gets listed as 2690026900269052701527020 even though the port is configured and running as 26900.
I searched the jq error here and found one reference from a but it just said that it was set to be fixed many versions back. Also found a reference to the port issue but there was no resolution on that one.
Basic info
Further Information
Completely fresh OS & LGSM install as of a couple of days ago.
To Reproduce
Run any ./sdtdserver, monitor command errors via ./sdtdserver monitor
Expected behaviour
Successful execution of command without errors, monitor option detecting correct port.
I am attaching the results of a details command below as you can see both the jq error and the port incorrect. Happy to provide other logs / etc if someone can point me to what they need.