Bug 369450 - zypper install hides rpm %post script output
Summary: zypper install hides rpm %post script output
Status: RESOLVED FIXED
: 430791 468161 (view as bug list)
Alias: None
Product: openSUSE 10.3
Classification: openSUSE
Component: libzypp (show other bugs)
Version: Final
Hardware: x86-64 Red Hat 6.2
: P2 - High : Minor with 5 votes (vote)
Target Milestone: ---
Assignee: Jan Kupec
QA Contact: Duncan Mac-Vicar
URL:
Whiteboard: maint:released:11.1:24006
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-11 20:45 UTC by Archie Cobbs
Modified: 2009-05-04 14:17 UTC (History)
5 users (show)

See Also:
Found By: Customer
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
zypp rpm install output callback (2.28 KB, patch)
2008-10-10 12:27 UTC, Jan Kupec
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Archie Cobbs 2008-03-11 20:45:51 UTC
All other tools I've used to install RPMs (e.g., apt, smart, rpm, etc.) will show you the output of the RPM's scriptlets. zypper(1) however does not.

This is a problem because often these messages are important for the person doing the installation to see, e.g., "Don't forget to do XXX after you install this" etc.

Even when zypper is given the "-v" flag this output is suppressed.

Please change zypper to show the output of the RPM scriptlets to stdout, or at least do so when "-v" is supplied.

Versions:

zypper-0.8.25-0.1
libzypp-3.26.8-0.1
Comment 1 Jan Kupec 2008-09-30 16:28:25 UTC
The output is written to /var/log/YaST/y2logRPM; since libzypp 5.12.1 to /var/log/zypp/history. See http://en.opensuse.org/Libzypp/Package_History for example.

It is not optimal as an immediate notification, though. But when showing the output simply among the downloading/installing lines it can quickly scroll out of the screen.

