Skip to content

CA-427358: Fix default value of readlines#172

Merged
GeraldEV merged 1 commit into
masterfrom
private/geralde/CA-427358
May 12, 2026
Merged

CA-427358: Fix default value of readlines#172
GeraldEV merged 1 commit into
masterfrom
private/geralde/CA-427358

Conversation

@GeraldEV
Copy link
Copy Markdown
Contributor

If readlines fails to open a file or read the contents, it will fail and return an empty string. However f.readlines (the exepcted output) produces a list of strings. This inconsistency causes some error handling code to treat the output as a populated list of strings instead of skipping over it (as the command failed).

Fix the issue by consistently returning the correct data type.

If readlines fails to open a file or read the contents, it will fail and
return an empty string. However f.readlines (the exepcted output)
produces a list of strings. This inconsistency causes some error
handling code to treat the output as a populated list of strings instead
of skipping over it (as the command failed).

Fix the issue by consistently returning the correct data type.

Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@citrix.com>
@github-actions
Copy link
Copy Markdown

Coverage

Python3 coverage comment from https://github.com/marketplace/actions/pytest-coverage-comment
FileStmtsMissCoverMissing
xen-bugtool157117189%89, 94–95, 416, 573, 744, 763, 828–829, 843, 863–864, 870–871, 876, 886, 907, 912–914, 917–918, 921–922, 964–966, 1107–1121, 1123–1132, 1199, 1325, 1327, 1361, 1379, 1382–1384, 1387–1391, 1394–1395, 1399–1401, 1536, 1564, 1579, 1587–1588, 1651–1653, 1655–1660, 1663–1667, 1671–1672, 1674, 1725–1726, 1728, 1730–1732, 1735–1736, 1738, 1740–1742, 1745–1746, 1748, 1750–1753, 1756–1766, 1769–1773, 1783, 1795, 1805, 1809, 1844–1846, 1960, 1999, 2059, 2102, 2105–2106, 2157, 2159–2162, 2165–2175, 2269–2271, 2274–2276, 2310–2312, 2352–2353, 2355–2356, 2368, 2386
tests
   conftest.py140100% 
tests/integration
   conftest.py230100% 
   namespace_container.py35197%114
   test_system_load.py180100% 
   test_xenserver_config.py150100% 
   utils.py65887%27, 57–60, 66, 86, 89
tests/unit
   conftest.py640100% 
   test_cmd_output.py290100% 
   test_dir_list.py110100% 
   test_dump_xapi_procs.py110100% 
   test_dump_xapi_rrds.py660100% 
   test_file_output.py200100% 
   test_filter_xapi_clusterd_db.py870100% 
   test_fs_funcs.py140100% 
   test_load_plugins.py230100% 
   test_main.py141199%250
   test_output.py770100% 
   test_process_output.py110100% 
   test_snmp.py150100% 
   test_xapidb_filter.py210100% 
TOTAL233118192% 

Tests Skipped Failures Errors Time
44 0 💤 0 ❌ 0 🔥 2.154s ⏱️

Comment thread xen-bugtool
except:
pass
return lines
def cmdline(pid):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not anything to do with this PR itself but it's pretty horrid to not have any whitespace between these method definitions.

@GeraldEV GeraldEV merged commit 44fde8b into master May 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants