Historical bug tracker for the Pacman package manager.
The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues
This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues
This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
FS#18534 - pacman isn't quiet when it's supposed to be
Attached to Project:
Pacman
Opened by Adam Dariusz Szkoda (adaszko) - Tuesday, 02 March 2010, 19:59 GMT
Last edited by Ionut Biru (wonder) - Tuesday, 02 March 2010, 20:39 GMT
Opened by Adam Dariusz Szkoda (adaszko) - Tuesday, 02 March 2010, 19:59 GMT
Last edited by Ionut Biru (wonder) - Tuesday, 02 March 2010, 20:39 GMT
|
DetailsSummary and Info:
The standard --quiet option semantics (established by many CLI tools) is: don't say anything until something bad happens. In some programs that behaviour is achieved by passing --quiet several times. Neither of these works in pacman. When pacman is used in scripts, usually all that is interesting, is the exit code and side-effects. Some will say to use >/dev/null, but what if I want to parse, for example, which packages were upgraded. If detection of passing option several times is complicated, maybe there should another option, e.g. --batch whose output would be especially convenient for parsing/piping. Uniformity across tools behaviour is very important IMO. It eliminates unpleasant surprises and unnecessary lookups to manual. Steps to Reproduce: Even with -q (--quiet) option, there's a multitude of cruft on terminal: $ LANG= sudo pacman -Syq :: Synchronizing package databases... core is up to date extra is up to date community is up to date archlinuxfr is up to date archrepo is up to date archstuff is up to date arch-games is up to date awesome is up to date blind is up to date danym is up to date dragonlord is up to date rfad is up to date |
This task depends upon
so do for example pacman -Ss thunderbird and then pacman -Ssq thunderbird or pacman -Ql something pacman -Qlq something
The problem is that there's no way to force pacman to output messages on errors only, like other tools do.
pacman -Syq > /dev/null
Here's a snippet from a /etc/cron.daily job in Perl:
sub upgrade_system {
system "pacman --sync --refresh --noprogressbar --quiet";
my @upgrades = `pacman --query --upgrades --quiet`;
# HERE: pacman should behave in such a way that line below would be unnecessary.
# If you don't know Perl, this removes first and last line from pacman's output.
shift @upgrades; pop @upgrades;
# Do nothing when there are no updates available.
@upgrades or return;
# Download updates.
system "pacman --sync --quiet --sysupgrade --noconfirm --downloadonly";
# Do the update.
my $upgrades = `pacman --sync --noconfirm --sysupgrade`;
send_mail (MAILTO, "System update summary", $upgrades);
}
And what do you get for `pacman --query --upgrades --quiet >/dev/null`? A nonsense is what you get.
So, if -q is meant for scripts (as pacman's man page mentions), why the shift;pop line is needed? It shouldn't be.
To me, the shift;pop line is a ugly hack. It undermines the confidence that some other useless message won't be added in the future.
Similar thing happens with -Sq:
$ sudo pacman -Sq gedit
resolving dependencies... <- USELESS IN SCRIPTS!
looking for inter-conflicts... <- DITTO
[...]
Also, -q should imply --noconfirm and --noprogressbar if it is to be used in scripts.
I recall that Debian's apt-get and dpkg are more polished in this respect.
enchant
jasper
smbclient
thunderbird
You seem to be doing it wrong... there is not top or bottom line to delete.
The -Sq <pkg> option is not documented to reduce output. The man page says it will have an effect of -Ss -Sl -Sg but nothing else. "pacman -Sq <pkg>" hard to justify for use in a script as 1) its output is not script friendly at all and 2) it is quite dangerous to script.
Forgive me, my fault. I wrote that script a while ago and everything seamed to be working, which pushed me to wrong conclusions.
> The -Sq <pkg> option is not documented to reduce output. The man page says it will have an effect of -Ss -Sl -Sg but nothing else.
That's why this a feature request.
> "pacman -Sq <pkg>" hard to justify for use in a script as
> 1) its output is not script friendly at all and
Then it shouldn't output anything (with -q.)
> 2) it is quite dangerous to script.
Please leave that to the user. This is Unix, not Windows.