copied from pacman-4.1