Skip to content

sadf: XML: Accept negative sensor values in XSD document - #465

Merged
sysstat merged 2 commits into
sysstat:masterfrom
sagaragas:fix/xsd-negative-sensor-values
Nov 15, 2026
Merged

sysstat merged 2 commits into
sysstat:masterfrom
sagaragas:fix/xsd-negative-sensor-values

Conversation

@sagaragas

@sagaragas sagaragas commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

sadf -x output doesn't validate against xml/sysstat.xsd when a sensor reports a negative temperature or voltage. degC, percent-temp, inV and percent-in use hundredth-type, whose pattern doesn't allow a sign.

That's what fails in CI on #464. Test 00069 reads the machine's real sensors, and test 00407 then validates the XML:

-:123: element temp: Schemas validity error : Element '{https://sysstat.github.io}temp', attribute 'degC': [facet 'pattern'] The value '-273.15' is not accepted by the pattern '\d*\.\d\d'.
-:124: element temp: Schemas validity error : Element '{https://sysstat.github.io}temp', attribute 'degC': [facet 'pattern'] The value '-0.15' is not accepted by the pattern '\d*\.\d\d'.
- fails to validate

I've switched the four attributes to negative-hundredth-type, like 4c01e42 did for the battery variation attribute. The DTD has CDATA for them, so it's fine as is.

The second commit adds test 00425, which validates a small XML sample with negative values, so CI covers this on any runner. I made the sample with sadf -x from a fake hwmon chip, since none of my sensors report a negative value.

Temperature and voltage input values may be negative. Their percentages
(percent-temp and percent-in) can be negative too, for example when the
value is below the minimum value of the sensor. So update XSD document
to accept negative values for attributes degC, percent-temp, inV and
percent-in.
Test 00407 only gets negative sensor values when the machine running
the tests has a sensor that reports one. Add an XML sample with
negative values for degC, percent-temp, inV and percent-in, and
validate it against the XSD document in test 00425.

The sample is "sadf -x -- -m TEMP,IN" output for a data file collected
with a fake hwmon chip.
@sysstat
sysstat merged commit d09924c into sysstat:master Nov 15, 2026
7 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.

2 participants