Bug 1269665

Summary: running mandb from transfiletriggerin causes mandb to crash rpm
Product: [Fedora] Fedora Reporter: David Shea <dshea>
Component: man-dbAssignee: Nikola Forró <nforro>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cjwatson, dcantrell, dshea, extras-qa, jchaloup, jsilhan, jzeleny, lkardos, lslebodn, mluscon, nforro, novyjindrich, packaging-team-maint, pknirsch, pnemade, tim.lauridsen, vmukhame
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1264198 Environment:
Last Closed: 2015-11-02 09:24:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Shea 2015-10-07 21:34:09 UTC
This seems to only happen in mock.

Scriptlets run from %transfiletriggerin get a big pile of input on stdin from rpm containing the list of triggering files, and, when run from mock, the %transfiletriggerin scriptlet raises SIGPIPE, which crashes rpm. See also bug 1264198.

I'm not saying that's a not a bug in rpm, but I'm not saying it's not a bug in man-db, either. This is blocking anaconda testing in rawhide.

Comment 1 Lukas Slebodnik 2015-10-08 07:21:51 UTC
Mock uses dnf on fedora rawhide. There isn't problem with yum-deprecated.
You might find more info in BZ1267492. There is simple reproducer using docker instead of mock. But symptoms are the same.

Comment 2 Jan Zeleny 2015-10-08 07:24:05 UTC
*** Bug 1267492 has been marked as a duplicate of this bug. ***

Comment 3 Lukas Slebodnik 2015-10-12 06:25:59 UTC
I am not sure that the bug is in man-db.
It works with yum and also it works with dnf + tty.

More details are in duplicated BZ (which was filed before this one :-)
https://bugzilla.redhat.com/show_bug.cgi?id=1267492#c0

Comment 4 David Shea 2015-10-12 13:26:15 UTC
No. I already explained what's going on. The exact behavior may change depending on the particular arrangement of input buffers and terminal file descriptors and such, but this ultimately comes down to, 1) man-db has requested that rpm write a boatload of data to man-db's input pipe, and 2) man-db does not read from this pipe. That's the definition of a SIGPIPE.

Comment 5 Lukas Slebodnik 2015-10-12 14:07:54 UTC
Could you exaplain why it works with yum (yum-deprecated)?

Comment 6 David Shea 2015-10-12 15:52:18 UTC
I don't know, and it doesn't matter. Maybe dnf is running faster and able to get more data into the stdin buffer than yum can.

Comment 7 Nikola Forró 2015-10-13 07:24:13 UTC
I'm unable to reproduce this, but I think SIGPIPE can be avoided by adding "cat > /dev/null" as the first commmand in %transfiletriggerin scriptlet, so that mandb gets nothing on stdin.

Comment 8 Lukas Slebodnik 2015-10-13 07:35:54 UTC
(In reply to Nikola Forró from comment #7)
> I'm unable to reproduce this, but I think SIGPIPE can be avoided by adding
> "cat > /dev/null" as the first commmand in %transfiletriggerin scriptlet, so
> that mandb gets nothing on stdin.

The simplest reproducer is to use docker without tty.
BTW. It works on fedora 23 which has older version of man-db man-db-2.7.1-10.fc23

So I tried to bisect it on fedora rawhide. The first broken version is man-db-2.7.3-2.fc24. The change-log says: "use file triggers instead of crontabs for updating cache".

# docker run --rm fedora:rawhide sh -c "dnf update -y dnf rpm  && dnf --rpmverbosity=debug --verbose install -y https://kojipkgs.fedoraproject.org//packages/man-db/2.7.3/1.fc24/x86_64/man-db-2.7.3-1.fc24.x86_64.rpm"

Comment 9 Lukas Slebodnik 2015-10-13 07:37:51 UTC
Do file triggers work with yum(yum-deprecated)?
Otherwise it seems to be some issue with dnf+rpm.

Comment 10 Nikola Forró 2015-10-13 08:29:46 UTC
(In reply to Lukas Slebodnik from comment #9)
> Do file triggers work with yum(yum-deprecated)?
Yes, they do.

(In reply to Lukas Slebodnik from comment #8)
> The simplest reproducer is to use docker without tty.
Right, I'm not sure what I did wrong last time but I was unable to catch this.

However, the "cat > /dev/null" solution seems to be working. Any objections against it?

Comment 11 Lukas Slebodnik 2015-10-13 08:45:24 UTC
(In reply to Nikola Forró from comment #10)
> (In reply to Lukas Slebodnik from comment #9)
> > Do file triggers work with yum(yum-deprecated)?
> Yes, they do.
> 
> (In reply to Lukas Slebodnik from comment #8)
> > The simplest reproducer is to use docker without tty.
> Right, I'm not sure what I did wrong last time but I was unable to catch
> this.
> 
> However, the "cat > /dev/null" solution seems to be working. Any objections
> against it?

Yes, it might work.

But if it is a general problem with dnf + file triggers(rpm) than the same problem can occur in other packages. It would be good to avoid such workarounds as "cat > /dev/null" in every package which will use file triggers.
Or at least it should be properly documented.

This is a reason why there is need-info flag "(lkardos)"

Comment 12 Ľuboš Kardoš 2015-10-13 08:58:45 UTC
For now you can use workaround with "cat > /dev/null" but this has to be fixed in rpm.

Comment 13 Nikola Forró 2015-11-02 09:24:40 UTC
Closing this, as the problem was fixed in bug 1264198.