-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TIOCSWINSZ hack produces ioctl sign-extension warning in FreeBSD system log #39
Comments
Thanks for reporting this. So, to check that I understand correctly:
Does anyone have any more information on what platforms need this workaround? I can certainly imagine that it's no longer necessary, but I'm reluctant to drop it if it might cause actual issues again (and real problems trump warnings). Specifically, I'm concerned about 32 bit systems, and enterprisey systems which go years without upgrading the core system. |
Your with/without scenarios match my understanding of this issue. I have no insight into which platforms are affected though, and can understand the reluctance to dropping it. What about whitelisting platforms known to not need the workaround - a la
|
Hmm, we could do that, but it's really a question of platform+version, and that opens up a big can of worms. If we can check a decent variety of current platforms, I think the best option is to drop the hack - if there's some niche platform that still has the issue, they can either patch it locally or work out a fix that doesn't affect other platforms. I'd like to confirm that this isn't needed on as many combinations as possible of:
So far, I've checked on Linux x64 and Mac x64, and the bug reports are from BSD, presumably x64. |
The comment mentions "OSF1 Alpha and RedHat 7.1" as examples of affected systems. I searched only for FreeBSD bug reports; I'm not sure if other BSDs have the same warning or not. Presumably the workaround is only applicable to 64-bit systems. |
I'm guessing that that means Red Hat Linux, not RHEL - so 7.1 was released way back in 2001. From what I can find on OSF/1, that's even older. But I've no idea how long the bug may have persisted, and if it might still be out there in Linux versions that big enterprises still run things on. |
This workaround seems to depend on the operation system and not the architecture (With a recent Fedora version armv7a, aarch64 and x86-64 all contain the same value of 21524 - thanks @hrw for confirming that on Isn't it quite save to assume, that if enterprises still run such a old Linux distribution, they most likely don't want to update pexpect anyway and stay on the old version? |
Thanks @tomspur , that's the same value I get on Debian on x86-64. If enterprises are still running something from 2001, I certainly don't mind if they can't update pexpect. I was thinking of more recent distros that might still be in use, like RHEL 5, first released in 2007. But then, RHEL 5 had Python 2.4, and Pexpect already doesn't support that. I think we should get rid of this workaround and wait to see if anyone complains. @emaste , do you want to make a pull request? Drop a comment in where it was to note that it was removed. |
The workaround is architecture dependent in that it deals with sign extension on 64-bit systems, but only affects platforms where TIOCSWINSZ has a value > 0x80000000. For example, on FreeBSD:
This is the magic value that the workaround is "helpfully" updating.
The issue is that it's the same lower 32 bits, but the 2nd parameter to ioctl is an unsigned long, so the replacement value -2146929561 ends up as 0xffffffff80087467, not 0x80087467, which is what produces the warning from the FreeBSD kernel. |
@takluyver: CentOS 5 at least also has the same value in |
I'm just setting up Python on my Android tablet to check ;-) |
👍 :) |
It's 21524 in Android 4.4 as well. |
Fixed by PR #40. |
There's a hack in
pexpect/__init__.py
to work around some buggy platforms:-2146929561 is 0xffffffff80087467 and passing this sign-extended value rather than the desired 0x80087467 produces a warning message in the system console on FreeBSD:
Feb 5 17:19:11 feynman kernel: WARNING pid 11323 (python2.7): ioctl sign-extension ioctl ffffffff80087467
This has shown up in a few places, e.g.:
http://www.freebsd.org/cgi/query-pr.cgi?pr=152770
http://llvm.org/bugs/show_bug.cgi?id=18749
The text was updated successfully, but these errors were encountered: