Repository navigation
Preserve GUM environment records during factory-reset elevation - #13316
ryanrhughes merged 6 commits into
Conversation
Use the installed executable for non-root self-elevation, including calls from a development checkout or symlink. Reported-by: Aleksej <aleksejhairov@yandex.ru>
Reported-by: Sean Huber
Automated AI review
Verified at Verified: record boundaries. A stub
Values containing Verified: launch forms. For a copy identical to the installed command, absolute, relative, symlinked, Verified: test. Dev-link help still says
|
* Pin factory-reset elevation to the packaged command Use the installed executable for non-root self-elevation, including calls from a development checkout or symlink. Reported-by: Aleksej <aleksejhairov@yandex.ru> * Test factory-reset elevation paths and arguments * Refuse factory reset handoff to a different installed version * Test factory reset version mismatches and packaged invocation * Preserve GUM environment records during reset elevation Reported-by: Sean Huber * Test GUM record boundaries in reset elevation (cherry picked from commit 3e42525)
Factory reset now forwards the caller's
GUM_*styling throughsudoas whole NUL-delimited records, so a newline in any exported variable can't change whatenvruns as root.The old forwarding split
envoutput on newlines and kept every line starting withGUM_. That truncated a multilineGUM_*value, and a newline inside some other variable could handsudo enva strayGUM_line. A directory name inPWDis enough for that, and a line without=is a command word toenv, so it would run in place of the reset.Now the records come from
env -0 | grep -z '^GUM_[A-Za-z0-9_]*=', so only realGUM_*assignments are forwarded, each one exact, andenv --ends option parsing before them.Verified:
test/shell.d/factory-reset-elevation-test.shpasses, and fails with the old record parsing put back (with or without--)sudo, a newline inPWDreachedenvas a command on the old code and was dropped on the new codeGUM_*values and the no-GUM_*case forward exactly as beforeReported by Sean Huber.