[OE-core] [PATCH v2 0/1] systemd: escape paths

Damien Riegel damien.riegel at savoirfairelinux.com
Fri Jun 22 18:43:01 UTC 2018


This is the second attempt at escaping properly the paths passed to
various shell scripts in the systemd class.

I tried various approch to this fix but I'm still not sure I have the
cleanest solution:

 - using inline ${@' '.join(shlex.quote(s) for s in d.getVar('SYSTEMD_SERVICE').split()} 
   doesn't work as shlex is not imported
 - creating a `def systemd_escape_paths(d)` function and calling it
   inline through ${@systemd_escape_paths(d)) has issues as well:
    - d.getVar('SYSTEMD_SERVICE') returned None (remember the variable
      is actually SYSTEMD_SERVICE_${PN})
    - d.expand('SYSTEMD_SERVICE') returns 'SYSTEMD_SERVICE'

The solution I came up with and that actually works is to inject
SYSTEMD_SERVICE_ESCAPED in the data store, and use that in the postinst
and prerm scripts.

Damien Riegel (1):
  systemd: escape paths passed to shell

 meta/classes/systemd.bbclass | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

-- 
2.17.1




More information about the Openembedded-core mailing list