Bug 1153280 - fillup breaks on some multiline variables
Summary: fillup breaks on some multiline variables
Status: NEW
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Adam Majer
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-08 07:44 UTC by Jan Fajerski
Modified: 2021-05-12 17:33 UTC (History)
2 users (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: Yes
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Fajerski 2019-10-08 07:44:36 UTC
The prometheus node exporter takes cli arguments that can include regular expression strings. For example /etc/sysconfig/prometheus-node_exporter can have content like so:

ARGS="-collector.diskstats.ignored-devices=^(ram|loop|fd)\d+$ \
      -collector.filesystem.ignored-mount-points=^/(sys|proc|dev|run)($|/) \
      -collector.textfile.directory=/var/lib/prometheus/node-exporter"

The package https://build.opensuse.org/package/show/server:monitoring/golang-github-prometheus-node_exporter recently introduced the use of %fillup_only in its spec file. This however breaks existing sysconfig files.
This behaviour can be reproduced by only calling fillup. With the content as listed above in prometheus-node_exporter, a file prometheus-node_exporter.default with this content:

ARGS="foo"

Calling fillup prometheus-node_exporter prometheus-node_exporter.default prometheus-node_exporter.out produces

ARGS="-collector.diskstats.ignored-devices=^(ram|loop|fd)\d+$ \
Comment 1 Tim Serong 2019-10-08 08:18:14 UTC
Here's steps to reproduce:

# cat prometheus-node_exporter
ARGS="-collector.diskstats.ignored-devices=^(ram|loop|fd)\d+$ \
      -collector.filesystem.ignored-mount-points=^/(sys|proc|dev|run)($|/) \
      -collector.textfile.directory=/var/lib/prometheus/node-exporter"
# cat prometheus-node_exporter.default 
ARGS="foo"
# fillup prometheus-node_exporter prometheus-node_exporter.default \
      prometheus-node_exporter.broken
# cat prometheus-node_exporter.broken 
ARGS="-collector.diskstats.ignored-devices=^(ram|loop|fd)\d+$ \


I have no idea why, but if I remove the '-' character from the third line of prometheus-node_exporter, the problem goes away:

# cat prometheus-node_exporter
ARGS="-collector.diskstats.ignored-devices=^(ram|loop|fd)\d+$ \
      -collector.filesystem.ignored-mount-points=^/(sys|proc|dev|run)($|/) \
      collector.textfile.directory=/var/lib/prometheus/node-exporter"
# fillup prometheus-node_exporter prometheus-node_exporter.default prometheus-node_exporter.broken
# cat prometheus-node_exporter.broken 
ARGS="-collector.diskstats.ignored-devices=^(ram|loop|fd)\d+$ \
      -collector.filesystem.ignored-mount-points=^/(sys|proc|dev|run)($|/) \
      collector.textfile.directory=/var/lib/prometheus/node-exporter"

Something in that string must be confusing fillup's parser, I'm just surprised it's the '-' character.