You are not logged in.

#1 2011-02-20 01:27:24

vgivanovic
Member
Registered: 2011-02-18
Posts: 40

Why does 'pacman' produce purely informational output?

My apologies if this dead horse has already been beaten. A brief search didn't turn up any forum topics that addressed this issue.

Many Unix programs adhere to the dictum that successful execution should produce no output unless something interesting or surprising happened. The canonical example is running 'ls' on an empty directory.

'pacman' doesn't follow this design philosophy even if the '--quiet' switch is given.

 # pacman -Syq
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date

As I understand it, the rationale is the desire to be able to use programs in a pipe. If the output contains purely informational text, then every program that uses that program's output has first to throw away the informational text.

Of course it's easy enough to quieten 'pacman'

pacman -Sy | sed '/^:: /d'

or even

pacman -Sy | sed '/^:: \|is up to date$/d'

So, I have a two part question: Why does 'pacman' produce purely informational text and why doesn't the '--quiet' switch really quieten 'pacman'?

Thanks for any insight.

Offline

#2 2011-02-20 01:50:16

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,672
Website

Re: Why does 'pacman' produce purely informational output?

Read what the quiet flag does...

> pacman -S --help
  -q, --quiet          show less information for query and search

Offline

#3 2011-02-20 02:39:06

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Why does 'pacman' produce purely informational output?

Offline

#4 2011-02-22 04:45:06

vgivanovic
Member
Registered: 2011-02-18
Posts: 40

Re: Why does 'pacman' produce purely informational output?

Allan wrote:

Read what the quiet flag does...

> pacman -S --help
  -q, --quiet          show less information for query and search

Did you read my post?

Offline

#5 2011-02-22 04:50:31

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,672
Website

Re: Why does 'pacman' produce purely informational output?

Yes...  and my answer was that is does what it is clearly documented to do.

Offline

#6 2011-02-22 17:33:04

vgivanovic
Member
Registered: 2011-02-18
Posts: 40

Re: Why does 'pacman' produce purely informational output?

You answered a question I didn't ask. I want to know why pacman was designed the way it is, not how to use it. Sometimes the answer to why is not known, but it is never "Here's how to use it."

Offline

#7 2011-02-22 17:34:03

vgivanovic
Member
Registered: 2011-02-18
Posts: 40

Re: Why does 'pacman' produce purely informational output?

Thanks for the info.

Offline

#8 2011-02-22 17:39:54

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Why does 'pacman' produce purely informational output?

I used firefox as an example of the differences between using query and search with and without the '-quiet' switch:

[karol@black ~]$ pacman -Q firefox
firefox 3.6.13-1
[karol@black ~]$ pacman -Qq firefox
firefox
[karol@black ~]$ pacman -Ss firefox
extra/firefox 3.6.13-1 [0,74 MB] [installed]
    Standalone web browser from mozilla.org
extra/firefox-i18n 3.6.13-1 [4,47 MB]
    Language packs for Firefox
extra/totem-plugin 2.32.0-3 [0,14 MB]
    Totem mozilla/firefox plugin
community/arch-firefox-search 0.7-6 [0,00 MB] [installed]
    Firefox Arch search engines (AUR, Pkgs, BBS, Wiki, etc.)
community/firefox-adblock-plus 1.3.3-1 [0,30 MB]
    plugin for firefox which block ads and banners
community/firefox-noscript 2.0.9.8-1 [0,37 MB]
    plugin for firefox which disables script
community/firefox-spell-ru 0.4.3-3 [0,50 MB]
    Russian spellchecker dictionary for Firefox
unarch/firebrand 3.6-2 [0,00 MB]
    A script to brand Firefox without recompiling.
unarch/swiftfox-athlon64 3.6.8-1 [9,42 MB]
    Swiftfox is a prebuilt version of Firefox3, optimized for Athlon64 processors.
unarch/swiftfox-i686 3.6.8-1 [9,43 MB]
    Swiftfox is a prebuilt version of Firefox3, optimized for i686 architectures.
