diff --git a/tools/linuxfs/overlay/usr/local/bin/steam-compatibility b/tools/linuxfs/overlay/usr/local/bin/steam-compatibility index b2d74d4230..924c575cae 100755 --- a/tools/linuxfs/overlay/usr/local/bin/steam-compatibility +++ b/tools/linuxfs/overlay/usr/local/bin/steam-compatibility @@ -227,8 +227,8 @@ dd_components() { DD_GAME_CPUS_SETUP = """ dd_game_cpus() { - local live=/root/.config/droiddeck/game-cores cpus - if [ -f "$live" ] && IFS= read -r cpus <"$live" 2>/dev/null; then + local live=/root/.config/droiddeck/game-cores cpus rest= + if [ -f "$live" ] && { IFS= read -r cpus && ! IFS= read -r rest; } <"$live" 2>/dev/null && [ -z "$rest" ]; then [[ -z $cpus || $cpus =~ ^[0-9]+(-[0-9]+)?(,[0-9]+(-[0-9]+)?)*$ ]] || cpus=${DD_GAME_CPUS:-} if [ -z "$cpus" ] && [ -n "${DD_CLIENT_CPUS:-}" ]; then cpus=$(nproc --all 2>/dev/null) && cpus=0-$((cpus - 1)) || cpus= diff --git a/tools/tests/test_game_cpus_live.py b/tools/tests/test_game_cpus_live.py index 8869d523f8..f16a551588 100644 --- a/tools/tests/test_game_cpus_live.py +++ b/tools/tests/test_game_cpus_live.py @@ -54,7 +54,7 @@ class LiveGameCpusTest(unittest.TestCase): self.assertEqual(self.run_setup(partial, DD_GAME_CPUS="4,5"), ["taskset=taskset -c 4,5", "cpus=4,5"], partial) def test_an_unreadable_value_keeps_the_session_value(self): - for bad in ("3;rm\n", "6-\n", "-3\n", "3,,4\n", "3,\n"): + for bad in ("3;rm\n", "6-\n", "-3\n", "3,,4\n", "3,\n", "3\n4\n", "3\n4", "\n3\n"): self.assertEqual(self.run_setup(bad, DD_GAME_CPUS="4,5"), ["taskset=taskset -c 4,5", "cpus=4,5"], bad) def test_the_file_is_found_whatever_home_the_client_runs_with(self):