Bug 13535 - systemctl-native fails if service file contains non-unix newlines
Summary: systemctl-native fails if service file contains non-unix newlines
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Undecided normal
Target Milestone: ---
Assignee: Ross Burton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2019-09-17 12:54 UTC by f.bre
Modified: 2019-09-19 14:41 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description f.bre 2019-09-17 12:54:44 UTC
This is similar to Bug 9337.
I had a start-firmware.service file which contained a \r\n as newline instead of just \n at the end of the WantedBy line. The result was the service is not enabled in the image. It took me 2 days to find that out.

I think, the problem is in the recipes-core/systemd/systemd-systemctl/systemctl shell script. The "real" systemctl binary on the target system works properly.
Comment 1 f.bre 2019-09-17 13:08:50 UTC
The systemctl script in poky/meta/recipes-core/systemd/systemd-systemctl is a bit too complicated for me to understand. But a fast look let me tend that somewhere in the beginning it should do a tr '\r\n' '\n' or something of the whole .service file.
Comment 2 Ross Burton 2019-09-17 20:26:57 UTC
If you can replicate the problem easily by breaking your file again can you test that this patch against systemctl fixes it:

-                line = line.rstrip("\n")
+                line = line.strip()
Comment 3 Ross Burton 2019-09-17 20:30:46 UTC
Patch on the list