James RichandJonathan Bennett 36201c8edb DMShell: give the shell TERM, a UTF-8 locale and a clean environment (#12054)
* DMShell: give the shell TERM=xterm-256color

The shell inherited meshtasticd's environment, which usually has no TERM
(systemd, containers) or the TERM of whatever terminal started the daemon.
Without one, clear prints "unknown terminal type", ctrl+L only feeds a
line, and pagers fall back to a dumb terminal. The environment is built
before forkpty and passed to execle, since the child of a threaded
process may only make async-signal-safe calls until exec.

* DMShell: give the shell a UTF-8 locale, and drop systemd's service variables

The shell's TERM is right now, but a systemd unit usually has no LANG either,
so the shell still landed in the C locale: ncurses drew its boxes in ASCII and
ls escaped any UTF-8 filename, with a correct terminal underneath. LANG is now
replaced the way TERM is, with C.UTF-8. The LC_* overrides are stripped along
with it, since an LC_ALL or a stale LC_CTYPE out of the daemon's environment
would win over LANG and leave the locale half-set. C.UTF-8 is built into glibc
and musl is UTF-8 throughout, so no locale has to be generated for it; where it
is absent anyway, setlocale() falls back to C, which is where the shell already
was.

The explicit environment is also the place to stop handing the shell systemd's
own service plumbing: NOTIFY_SOCKET, INVOCATION_ID, JOURNAL_STREAM and the
LISTEN_* socket-activation triple. NOTIFY_SOCKET is the one that does
something - a command run in the shell can answer sd_notify() on meshtasticd's
behalf and tell systemd the service is reloading or stopping. That is not an
escalation, since the session is already a root shell on the host, but none of
it describes the shell's own world.

The filter is a prefix table rather than a single strncmp, so all three
concerns read the same way.

* DMShell: keep the environment comments to a line each

The rationale for each stripped variable and for C.UTF-8 is in the
commit that added them.

---------

Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
2026-10-02 22:03:58 +00:00
2026-10-02 11:59:23 +00:00
2021-10-09 17:15:12 +11:00
2024-09-24 15:24:08 -05:00
2026-09-21 06:41:35 -05:00
2026-10-02 03:48:17 +00:00
2026-07-01 19:01:27 -05:00
2026-01-29 10:06:58 -06:00
2024-11-28 06:26:51 -06:00
2024-09-04 15:33:28 -07:00
2026-01-29 10:06:58 -06:00
2026-01-29 10:06:58 -06:00
2026-07-01 19:01:27 -05:00
2025-01-13 12:24:05 +08:00
2026-01-29 10:06:58 -06:00

Meshtastic Logo

Meshtastic Firmware

GitHub release downloads CI CLA assistant Fiscal Contributors Vercel

meshtastic%2Ffirmware | Trendshift

Overview

This repository contains the official device firmware for Meshtastic, an open-source LoRa mesh networking project designed for long-range, low-power communication without relying on internet or cellular infrastructure. The firmware supports various hardware platforms, including ESP32, nRF52, RP2040/RP2350, and Linux-based devices.

Meshtastic enables text messaging, location sharing, and telemetry over a decentralized mesh network, making it ideal for outdoor adventures, emergency preparedness, and remote operations.

Get Started

Join our community and help improve Meshtastic! 🚀

Stats

Alt

S
Description
No description provided
Readme GPL-3.0
317 MiB
0 Stars 1 Watchers 0 Forks
Languages
C++ 73.6%
C 21.7%
Python 2.6%
Shell 1.5%
Batchfile 0.2%
Other 0.2%