leycec / raiagent

Third-party Gentoo overlay. Ride the Lagrangian point between awesomeness and volatile compounds.
31 stars 14 forks source link

Some powerline enhancements #27

Closed ZyX-I closed 9 years ago

ZyX-I commented 9 years ago

Added information for qtile and some testing-related code. Note: to make tests actually work powerline/powerline#1316 is required to be merged. I have not actually tested code from this ebuild, except that libvterm builds, tests and installs fine.

ZyX-I commented 9 years ago

Powerline tests appear not to work with sandbox.

leycec commented 9 years ago

It's settled: you're awesome.

Thanks for the tremendous amount of well-documented work you've done here. I've laboriously poured through these commits... and have no significant comments! So, they're in. :facepunch:

ZyX-I commented 9 years ago

This is unfinished: tests still do not work. I have some strange issues with shell tests run in screen: tested shells, be they run in screen or not, simply exit for unknown reason before receiving any input from testing script.

ZyX-I commented 9 years ago

This is after dealing with sandbox.

ZyX-I commented 9 years ago

Without screen shells exit because stdin is closed. Why do they exit with screen?

ZyX-I commented 9 years ago

Disabling sandbox does not help with the problem.

ZyX-I commented 9 years ago

It appears that for some reason bash immediately detaches after it is run: I found a bunch of bash processes that should not be there normally.

So it does not exit, it detaches. Weird.

ZyX-I commented 9 years ago

Actually it is screen who detaches. Failed to create socket?

ZyX-I commented 9 years ago

Yup: AF_UNIX path too long.

leycec commented 9 years ago

Thanks for strenuously debugging this. I've updated the ebuild to explicitly warn users that unit tests currently fail.

I also (...sort of) tracked down the ignorable sandbox warnings "ERROR: ld.so: object 'libsandbox.so' from LD_PRELOAD cannot be preloaded: ignored." The Gentoo Wiki suggests this should only happen under SELinux-enabled profiles, which I am not. To quote:

It happens because SELinux tells glibc to disable LD_PRELOAD (and other environment variables that are considered potentially harmful) during domain transitions.

So, presumably a few Powerline unit tests disable LD_PRELOAD. Which seems a bit odd. In any case, please carry on.

ZyX-I commented 9 years ago

Current problem is not sandbox, it is the fact that

  1. screen cannot use path like /var/tmp/portage/app-misc/powerline-9999-r18/work/powerline-9999/tests/shell/home/.screen/powerline-shell-test-bash-25276 for its socket.
  2. I cannot use paths outside of /var/tmp/portage/app-misc/powerline-9999-r18 because it what ebuild must do (and trying to do this will most likely result failure with sesandbox (SElinux sandbox, documentation suggests that you must not use this feature by yourself) feature enabled).

Thus I am now trying to switch powerline to use pexpect in place of screen for shell tests. Have a few commits (to this ebuild) to make tests work a bit better.


Note: all currently present ebuilds fail to run tests.

ZyX-I commented 9 years ago

Now I have exactly the same problem with socket path length with tmux tests. Problem is that I cannot replace tmux with pexpect because it is tmux integration which is being tested. Guess I need to try to use fakechroot.

ZyX-I commented 9 years ago

Hopefully tmux can use relative paths which are obviously not that big.

leycec commented 9 years ago

screen cannot use path like /var/tmp/portage/app-misc/powerline-9999-r18/work/powerline-9999/tests/shell/home/.screen/powerline-shell-test-bash-25276 for its socket.

That's both surprising and terrible.

Now I have exactly the same problem with socket path length with tmux tests.

Jesus. While I understand the need to cap path lengths (e.g., to avoid buffer overflow attacks), the paths in question aren't that long.

Hopefully tmux can use relative paths which are obviously not that big.

If that fails as well, consider creating a symlink at /var/tmp/portage/app-misc/powerline-9999-r18/work/a pointing to /var/tmp/portage/app-misc/powerline-9999-r18/work/powerline-9999/tests/shell/home/.screen/powerline-shell-test-bash-25276. I haven't actually delved into the tmux codebase, but that should work. The former has a path length of less than 64 bytes, which seems like a reasonable cap. (Stallman save us if the cap is 32 bytes.)

ZyX-I commented 9 years ago

If that fails as well,

It was a statement (i.e. verified). Tmux tests now work, screen were ported to pexpect (according to the documentation the relevant variable (SCREENDIR) should be ignored if screen is suid and screen should be recompiled to change directory instead, so I did not even try to do the same thing with screen: it is sgid (and I thought it is suid because libc removes LD_LIBRARY_PATH from its environment) (sgid screen actually works with SCREENDIR; though I wanted to use pexpect someday in any case because as it allows to wait until output and not for N seconds)).