Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 163151 - RPM scripts fail on cygwin (a.ka. psm->sq.reaper = 0 doesn't work)
Summary: RPM scripts fail on cygwin (a.ka. psm->sq.reaper = 0 doesn't work)
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 4
Hardware: other
OS: Linux
Target Milestone: ---
Assignee: Paul Nasrat
QA Contact: Mike McLean
Depends On:
TreeView+ depends on / blocked
Reported: 2005-07-13 15:10 UTC by Mark Hatle
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2006-07-07 04:21:20 UTC

Attachments (Terms of Use)
Enable waitpid for cygwin (deleted)
2005-07-13 15:10 UTC, Mark Hatle
no flags Details | Diff

Description Mark Hatle 2005-07-13 15:10:20 UTC
Description of problem:
RPM scripts fail on cygwin due to bugs in cygwin's signal handling.  To work
around this issue, I set the psm->sq.reaper = 0 for cygwin.  This should envoke
the waitpid handler instead of the numerous threaded voodoo.

Version-Release number of selected component (if applicable):
RPM 4.3+

How reproducible:
In lib/psm.c change psm->sq.reaper = 0.  Scripts will no longer run properly.

Additional info:

The problem was determined to be that "rpmsqInsert" normally resets all of the
"sq" values.  However, when the reaper = 0, rpmsqInsert is never called, so they
have to be manually reset.

Also the sq->pipes only get setup if the reaper = 1.  So the closing/monitoring
of these needs to be avoided when reaper = 0.

I have attached a patch that we used to work around this.  Unfortunatly it won't
cleanly apply to anything but RPM's HEAD branch.  (It works with James Olin
Oden's dead lock patch.. see rpm-devel mailing list, 1/28/05.)

Comment 1 Mark Hatle 2005-07-13 15:10:20 UTC
Created attachment 116711 [details]
Enable waitpid for cygwin

Comment 2 Jeff Johnson 2006-07-07 04:21:20 UTC
Most of the patch was long since incorporated into rpm-4.4.3 (iirc).

Meanwhile, this patch avoids blocking the child on the parent's pipe close if waitpid
(i.e. sq->reaper = 0) is compiled in:
Index: rpmsq.c
RCS file: /cvs/devel/rpm/rpmio/rpmsq.c,v
retrieving revision
diff -u -b -B -w -p -r1.17.2.6 rpmsq.c
--- rpmsq.c     16 Nov 2005 13:59:38 -0000
+++ rpmsq.c     7 Jul 2006 04:26:54 -0000
@@ -449,6 +449,7 @@ fprintf(stderr, "    Enable(%p): %p\n", 
        /* Block to permit parent time to wait. */
        xx = close(sq->pipes[1]);
+       if (sq->reaper)
        xx = read(sq->pipes[0], &yy, sizeof(yy));
        xx = close(sq->pipes[0]);
        sq->pipes[0] = sq->pipes[1] = -1;

Note You need to log in before you can comment on or make changes to this bug.