Repository navigation
Commit dc5be57
nix: only install the Unity stdio hooks in a Unity player
LD_PRELOAD is inherited by every child process, so Doorstop is also
loaded into the launcher scripts that start the game. When no UnityPlayer
module is present, doorstop_ctor() falls back to hooking the main
executable's PLT and installs fclose_hook and dup2_hook there.
Both hooks deliberately suppress redirection of stdout/stderr, which is
what a shell uses to implement command substitution and file
redirection, so any /bin/sh in the launch chain silently breaks:
$ LD_PRELOAD=libdoorstop.so DOORSTOP_ENABLED=1 \
DOORSTOP_TARGET_ASSEMBLY=... \
sh -c 'x="$(echo hello)"; echo "got=[$x]"'
hello
got=[]
This breaks BepInEx on every Steam Linux Runtime game: the runtime's
_v2-entry-point parses its arguments with `getopt_temp="$(getopt ...)"`,
gets an empty string back and exits with "Error: A command to run is
required", so the game never starts.
Only install the stdio hooks when the PLT we opened actually belongs to
a Unity player -- either because we hooked UnityPlayer directly, or
because the main executable ships a Unity data folder next to it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 8e66ca0 commit dc5be57
1 file changed
Lines changed: 61 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
95 | 139 | | |
96 | 140 | | |
97 | 141 | | |
| |||
105 | 149 | | |
106 | 150 | | |
107 | 151 | | |
| 152 | + | |
| 153 | + | |
108 | 154 | | |
109 | 155 | | |
110 | 156 | | |
| |||
114 | 160 | | |
115 | 161 | | |
116 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
117 | 169 | | |
118 | 170 | | |
119 | 171 | | |
| |||
145 | 197 | | |
146 | 198 | | |
147 | 199 | | |
148 | | - | |
149 | | - | |
150 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
151 | 204 | | |
152 | | - | |
153 | | - | |
154 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
155 | 208 | | |
156 | 209 | | |
157 | 210 | | |
| |||
0 commit comments