Skip to content

Commit

Permalink
Merge pull request #1148 from carlosrodfern/main
Browse files Browse the repository at this point in the history
fix readelf output encoding handling of errors
  • Loading branch information
danigm authored Dec 4, 2023
2 parents d2dc3b1 + af2c43f commit cb507aa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rpmlint/readelfparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(self, path, extra_flags):

def parse(self):
r = subprocess.run(['readelf', '-W', '-S', self.path] + self.extra_flags, encoding='utf8',
capture_output=True, env=ENGLISH_ENVIROMENT)
errors='replace', capture_output=True, env=ENGLISH_ENVIROMENT)
if r.returncode != 0:
self.parsing_failed_reason = r.stderr
return
Expand Down Expand Up @@ -144,7 +144,7 @@ def __init__(self, path, extra_flags):

def parse(self):
r = subprocess.run(['readelf', '-W', '-l', self.path] + self.extra_flags, encoding='utf8',
capture_output=True, env=ENGLISH_ENVIROMENT)
errors='replace', capture_output=True, env=ENGLISH_ENVIROMENT)
if r.returncode != 0:
self.parsing_failed_reason = r.stderr
return
Expand Down Expand Up @@ -219,7 +219,7 @@ def __init__(self, path, extra_flags):

def parse(self):
r = subprocess.run(['readelf', '-W', '-d', self.path] + self.extra_flags, encoding='utf8',
capture_output=True, env=ENGLISH_ENVIROMENT)
errors='replace', capture_output=True, env=ENGLISH_ENVIROMENT)
if r.returncode != 0:
self.parsing_failed_reason = r.stderr
return
Expand Down Expand Up @@ -286,7 +286,7 @@ def __init__(self, path, extra_flags):
def parse(self):
try:
r = subprocess.run(['readelf', '-Ui', '-W', '-s', self.path] + self.extra_flags, encoding='utf8',
capture_output=True, env=ENGLISH_ENVIROMENT)
errors='replace', capture_output=True, env=ENGLISH_ENVIROMENT)
if r.returncode != 0:
self.parsing_failed_reason = r.stderr
return
Expand Down Expand Up @@ -322,7 +322,7 @@ def __init__(self, path, extra_flags):

def parse(self):
r = subprocess.run(['readelf', '-p', '.comment', self.path] + self.extra_flags, encoding='utf8',
capture_output=True, env=ENGLISH_ENVIROMENT)
errors='replace', capture_output=True, env=ENGLISH_ENVIROMENT)
if r.returncode != 0:
self.parsing_failed_reason = r.stderr
return
Expand Down

0 comments on commit cb507aa

Please sign in to comment.