Giter Club home page Giter Club logo

Comments (3)

ibuler avatar ibuler commented on May 12, 2024

vim 没有权限的文件也会卡死

from jumpserver.

liuzheng avatar liuzheng commented on May 12, 2024

该bug我暂时没有思路修复,原因如下:
1.经过一系列排查,认定不是前端bug,而是后端paramiko对读取gbk字节流产生的bug,暂时还没有实现jumpserver实现的精简重现代码,有如下测试代码说明问题:

import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('localhost', port=22, username="liuzheng", key_filename='/Users/liuzheng/.ssh/id_rsa')
stdin, stdout, stderr = ssh.exec_command("cat /Users/liuzheng/Downloads/44.txt")
print stdout.readlines()

其中44.txt是gbk编码的。

Traceback (most recent call last):
  File "bug52show.py", line 7, in <module>
    print stdout.readlines()
  File "/usr/local/lib/python2.7/site-packages/paramiko/file.py", line 285, in readlines
    line = self.readline()
  File "/usr/local/lib/python2.7/site-packages/paramiko/file.py", line 270, in readline
    return line if self._flags & self.FLAG_BINARY else u(line)
  File "/usr/local/lib/python2.7/site-packages/paramiko/py3compat.py", line 53, in u
    return s.decode(encoding)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xbf in position 0: invalid start byte

2 . 我自己在webterminal上有异于jumpserver的一套完整的实现方式,无bug,但是由于是使用os.system 和 os.execv ,利用ssh命令进行连接,在Windows会不兼容,不能套用。

故而对此的建议是希望运维人员统一字符编码,猜测如果正常使用下,通过sql 的select语句打印出gbk编码的也会出现死的情况

这里有一个monkey patch https://gist.github.com/smurn/4d45a51b3a571fa0d35d

from jumpserver.

lanxing avatar lanxing commented on May 12, 2024

paramiko对gbk读取的bug楼主怎么解决的?

from jumpserver.

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.