Fix for intermittent exception while parsing Xrandr modes #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Observed that Xrandr occasionally appends a few lines to the output, resulting in a runtime exception during mode parsing.
Can't reproduce the condition reliably, but seems to have something to do with disconnection/reconnection. Once I do get into this state, the exception is repeatable.
Excerpt below from last time the condition occurred (see final 3 lines):
DP-4 connected 3840x2160+0+0 (normal left inverted right x axis y axis)
600mm x 340mm
3840x2160 60.00*+ 30.00
2560x1440 59.95
1920x1080 60.00 59.94
1600x900 60.00
1280x1024 60.02
1280x800 59.81
1280x720 60.00 59.94
1152x864 59.96
1024x768 60.00
800x600 60.32
720x480 59.94
640x480 59.94 59.93
3840x2160 (0x2ca) 297.000MHz +HSync +VSync
h: width 3840 start 4016 end 4104 total 4400 skew 0 clock 67.50KHz
v: height 2160 start 2168 end 2178 total 2250 clock 30.00Hz
This is probably obscure enough to ignore, but think the fix has no negative implications. The original implementation had a smaller footprint (about 3 lines) but involved applying the regex twice, which offended my inner anal-retentive (I mostly do embedded C these days).
The issue occurs intermittently running arch linux on a 2013 macbook pro running nvidia drivers 375.20, libxrandr 1.5.1 with a 27" LG external display