HomePhabricator

Use "exec" to skip the Dash intermediate shell for "pygmentize"

Description

Use "exec" to skip the Dash intermediate shell for "pygmentize"

Summary:
See T13224. A user reports the setTimeout() not actually killing Pygments under Ubuntu, where the default shell is "dash".

I think what's happening here is:

  • Dash creates a strict subprocess always, Bash only does sometimes. If you "bash" a single simple command, it automatically behaves like you "exec"'d it and replaces itself.
  • So we end up with "dash" as our subprocess, and then "pygments" under it.
  • setTimeout() does SIGTERM + wait + SIGKILL.
  • When we SIGTERM, I'd guess it propagates to "pygments" but "pygments" ignores it (it's stuck inside regexp explosion land).
  • When we SIGKILL, I think it kills "dash" and leaves "pygments" alive.

I didn't really test any of this since it's theoretically sound and adding "exec" is generally safe, and the reporting user says it fixed things.

Test Plan: Highlighted some non-problematic code locally to make sure this didn't break anything in the working case.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20054

Details

Provenance
epriestleyAuthored on Jan 29 2019, 1:55 PM
epriestleyPushed on Jan 30 2019, 2:10 PM
Reviewer
amckinley
Differential Revision
D20054: Use "exec" to skip the Dash intermediate shell for "pygmentize"
Parents
rPHUd3f11162b42c: Provide "phutil_build_http_querystring()", like "http_build_query()" but not…
Branches
Unknown
Tags
Unknown
Build Status
Buildable 21758
Build 29692: Run Core Tests