1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00

Fix encoding issues related to Python 3 upgrade.

Python 3 str() is a unicode already, so can't be decoded.
subprocess.Popen needs to be in text mode (universal_newlines is the
oldest compatible kwarg for this) in order to do line-based buffering.
In general, all the filesystem encoding stuff we were doing is done by
Python itself now.
This commit is contained in:
dmiller
2022-12-07 20:34:07 +00:00
parent 12d41ec2cd
commit 9e4d6f5f5c
14 changed files with 35 additions and 125 deletions

View File

@@ -65,7 +65,6 @@ from gi.repository import Gtk, GLib
import errno
import os
import time
import sys
# Prevent loading PyXML
import xml
@@ -478,7 +477,7 @@ class ScanInterface(HIGVBox):
try:
command_execution.run_scan()
except OSError as e:
text = str(e.strerror, errors='replace')
text = e.strerror
# Handle ENOENT specially.
if e.errno == errno.ENOENT:
# nmap_command_path comes from zenmapCore.NmapCommand.
@@ -486,9 +485,6 @@ class ScanInterface(HIGVBox):
if path_env is None:
default_paths = []
else:
fsencoding = sys.getfilesystemencoding()
if fsencoding:
path_env = path_env.decode(fsencoding, 'replace')
default_paths = path_env.split(os.pathsep)
text += "\n\n{}\n\n{}".format(
_("This means that the nmap executable was "