summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/udev/udev-rules.c5
-rwxr-xr-xtest/units/testsuite-17.11.sh12
2 files changed, 15 insertions, 2 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 21223e0118..9d831a6004 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -1279,6 +1279,7 @@ int udev_rules_parse_file(UdevRules *rules, const char *filename) {
line_nr++;
line = skip_leading_chars(buf, NULL);
+ /* Lines beginning with '#' are ignored regardless of line continuation. */
if (line[0] == '#')
continue;
@@ -1320,6 +1321,10 @@ int udev_rules_parse_file(UdevRules *rules, const char *filename) {
ignore_line = false;
}
+ if (continuation)
+ log_line_error(rule_file, line_nr,
+ "Unexpected EOF after line continuation, line ignored");
+
rule_resolve_goto(rule_file);
return 0;
}
diff --git a/test/units/testsuite-17.11.sh b/test/units/testsuite-17.11.sh
index d68aa69d41..ed5da16c07 100755
--- a/test/units/testsuite-17.11.sh
+++ b/test/units/testsuite-17.11.sh
@@ -40,10 +40,18 @@ printf 'RUN+="/bin/true"%8175s\\\n' ' ' ' ' >sample.rules
echo >>sample.rules
udevadm verify sample.rules
-printf 'RUN+="/bin/true"%8176s\\\n' ' ' ' ' >sample.rules
+printf 'RUN+="/bin/true"%8176s\\\n #\n' ' ' ' ' >sample.rules
echo >>sample.rules
cat >exp <<'EOF'
-sample.rules:3 Line is too long, ignored
+sample.rules:5 Line is too long, ignored
+sample.rules: udev rules check failed
+EOF
+(! udevadm verify sample.rules 2>err)
+diff exp err
+
+printf '\\\n' >sample.rules
+cat >exp <<'EOF'
+sample.rules:1 Unexpected EOF after line continuation, line ignored
sample.rules: udev rules check failed
EOF
(! udevadm verify sample.rules 2>err)