Possible "fix": 8e27b271181fd302239af64159275fd8433deea2. But I guess it has many flaws, too. And it's really not trivial to "properly" "fix" this: if you only take root into account, it'll still fail the same when becoming another user than root (lest common, but totally valid). If you try and play with `SUDO_UID`, it'll only work for sudo. If… etc.