Skip to content

Fix the .bak workflow being broken for /etc/sudoers

Problem

When /etc/sudoers is the file being pacdiffed here and the -b (.bak) and -s (sudo) flags are enabled, this call temporarily means the system does not have a sudoers file, meaning the next mv call breaks.

==> pacnew file found for /etc/sudoers
:: (V)iew, (M)erge, (S)kip, (R)emove pacnew, (O)verwrite with pacnew, (Q)uit: [v/m/s/r/o/q] v
2 files to edit
sudoedit: /etc/sudoers unchanged
:: (V)iew, (M)erge, (S)kip, (R)emove pacnew, (O)verwrite with pacnew, (Q)uit: [v/m/s/r/o/q] o
renamed '/etc/sudoers' -> '/etc/sudoers.bak'
sudo: unable to open /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit

Fix

To fix this, make the backup call a copy instead of a move. This will result in the same preservation behavior, while letting the next mv call overwrite the original file with the pacfile as normal.

Edited by Matthew Armand

Merge request reports

Loading