Konrad, 2026-11-13: "panel fehlt, top leiste is lila", the network settings "zu rudimentaer, keine ip config, kein dns", the global menu only while a program that has one is in front. The bar (and the launcher, the drop-down terminal, the login items) came from Xsession.d, before dtsession had loaded the session's resources and the colour server: dtbar took *background from ~/.Xdefaults (#6e1e7d, the user's base16 theme; dtbar PID 1270788 started before dtsession 1270795). Restarting dtbar in the running session gave the palette's colours. Now dtsession runs sys.sessionetc -- the first of CDE_CONFIGURATION_TOP/config and CDE_INSTALLATION_TOP/config, as sys.session is found -- before the user's sessionetc (SmRestore.c, StartEtc); it sources config/sessionetc.d, where 0080.dtlaunch, 0085.dtdropdown, 0090.dtbar and 0095.loginitems moved. The bar takes colour set 5, the programs' background, not set 6 of a menu bar (Dtbar*secondaryColorSetId: 5; measured #c6b2a8 with Default.dp). dtwm publishes the focused client as _NET_ACTIVE_WINDOW (EWMH, WmEwmh.c SetNetActiveWindow from SetKeyboardFocus and where the focus is dropped); dtbar shows a program's menus only while the active window is the menus' owner, a dialog of it (WM_TRANSIENT_FOR) or a window of the same program (WM_CLIENT_LEADER). Measured on Xvfb with dtwm, dtbar, dtpad and xterm, clicking: dtpad -> its menus, xterm -> M only, dtpad -> its menus again. Network (dtsystemsettings/network.c, docs/reference/netconfig.txt): Show: Network Status (a light and a sentence per card, Configure...) or one card with the tabs TCP/IP (Using DHCP, with manual address, Manually, Off; address, mask, router, DHCP client ID, Renew DHCP Lease; IPv6), DNS (servers, search domains, what resolv.conf has now), Wi-Fi and Ethernet; the lock and Apply Now as Accounts. McdeSys mcde_sys_net_config, _configure, _renew (replacing mcde_sys_net_dhcp, which was declared and implemented nowhere): NetBSD one block per interface in dhcpcd.conf, as ifconfig.if(5) recommends, sysinst's static address in ifconfig.IF read and moved there, applied with dhcpcd -n IF (cross-compiled with the tree's x86_64--netbsd-gcc, not run); Linux the NetworkManager profile (nmcli). mcde_sys_interfaces took the last IPv4 address (the secondary one), now the first. Measured on this host, read only: the pane shows the three cards, 172.20.10.2/28 by DHCP, router 172.20.10.1, DNS 1.1.1.1, MAC, MTU 1500; test_sysinfo (new checks: settings read, 300.1.2.3 refused) exit 0. Nothing was applied on the development host. From the review of 2026-11-12's commits: libDtTerm links libMcdeSound (977a7347c made the bell call McdeSoundEvent; dtcodegen did not link); the PLIST lacked dtphoto, dtpaint, dttoolbox, mcdesoundd, libMcdeSound, their data and the sound themes (51 entries, from the installed tree); mcdesoundd was started by nothing (sessionetc.d/0075.mcdesoundd) and took the selection from a running server; dttoolbox kept only the first line of the Selected menu and rebuilt it every 500 ms, and NewMenu returned an uninitialised pointer past 64 menus. Built and installed with make mcde-host MCDE_DIRS=install, exit 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
214 lines
6.5 KiB
C
214 lines
6.5 KiB
C
/*
|
|
* test_sysinfo.c -- McdeSys: mcde_sys_info on this computer (make check)
|
|
*
|
|
* Copyright (c) 2026 The Makronix project. GNU LGPL 2.0 or later, as CDE.
|
|
*
|
|
* The values differ from computer to computer; what must hold everywhere is
|
|
* checked, and everything is printed for a look by hand.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
#include <Mcde/McdeSys.h>
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
McdeSysInfo i;
|
|
int failures = 0;
|
|
|
|
if (mcde_sys_info(&i) != MCDE_SYS_OK) {
|
|
printf("FAIL mcde_sys_info: %s\n", mcde_sys_error());
|
|
return 1;
|
|
}
|
|
printf("backend %s\nsystem %s %s\nkernel %s\nmodel %s\n"
|
|
"cpu %s (%d)\nmemory %llu MB\ndisk %s, %llu of %llu MB free\n"
|
|
"hostname %s\n", mcde_sys_backend(), i.system, i.version, i.kernel,
|
|
i.model, i.cpu, i.cpus, i.memory >> 20, i.disk, i.diskFree >> 20,
|
|
i.diskSize >> 20, i.hostname);
|
|
if (i.system[0] == '\0' || i.kernel[0] == '\0') {
|
|
printf("FAIL no system name\n");
|
|
failures++;
|
|
}
|
|
if (i.cpus < 1 || i.memory == 0 || i.diskSize == 0) {
|
|
printf("FAIL no processors, memory or disk\n");
|
|
failures++;
|
|
}
|
|
if (i.diskFree > i.diskSize) {
|
|
printf("FAIL more free than there is\n");
|
|
failures++;
|
|
}
|
|
{
|
|
McdeSysInterface ifs[16];
|
|
McdeSysBluetooth bt;
|
|
int n, k, vol = -1, muted = -1;
|
|
|
|
/* only read here: a test does not change the computer */
|
|
n = mcde_sys_interfaces(ifs, 16);
|
|
if (n < 0) {
|
|
printf("FAIL mcde_sys_interfaces: %s\n", mcde_sys_error());
|
|
failures++;
|
|
}
|
|
for (k = 0; k < n; k++)
|
|
printf("net %s %s %s %s%s%s\n", ifs[k].name,
|
|
ifs[k].kind == MCDE_NET_WIFI ? "wifi" :
|
|
ifs[k].kind == MCDE_NET_WIRED ? "wired" : "other",
|
|
ifs[k].up ? "up" : "down", ifs[k].address,
|
|
ifs[k].ssid[0] != '\0' ? " ssid " : "", ifs[k].ssid);
|
|
/* the settings of each card, read; and a nonsense address that
|
|
* must be refused before anything is written */
|
|
for (k = 0; k < n; k++) {
|
|
static const char *const m4[] = { "dhcp",
|
|
"dhcp+manual", "manual", "off" };
|
|
McdeSysNetConfig c, bad;
|
|
int r;
|
|
|
|
if (ifs[k].kind == MCDE_NET_OTHER)
|
|
continue;
|
|
r = mcde_sys_net_config(ifs[k].name, &c);
|
|
printf("netcfg %s %s %s/%s router %s now %s/%s via %s "
|
|
"dns %d mac %s mtu %d%s%s\n", ifs[k].name,
|
|
(unsigned) c.ipv4 < 4 ? m4[c.ipv4] : "?",
|
|
c.address, c.netmask, c.router, c.cur_address,
|
|
c.cur_netmask, c.cur_router, c.ncur_dns, c.mac,
|
|
c.mtu, r == MCDE_SYS_OK ? "" : " -- ",
|
|
r == MCDE_SYS_OK ? "" : mcde_sys_error());
|
|
if ((unsigned) c.ipv4 > MCDE_IPV4_OFF ||
|
|
(c.cur_address[0] != '\0' && c.cur_netmask[0] ==
|
|
'\0')) {
|
|
printf("FAIL netcfg %s\n", ifs[k].name);
|
|
failures++;
|
|
}
|
|
bad = c;
|
|
bad.ipv4 = MCDE_IPV4_MANUAL;
|
|
snprintf(bad.address, sizeof bad.address, "300.1.2.3");
|
|
if (mcde_sys_net_configure(ifs[k].name, &bad) ==
|
|
MCDE_SYS_OK) {
|
|
printf("FAIL 300.1.2.3 taken\n");
|
|
failures++;
|
|
}
|
|
}
|
|
if (mcde_sys_volume_get(&vol, &muted) == MCDE_SYS_OK) {
|
|
printf("volume %d%%%s\n", vol, muted ? " muted" : "");
|
|
if (vol < 0 || vol > 150) {
|
|
printf("FAIL volume out of range\n");
|
|
failures++;
|
|
}
|
|
} else
|
|
printf("volume (%s)\n", mcde_sys_error());
|
|
if (mcde_sys_bluetooth(&bt) == MCDE_SYS_OK)
|
|
printf("bluetooth %s%s%s\n", bt.present ? bt.name : "none",
|
|
bt.present ? " " : "", bt.present ?
|
|
(bt.on ? "on" : "off") : "");
|
|
/* the Wi-Fi networks in reach, read only */
|
|
for (k = 0; k < n; k++)
|
|
if (ifs[k].kind == MCDE_NET_WIFI) {
|
|
McdeSysWifi nets[64];
|
|
int nn = mcde_sys_wifi_scan(ifs[k].name, nets, 64);
|
|
|
|
printf("wifi %s: %d networks%s%s\n",
|
|
ifs[k].name, nn, nn < 0 ? ", " : "",
|
|
nn < 0 ? mcde_sys_error() : "");
|
|
if (nn > 0)
|
|
printf(" first: %s, %d%%%s\n",
|
|
nets[0].ssid, nets[0].signal,
|
|
nets[0].secured ? ", secured" : "");
|
|
}
|
|
/* the sharing services, read only */
|
|
{
|
|
static const char *const names[MCDE_SHARE_COUNT] = {
|
|
"ssh", "smb", "nfs", "afp", "appletalk" };
|
|
int s;
|
|
|
|
for (s = 0; s < MCDE_SHARE_COUNT; s++) {
|
|
McdeSysServiceState st;
|
|
|
|
if (mcde_sys_service_state((McdeSysShareService) s,
|
|
&st) != MCDE_SYS_OK) {
|
|
printf("FAIL service %s: %s\n", names[s],
|
|
mcde_sys_error());
|
|
failures++;
|
|
continue;
|
|
}
|
|
printf("share %-9s installed %d enabled %d "
|
|
"running %d\n", names[s], st.installed,
|
|
st.enabled, st.running);
|
|
}
|
|
}
|
|
{
|
|
static char zones[600][MCDE_SYS_ZONE_LEN];
|
|
char zone[MCDE_SYS_ZONE_LEN];
|
|
int nz = mcde_sys_timezones(zones, 600);
|
|
|
|
(void) mcde_sys_timezone_get(zone, sizeof zone);
|
|
printf("zone %s, %d zones offered\n", zone, nz);
|
|
if (nz < 2) {
|
|
printf("FAIL no list of time zones\n");
|
|
failures++;
|
|
}
|
|
/* a bad name is refused before anything is touched */
|
|
if (mcde_sys_timezone_set("../../etc/passwd") !=
|
|
MCDE_SYS_EINVAL) {
|
|
printf("FAIL a bad zone name was taken\n");
|
|
failures++;
|
|
}
|
|
}
|
|
{
|
|
McdeSysBattery b;
|
|
|
|
if (mcde_sys_battery(&b) == MCDE_SYS_OK) {
|
|
if (b.present)
|
|
printf("battery %d%%%s%s, %d min\n",
|
|
b.percent, b.charging ?
|
|
" charging" : "", b.ac ? " ac" : "",
|
|
b.minutes);
|
|
else
|
|
printf("battery none%s\n",
|
|
b.ac ? " ac" : "");
|
|
if (b.percent < 0 || b.percent > 100) {
|
|
printf("FAIL battery out of range\n");
|
|
failures++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
{
|
|
McdeSysUser users[64], bad;
|
|
McdeSysUpdate up;
|
|
int n, k;
|
|
|
|
n = mcde_sys_users(users, 64);
|
|
for (k = 0; k < n; k++)
|
|
printf("user %s (%s) uid %d%s\n", users[k].login,
|
|
users[k].fullname, (int) users[k].uid,
|
|
users[k].admin ? " admin" : "");
|
|
/* refused before anything is run: a bad name, and -- not as
|
|
* root -- a good one */
|
|
memset(&bad, 0, sizeof bad);
|
|
snprintf(bad.login, sizeof bad.login, "Bad Name");
|
|
if (mcde_sys_user_add(&bad, NULL) != MCDE_SYS_EINVAL) {
|
|
printf("FAIL a bad login was not refused\n");
|
|
failures++;
|
|
}
|
|
snprintf(bad.login, sizeof bad.login, "mcdetest");
|
|
if (geteuid() != 0 &&
|
|
mcde_sys_user_add(&bad, NULL) != MCDE_SYS_EPERM) {
|
|
printf("FAIL adding without root was not refused\n");
|
|
failures++;
|
|
}
|
|
if (mcde_sys_update_check(&up) == MCDE_SYS_OK)
|
|
printf("update running %s, available %s, packages %d, "
|
|
"source %s%s%s\n", up.current, up.available[0] != '\0'
|
|
? up.available : "-", up.packages, up.source[0] != '\0'
|
|
? up.source : "-", up.note[0] != '\0' ? "; " : "",
|
|
up.note);
|
|
else
|
|
printf("update (%s)\n", mcde_sys_error());
|
|
}
|
|
if (failures == 0)
|
|
printf("PASS test_sysinfo\n");
|
|
return failures != 0;
|
|
}
|