public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Jason Stubbs <jstubbs@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [0/7] portage_exec cleanups (WAS: [Bug 104705] emerge doesn't print complete error message)
Date: Sun, 30 Oct 2005 16:03:44 +0900	[thread overview]
Message-ID: <200510301603.44765.jstubbs@gentoo.org> (raw)
In-Reply-To: <200510291934.13207.jstubbs@gentoo.org>

[-- Attachment #1: Type: text/plain, Size: 2454 bytes --]

On Saturday 29 October 2005 19:34, Jason Stubbs wrote:
> On Sunday 23 October 2005 15:45, Jason Stubbs wrote:
> > Commented on the bug due to reasoning behind this patch. Essentially,
> > SIGTERM is sent to "tee", a WNOHANG waitpid() is performed followed by
> > SIGKILL if it hasn't exited. So if tee doesn't exit immediately upon
> > getting the SIGTERM, its buffers won't get a chance to get to disk due to
> > it being killed. This patch simply adds a 1 second window between the
> > SIGTERM and the SIGKILL.
>
> Per discussion on the bug, the problem is actually that tee shouldn't be
> sent a SIGTERM or SIGKILL at all. The decided solution was to wait on tee
> rather ebuild. I went a bit further than that though and cleaned up most of
> spawn().

Ok, I'm done. The diff is twice the size of the file itself, so I've just 
attached the file. Beyond the previous patch, it's mostly comment additions 
and whitespace/style changes but there are a few edits beyond that:

* Removed unused imports
* Removed the setting of BASH_ENV from spawn_bash
* Removed the SANDBOX_PID_FILE code from spawn_sandbox
* Removed the unnecessary setting of uid in spawn_sandbox
* Added back exception handling to cleanup() as registered pids may
  be cleaned up outside of spawn()
* Changed cleanup() to send a SIGTERM rather than SIGKILL
* Added os.path.isfile() checks to the can-execute tests so that directories
  aren't incorrectly detected as executable
* Changed pathname lookup failure return from None to -1 because
  equatable-to-False returns from spawn() usually indicate success
* Raise a ValueError if a logfile is specified but stdout/stderr have not
* Moved the os.fork()==0 code into a separate function so that it can be
  easily wrapped with a try/except
* Changed the exception reporting to use sys.stderr.write() rather than print
* Moved opt_name and myargs setup into the os.fork()==0 branch as it's not
  used outside of it
* Add/remove spawned pids to/from spawned_pids regardless of whether a
  returnpid was specified
* Changed spawn() to send a SIGTERM rather than SIGKILL when the pipe fails.
* Renamed myc to binary
* Renamed mypid to mypids

Out of those changes, the SIGKILL -> SIGTERM will probably be questioned. 
SIGKILL just seems too heavy handed - especially in the cleanup() function. 
The main thing that worries me is that anything that has write buffers open 
will likely corrupt whatever it was writing to.

--
Jason Stubbs

[-- Attachment #2: portage_exec.py --]
[-- Type: application/x-python, Size: 6078 bytes --]

      parent reply	other threads:[~2005-10-30  7:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-23  6:45 [gentoo-portage-dev] [Bug 104705] emerge doesn't print complete error message Jason Stubbs
2005-10-29 10:34 ` [gentoo-portage-dev] [0/7] portage_exec cleanups (WAS: [Bug 104705] emerge doesn't print complete error message) Jason Stubbs
2005-10-29 10:41   ` [gentoo-portage-dev] [1/7] portage_exec cleanups Jason Stubbs
2005-10-29 10:44   ` [gentoo-portage-dev] [2/7] " Jason Stubbs
2005-10-29 10:49   ` [gentoo-portage-dev] [3/7] " Jason Stubbs
2005-10-29 14:22     ` Brian Harring
2005-10-29 15:06       ` Jason Stubbs
2005-10-29 15:17         ` Brian Harring
2005-10-29 10:52   ` [gentoo-portage-dev] [4/7] " Jason Stubbs
2005-10-29 11:03     ` Jason Stubbs
2005-10-29 10:56   ` [gentoo-portage-dev] [5/7] " Jason Stubbs
2005-10-29 15:25     ` Jason Stubbs
2005-10-29 16:04       ` Brian Harring
2005-10-29 16:40         ` Jason Stubbs
2005-10-29 17:17           ` Jason Stubbs
2005-10-29 17:17           ` Brian Harring
2005-10-29 17:28             ` Jason Stubbs
2005-10-29 17:20           ` Jason Stubbs
2005-10-29 17:28             ` Brian Harring
2005-10-29 10:57   ` [gentoo-portage-dev] [6/7] " Jason Stubbs
2005-10-29 11:01   ` [gentoo-portage-dev] [7/7] " Jason Stubbs
2005-10-29 17:32   ` [gentoo-portage-dev] [0/7] portage_exec cleanups (WAS: [Bug 104705] emerge doesn't print complete error message) Jason Stubbs
2005-10-29 17:38     ` Jason Stubbs
2005-10-30  7:03   ` Jason Stubbs [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200510301603.44765.jstubbs@gentoo.org \
    --to=jstubbs@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox