Shepherd does not support UTF-8 in the log output

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Tomas Volf
Owner
unassigned
Submitted by
Tomas Volf
Severity
normal

Debbugs page

Tomas Volf wrote 4 weeks ago
(address . bug-guix@gnu.org)
87ikpeafpz.fsf@wolfsden.cz
Hi :)

Shepherd does not seem to support UTF-8 output (Japanese in my case) in
the log output. I noticed the issue with timers, but can be reproduced
with transient as well:

Toggle snippet (20 lines)
$ herd spawn transient -- $(which sh) -c 'echo "猫"'
Spawning transient service for ("/run/current-system/profile/bin/sh" "-c" "echo \"???\"").
Service user-homes has been started.
Starting service transient-252...
Service transient-252 started.
Service transient-252 running with value #<<process> id: 1314 command: ("/run/current-system/profile/bin/sh" "-c" "echo \"???\"")>.
Service transient-252 has been started.
$ tail -f /var/log/messages
Feb 12 23:43:31 localhost shepherd[1]: Service user-homes has been started.
Feb 12 23:43:31 localhost shepherd[1]: Service user-homes started.
Feb 12 23:43:31 localhost shepherd[1]: Service user-homes running with value #t.
Feb 12 23:43:31 localhost shepherd[1]: Starting service transient-252...
Feb 12 23:43:31 localhost shepherd[1]: Service transient-252 started.
Feb 12 23:43:31 localhost shepherd[1]: Service transient-252 running with value #<<process> id: 1314 command: ("/run/current-system/profile/bin/sh" "-c" "echo \"???\"")>.
Feb 12 23:43:31 localhost shepherd[1]: Service transient-252 has been started.
Feb 12 23:43:31 localhost shepherd[1]: sh[1314] ???
Feb 12 23:43:31 localhost shepherd[1]: Service transient-252 has been disabled.
Feb 12 23:43:31 localhost shepherd[1]: Transient service transient-252 terminated, now unregistered.

Notice the `???' in output from both commands. Neither the `herd spawn'
output nor the /var/log/message contain correct Japanese character.

Have a nice day,
Tomas

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
Ludovic Courtès wrote 4 weeks ago
(name . Tomas Volf)(address . ~@wolfsden.cz)(address . 76244@debbugs.gnu.org)
87y0ya2mza.fsf@gnu.org
Hi,

Tomas Volf <~@wolfsden.cz> skribis:

Toggle quote (3 lines)
> $ herd spawn transient -- $(which sh) -c 'echo "猫"'
> Spawning transient service for ("/run/current-system/profile/bin/sh" "-c" "echo \"???\"").

Actually, it’s not logging, it’s the command itself that’s not
interpreted as UTF-8:

Toggle snippet (28 lines)
$ cat /tmp/t.sh
#!/bin/sh
echo "猫"
$ sudo herd spawn transient /tmp/t.sh
Spawning transient service for ("/tmp/t.sh").
Service user-homes has been started.
Starting service transient-375...
Service transient-375 started.
Service transient-375 running with value #<<process> id: 12840 command: ("/tmp/t.sh")>.
Service transient-375 has been started.
$ sudo herd status root
● Status of root:
It is running since Mon 10 Feb 2025 08:38:03 AM CET (3 days ago).
Main PID: 1
Command: /gnu/store/n87px1cazqkav83npg80ccp1n777j08s-guile-3.0.9/bin/guile --no-auto-compile /gnu/store/ci2c9iwqaa1zpr38wc58419m9yh8g798-shepherd-1.0.99-git/bin/shepherd --config /gnu/store/6c9xhch8vqddwl81qj28d7c7k6zwr4ms-shepherd.conf
It is enabled.
Provides: root shepherd
Custom actions: help status halt power-off kexec load eval unload reload daemonize restart
Will not be respawned.

Recent messages (use '-n' to view more or less):
2025-02-13 10:45:45 Service transient-375 running with value #<<process> id: 12840 command: ("/tmp/t.sh")>.
2025-02-13 10:45:45 Service transient-375 has been started.
2025-02-13 10:45:45 [t.sh] 猫
2025-02-13 10:45:45 Service transient-375 has been disabled.
2025-02-13 10:45:45 Transient service transient-375 terminated, now unregistered.

Well there’s also a problem with logging after all:

Toggle snippet (7 lines)
$ sudo tail -4 /var/log/messages
2025-02-13 10:45:45 localhost shepherd[1]: Service transient-375 has been started.
2025-02-13 10:45:45 localhost shepherd[1]: [t.sh] ?
2025-02-13 10:45:45 localhost shepherd[1]: Service transient-375 has been disabled.
2025-02-13 10:45:45 localhost shepherd[1]: Transient service transient-375 terminated, now unregistered.

I’m surprised because I’m pretty sure there are tests for that. I’ll
check later.

Ludo’.
Ludovic Courtès wrote 2 weeks ago
(name . Tomas Volf)(address . ~@wolfsden.cz)(address . 76244-done@debbugs.gnu.org)
877c5c3bsu.fsf@gnu.org
Fixed with dd193ad5b7af953c6e167bcfa002879e365e9a39 and
2b289dc34b0fd805e5aba7c964919620e8538ace.

Ludo’.
Closed
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 76244@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 76244
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help