unarch/swiftfox-prescott 3.6.8-1 [9,10 MB]
    Swiftfox is a prebuilt version of Firefox3, optimized for Core Solo/Duo processors.
archlinuxfr/swiftfox-i686-fr 3.6.13-1 [9,51 MB]
    Mozilla Firefox optimized build for OLD AMD and INTEL processors on x86 architecture (French version)
archlinuxfr/swiftweasel-amd-pgo 3.5.6-2 [9,59 MB]
    Mozilla Firefox optimized build for AMD processors on x86 architecturei (with xulrunner 1.9.1.7).
archlinuxfr/swiftweasel-amd-pgo-fr 3.5.6-2 [9,60 MB]
    Mozilla Firefox optimized build for AMD processors on x86 architecture (French version) (with xulrunner 1.9.1.7).
archlinuxfr/swiftweasel-intel-pgo-fr 3.5.6-1 [3,92 MB]
    Mozilla Firefox optimized build for INTEL processors on x86 architecture (French version).
archlinuxfr/wto 1.0.3-3 [0,01 MB]
    web tv orange sans firefox et enregistreur en python
cake/firefox 3.6-1 [0,95 MB] [installed: 3.6.13-1]
    Mozilla.org Web Browser
cinan/firefox-pgo 3.6.8-2 [9,11 MB]
    Mozilla Firefox customizable web browser (XULRunner independent, PGO optimized, 64-bit TraceMonkey)
cinan/mozplugger 1.14.1-1 [0,04 MB]
    A Mozilla & Firefox multimedia plugin.
rfad/firefox-pgo 3.0.10-1 [8,09 MB]
    Mozilla Firefox. XULRunner independent. And optimized for faster use :)
[karol@black ~]$ pacman -Ssq firefox
firefox
firefox-i18n
totem-plugin
arch-firefox-search
firefox-adblock-plus
firefox-noscript
firefox-spell-ru
firebrand
swiftfox-athlon64
swiftfox-i686
swiftfox-prescott
swiftfox-i686-fr
swiftweasel-amd-pgo
swiftweasel-amd-pgo-fr
swiftweasel-intel-pgo-fr
wto
firefox
firefox-pgo
mozplugger
firefox-pgo

I think this is how the switch is meant to work. I posted a link to a bug/feature request that deals with a similar issue to what you report here.

Maybe info about every repo - even if it's up to date - is printed for the sake of consistency?

Offline

#9 2011-02-22 18:33:53

vgivanovic
Member
Registered: 2011-02-18
Posts: 40

Re: Why does 'pacman' produce purely informational output?

@karol

My question has to do when pacman has nothing to do, not when there is something interesting or unusual to report. I know about the '--quiet' switch. I know how to use it. I know when to use it.

My question is a design question, not a usage question, and I understand that there may not be any answer other than, "Because."

Offline

#10 2011-02-22 19:16:06

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Why does 'pacman' produce purely informational output?

simply because, when you run pacman you need to see some output to make sure that it ran correctly. As to why there isn't another switch which disables all output -- well the answer to that might just be "Because" (no one else thought about it or needed it)

however, when pacman has nothing to do, it has a pretty standard output. You can cook up a script which will read pacman's output and if it says "there is nothing to do", you know for sure that pacman has nothing to do, and you can use sed awk or anything else to replace the entire output with "" (empty space)  - as you have done already.

Assign an alias to pacman to use your script and you are done.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#11 2011-02-22 20:11:13

vgivanovic
Member
Registered: 2011-02-18
Posts: 40

Re: Why does 'pacman' produce purely informational output?

Inxsible wrote:

simply because, when you run pacman you need to see some output to make sure that it ran correctly

The absence of output can just as readily signal that a program ran correctly. It's a matter of convention, a convention that many Unix programs use, particularly the original command line programs (e.g. those in the binutils & coreutils packages). [See Google 'unix "rule of silence"'. ]

Perhaps we should all give this topic a rest.

Offline

Board footer

Powered by FluxBB