Giter Site home page Giter Site logo

Comments (13)

takluyver avatar takluyver commented on September 26, 2024

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.

emaste avatar emaste commented on September 26, 2024

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.

takluyver avatar takluyver commented on September 26, 2024

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.

emaste avatar emaste commented on September 26, 2024

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.

takluyver avatar takluyver commented on September 26, 2024

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.

tomspur avatar tomspur commented on September 26, 2024

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.

takluyver avatar takluyver commented on September 26, 2024

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.

emaste avatar emaste commented on September 26, 2024

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.

tomspur avatar tomspur commented on September 26, 2024

@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.

takluyver avatar takluyver commented on September 26, 2024

I'm just setting up Python on my Android tablet to check ;-)

from pexpect.

tomspur avatar tomspur commented on September 26, 2024

👍 :)

from pexpect.

takluyver avatar takluyver commented on September 26, 2024

It's 21524 in Android 4.4 as well.

from pexpect.

takluyver avatar takluyver commented on September 26, 2024

Fixed by PR #40.

from pexpect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.