unset APT_CONFIG env var when running hook

This commit is contained in:
Johannes 'josch' Schauer 2020-04-09 12:50:24 +02:00
parent d29bdafb89
commit 8d04ffee64
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -1141,13 +1141,14 @@ sub run_hooks {
# execute it directly if it's an executable file
# or if it there are no shell metacharacters
# (the /a regex modifier makes \w match only ASCII)
0 == system('env', '--unset=TMPDIR', $script, $options->{root})
0 == system('env', '--unset=TMPDIR', '--unset=APT_CONFIG',
$script, $options->{root})
or error "command failed: $script";
} else {
info "running --$name-hook in shell: sh -c '$script' exec"
. " $options->{root}";
# otherwise, wrap everything in sh -c
0 == system('env', '--unset=TMPDIR',
0 == system('env', '--unset=TMPDIR', '--unset=APT_CONFIG',
'sh', '-c', $script, 'exec', $options->{root})
or error "command failed: $script";
}