Any ideas for a better solution (like e.g. Debian's debconf), or should we just display the output of rpm when installing/removing packages with zypper?
Comment 2 Jan Kupec 2008-10-03 08:53:14 UTC
Another issue related to this is when the package expects user input on stdin in scriptlets. See bug 430791. Should we consider that a bug in the package? Or is there a standard way of dealing with such case?
Comment 3 Hans-Peter Jansen 2008-10-03 09:13:24 UTC
If zypper is redirecting the output to some file and post is waiting for some input, how should aunt tilly know, why this process is hanging there forever?
In my case, VMware-Workstation is not even properly installed, since it does the whole installation process in %post (as drain bammaged as it is).

Sure, output is scrolled away, but if you redirect it to some file additionally, it's not lost and most terminals have some way of scrolling up.

Thus, yes, sure, this is a genuine bug in my book, not simply some user inconvenience. 
Comment 5 Michael Schröder 2008-10-06 12:46:17 UTC
Regarding #2: that's a package bug. Actually I wouldn't mind to change rpm so that it makes fd 0 point to /dev/null.
Comment 6 Hans-Peter Jansen 2008-10-07 10:06:24 UTC
Michael, I'm going to accept your claim, IF either
 - you convince the RPM people to accept such a change officially - e.g. next fedora isn't accepting anything on stdin in rpm scripts. That way, you force those silly rpm creators to rethink their sillyness
or
 - you convince your bosses to buy VMware and force them that way to create proper rpm packages.

But until then, please cope with standard rpm behavior. If you change only Novells version of rpm, the web will fill up with silly "Novell blocks VMware products" statements. Do you want that? (I bet, your management will intervene at this point).

Sure, I hate the VMware-Workstation rpm behavior. It's brain devastated. It's effectively ostracising package management (which is one important reason for me to keep using your products). But my users depend on VMware-Workstation, which allowed me to run SUSE Linux desktops diskless in a commercial setting since 1998, and believe me, it's hard enough to keep up even without any package management handling issues.
Comment 7 Michael Schröder 2008-10-07 12:30:40 UTC
The problem is that returning an error in the post script will abort the rpm transaction and leave the system in a mess. That's not so critical for SUSE systems, as we call rpm for every transaction element, but on a fedora system you're hosed.
(But maybe they don't return an error, I've not tried to install that package.)
Comment 8 Jan Kupec 2008-10-10 12:27:48 UTC
Created attachment 244855 [details]
zypp rpm install output callback

This patch passes rpm output from zypp to applications through a callback, one line per call. After adapting zypper it looks like this ("rpm: " prepended to each output line):

--------
The following NEW package is going to be installed:
  yast2-dns-server


Overall download size: 127.0 K. After the operation, additional 735.0 K will be used.
Continue? [YES/no]:
Retrieving package yast2-dns-server-2.17.7-1.24.noarch (1/1), 127.0 K (735.0 K unpacked)
rpm: warning: /var/cache/zypp/packages/iso/suse/noarch/yast2-dns-server-2.17.7-1.24.noarch.rpm: Header V3 RSA/SHA256 signature: NOKEY, key ID 307e3d54
Installing: yast2-dns-server-2.17.7-1.24 [done]
----------

OK? I guess we want the same also for package removal...
Comment 9 Jan Kupec 2008-10-10 12:47:24 UTC
*** Bug 430791 has been marked as a duplicate of this bug. ***
Comment 10 Jan Kupec 2008-10-10 12:50:20 UTC
There is also a suggestion to enable this only with -v (verbose) option.
Comment 11 Michael Andres 2008-12-18 22:27:27 UTC
@ openSUSE 11.1/ SLE-11

Unfortunately the required new callback method needs to be virtual, so it breaks binary compatibility. There's a similar report assigned to Ladislav, because pkg-bindings still try to read this additional output from y2logRPM, which no longer exists (bug #456446).

But we could report the additional rpm output (warnings or output from scripts) via the existing 

        virtual void finish(
          Resolvable::constPtr /*resolvable*/
          , Error /*error*/
	  , const std::string &/*reason*/
        ) {}

With error==NO_ERROR we could pass the additional output as 'reason'.
Comment 12 Jan Kupec 2009-01-23 13:04:07 UTC
*** Bug 468161 has been marked as a duplicate of this bug. ***
Comment 13 Michael Andres 2009-02-03 16:46:35 UTC
@ openSUSE 11.1/ SLE-11

Since libzypp-5.27.4 any additional rpm output is sent via the Install/RemoveResolvableReport finish() callback. The string is readu for being printed.



I suppose just zypper/src/callbacks/rpm.h has to be adapted. In case of success any non-empty reason string should be written to stdout.

 "%s:\n%s\n" % _("Additional rpm output") % rpmmsg
Comment 14 Michael Andres 2009-02-03 16:51:31 UTC
(accidentally hit <commit>)

The result string already contains the 'Additional rpm output:' headline. Just write it.
Comment 15 Jan Kupec 2009-02-15 20:34:59 UTC
Only in case of success? I would guess that we'd want _any_ rpm output, even from a failed operation, or?
Comment 16 Michael Andres 2009-02-16 10:32:14 UTC
In case of an error rpm output is already reported via the problem() callback.
Comment 17 Jan Kupec 2009-02-17 12:25:10 UTC
Thanx. Done in git, will be in zypper 1.0.7 and 1.1.0.
Comment 18 Jan Kupec 2009-02-19 13:21:15 UTC
submitted
Comment 19 Swamp Workflow Management 2009-05-04 14:17:30 UTC
Update released for: PackageKit, PackageKit-debuginfo, PackageKit-debugsource, PackageKit-devel, PackageKit-lang, gnome-packagekit, gnome-packagekit-debuginfo, gnome-packagekit-debugsource, gnome-packagekit-lang, libpackagekit-glib10, libpackagekit-glib10-devel, libpackagekit-qt10, libpackagekit-qt10-devel, libqdialogsolver1, libqdialogsolver1-debuginfo, libqdialogsolver1-debugsource, libqdialogsolver1-devel, libsatsolver, libsatsolver-debuginfo, libsatsolver-debugsource, libsatsolver-devel, libzypp, libzypp-debuginfo, libzypp-debugsource, libzypp-devel, perl-satsolver, python-satsolver, ruby-satsolver, satsolver-tools, yast2-pkg-bindings, yast2-pkg-bindings-debuginfo, yast2-pkg-bindings-debugsource, yast2-pkg-bindings-devel-doc, yast2-qt-pkg, yast2-qt-pkg-debuginfo, yast2-qt-pkg-debugsource, zypper, zypper-debuginfo, zypper-debugsource
Products:
openSUSE 11.1 (debug, i586, ppc, x86_64)