change dropin filename restrictions

* do not match in .d/ subdirectories
* there are no restrictions on dropin config file base names
This commit is contained in:
Mark Oteiza 2016-05-01 13:06:14 -04:00
parent b004b3725a
commit 5cb70eb684
2 changed files with 7 additions and 3 deletions

View File

@ -220,8 +220,7 @@
;;;###autoload
(defconst systemd-dropin-autoload-regexp
(eval-when-compile
(rx "/systemd/" (+? anything) ".d/"
(+? (any "a-zA-Z0-9-_.@\\")) ".conf" string-end))
(rx "/systemd/" (+? anything) ".d/" (+? (not (any ?/))) ".conf" string-end))
"Regexp for dropin config file buffers in which to autoload `systemd-mode'.")
(defun systemd-get-value (start)

View File

@ -73,7 +73,12 @@ only if in an appropriately named parent directory."
(should (string-match-p re "/systemd/dog.socket.d/woof.conf"))
(should-not (string-match-p re "foobar.conf"))
(should-not (string-match-p re "/etc/modprobe.d/bonding.conf"))
(should-not (string-match-p re "/etc/systemd/system.conf"))))
(should-not (string-match-p re "/etc/systemd/system.conf"))
;; No restrictions on the base name
(should (string-match-p re ".config/systemd/user/foo.timer.d/კულტის.conf"))
(should (string-match-p re "/etc/systemd/user/c.service.d/a\nb.conf"))
;; Do not match inside a subdirectory of foobar.d/
(should-not (string-match-p re ".config/systemd/user/foo.timer.d/a/b.conf"))))
(provide 'systemd-tests)