Adding the -r argument to xargs makes it not run for no reason when there are no packages to trim spaces from. Otherwise it'd always run at least once and sometimes misbehave.