Subject: [shepherd] Lines not ending in #\newline are not logged
From: Tomas Volf <[email-masked]>
To: [email-masked]
Date: Thu, 13 Feb 2025 00:42:38 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi :)

When you execute the following code:

--8<---------------cut here---------------start------------->8---
herd spawn transient -- $(which sh) -c 'printf x'
--8<---------------cut here---------------end--------------->8---

The `x' is nowhere to be found in the log:

--8<---------------cut here---------------start------------->8---
Feb 12 23:39:12 localhost shepherd[1]: Starting service transient-249... 
Feb 12 23:39:12 localhost shepherd[1]: Service transient-249 started. 
Feb 12 23:39:12 localhost shepherd[1]: Service transient-249 running with value #<<process> id: 1262 command: ("/run/current-system/profile/bin/sh" "-c" "printf x")>. 
Feb 12 23:39:12 localhost shepherd[1]: Service transient-249 has been started. 
Feb 12 23:39:12 localhost shepherd[1]: Service transient-249 has been disabled. 
Feb 12 23:39:12 localhost shepherd[1]: Transient service transient-249 terminated, now unregistered. 
--8<---------------cut here---------------end--------------->8---

When you add an extra echo:

--8<---------------cut here---------------start------------->8---
herd spawn transient -- $(which sh) -c 'printf x; echo'
--8<---------------cut here---------------end--------------->8---

The `x' will be in the log:

--8<---------------cut here---------------start------------->8---
Feb 12 23:40:10 localhost shepherd[1]: Starting service transient-250... 
Feb 12 23:40:10 localhost shepherd[1]: Service transient-250 started. 
Feb 12 23:40:10 localhost shepherd[1]: Service transient-250 running with value #<<process> id: 1280 command: ("/run/current-system/profile/bin/sh" "-c" "printf x; echo")>. 
Feb 12 23:40:10 localhost shepherd[1]: Service transient-250 has been started. 
Feb 12 23:40:10 localhost shepherd[1]: sh[1280] x 
Feb 12 23:40:10 localhost shepherd[1]: Service transient-250 has been disabled. 
Feb 12 23:40:10 localhost shepherd[1]: Transient service transient-250 terminated, now unregistered. 
--8<---------------cut here---------------end--------------->8---

While the current behavior might be strictly speaking valid (Does
Shepherd actually specify that it only operates on text files?), having
the output in the log in both cases would be better in my opinion.

Have a nice day,
Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.