GameServerManagers / GameServerManagers/LinuxGSM
Permissions edge-case during updates
- Dominant language
- Shell
- Stars
- 4.9k
- Forks
- 864
- PR merge metrics
- No merged PRs in 30d
Description
## User Story
If you don't have permissions over the `$rootdir` folder itself, but only the relevant contents of `$rootdir`, updates will fail because `sed` attempts to drop temporary files into this folder. In addition to this, when an update fails at this section, the backup previously made is not restored to `$rootdir` which causes the `gameserver.sh` to report an invalid gameserver:
`[ FAIL ] unknown game server`
## Basic info
* **Distro:** All
* **Game:** N/A
* **Command:** update
* **LinuxGSM version:** <= v20.5.0
## Further Information
The bug occurs because we don't utilize `$tmpdir` to `sed` our changes, additionally we do not restore the backup previously created [here](https://github.com/GameServerManagers/LinuxGSM/blob/v20.5.0/lgsm/functions/command_update_linuxgsm.sh#L80).
## To Reproduce
Steps to reproduce the behaviour:
1. Set permissions such that you have the required permissions for all LGSM files and folders but not the root directory itself.
2. Launch an update
3. `gameserver.sh` becomes invalid and update fails.
## Expected behaviour
At the very least the backup should be restored in this case, but it is trivial to remove the case entirely by utilizing the `$tmpdir` rather than the `$rootdir` for `sed` changes.
Contributor guide
Assessment
This issue has not been assessed yet.