CSV file columns become misaligned when devices change
Author: xu91102Created Sep 26, 2026Updated Sep 27, 2026
Labelsexport/csv
The CSV file exporter fixes its header on the first update, but writes later rows in their current field order. Adding or removing network interfaces can therefore change row length or put another interface's counters under an existing column.
Reproduction through Export.update, writing and reading a real temporary CSV file:
- First sample: z0 has bytes_recv=10.
- Second sample: a0 appears before z0, with counters 100 and 20.
- Third sample: only a0 remains, with counter 200.
Expected fixed-width rows and z0's counter column containing 10, 20, then an empty cell. Current develop instead writes extra fields and misattributes values. The separate --stdout-csv path was addressed in #3609; this report concerns --export csv in glances/exports/glances_csv.
Environment: Python 3.12.13, macOS, current develop. Prepared with Codex assistance.
Source: nicolargo/glances