nelhage / reptyr

Reparent a running program to a new terminal
MIT License
5.71k stars 216 forks source link

freebsd: ignore fd < 0 in the vnodes returned #107

Closed kevans91 closed 4 years ago

kevans91 commented 4 years ago

This is a possibility, and reptyr does not care about these. This is mostly a cosmetic issue, as reptyr then complains because it can't use dup2() on fd=-1.

Signed-off-by: Kyle Evans kevans@FreeBSD.org

nelhage commented 4 years ago

Thanks for all these fixes!

Do you, by any chance, know of a CI provider that offers FreeBSD support? It'd be great to get that also covered in CI.

kevans91 commented 4 years ago

Cirrus integrates with GitHub, free for open source projects, and supports FreeBSD -- I started working on a PR for you to get reptyr added to it, this is what my (copied from another project) tentative .cirrus.yml looked like:

freebsd_12_task:
  freebsd_instance:
    image: freebsd-12-1-release-amd64
  install_script:
    pkg install -y gmake
  build_script:
    gmake

linux_gcc_task:
  container:
    image: gcc:latest
  install_script:
    - apt-get update
  build_script:
    - make
  test_script:
    - make test

I'm not yet to the point of being able to gmake test on FreeBSD, though- the Python script isn't allowed to attach, even as root, and I'm still working out the details of why.

nelhage commented 4 years ago

Oh, awesome. Does Cirrus use some kind of containerization or jail that blocks ptrace? Does FreeBSD have a PR_SET_PTRACER_ANY equivalent? Let me know if I can help, I'd love to have working CI for more of our platforms.

kevans91 commented 4 years ago

Cirrus uses GCE VMs apparently to run this stuff, so reptyr should be fine in general is fine as far as that goes.

The test failure I'm experiencing locally seems to be because of the TIOCSCTTY call -- we're throwing EPERM when the victim is run under pexpect. =\