Comments (13)
Thanks for reporting this. So, to check that I understand correctly:
- Without this hack, the
setwinsize
method will fail on some systems. At this point, it's probably only really ancient systems that are affected, but it's difficult to be sure. - With this hack, calling the method emits a warning in the system log but still succeeds, on BSD systems, and presumably also OS X.
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.
from pexpect.
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
if (not sys.platform.startswith("freebsd")):
workaround hack
from pexpect.
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:
- Kernels: Linux, BSD, Darwin, Solaris? Other unixes?
- Architectures: x64, x86, ARM? PPC?
- Old versions of kernels
So far, I've checked on Linux x64 and Mac x64, and the bug reports are from BSD, presumably x64.
from pexpect.
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.
from pexpect.
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.
from pexpect.
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 #fedora-arm
).
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?
from pexpect.
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.
from pexpect.
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:
hex(getattr(termios, 'TIOCSWINSZ'))
'0x80087467'
This is the magic value that the workaround is "helpfully" updating.
if TIOCSWINSZ == 2148037735:
# Same bits, but with sign.
TIOCSWINSZ = -2146929561
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.
from pexpect.
@takluyver: CentOS 5 at least also has the same value in TIOCSWINSZ
, so I'm guessing RHEL 5 should report the same. I'm also having access to Debian 7 (wheezy), SLES 10 (both 64 bit), which all have the same value... It would be nice to get that value from an android device or so, but other than that, I don't know which system could still need that workaround...
from pexpect.
I'm just setting up Python on my Android tablet to check ;-)
from pexpect.
👍 :)
from pexpect.
It's 21524 in Android 4.4 as well.
from pexpect.
Fixed by PR #40.
from pexpect.
Related Issues (20)
- Support for new release HOT 3
- Two tests hang on `cat` HOT 3
- test_large_stdout_stream timeout HOT 1
- REPLWrapTestCase.test_existing_spawn fail on illumos HOT 1
- sdist is missing requirements-testing.txt
- AttributeError: module 'asyncio' has no attribute 'coroutine' HOT 1
- Incorrect DEVELOPERS.rst
- False positive expect_exact HOT 1
- Test REPLWrapTestCase.test_pager_as_cat fails.
- An asterisk appearing out of nowhere with Clojure
- Time for a release: any reason to delay? HOT 5
- 4.9.0: git tag does not match PyPI version HOT 2
- Handling SIGTSTP possible?
- Docs not updated for 4.9?
- 4.9: pytest fails in 3 units HOT 1
- "expect()" and "await expect()" have different results on completed processes
- Pexpect does not implement enough asynchronous methods to prevent the use of time.sleep().
- add contribution documentation
- Pxssh sometime does not capture the full output of previous `sendline`
- trouble using pexpect with julia
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pexpect.