Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

lmLog: "Server error occured" when log contains non-ASCII chars (offset counted in chars, seek in bytes)

未关闭
#294 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript, python
领域
backend, frontend

调研方向

Start in lmn_common/views.py at handle_api_log, which seeks by offset, and in lmn_common/resources/js/directives/lmlog.coffee, which sends offset=$scope.content.length. Decide on byte offsets end-to-end (binary read plus a response header the CoffeeScript client uses for the next offset) or the fallback errors='replace'. Reproduce with the two-line Python snippet from the issue, then verify the log view polls past an umlaut-heavy file without a 500.

由索引模型根据 Issue 内容生成。

描述

Description

While users are applied in List Management, the live log view polls
GET /api/lmn/log/tmp/sophomorix.log?offset=<n> every second. Sporadically
the WebUI shows "Server error occured. This is likely a bug." for this request.
The sophomorix run itself completes; only the log view breaks.

Cause

Frontend and backend use different units for offset:

  • lmn_common/resources/js/directives/lmlog.coffee sends
    offset=#{$scope.content.length}, which is the length in characters (JS string).
  • lmn_common/views.py → handle_api_log opens the file in text mode and calls
    f.seek(offset), which positions by bytes.

Each non-ASCII character (ä, ö, ü, ß in user names, ...) is 1 char but 2 bytes in
UTF-8, so the offset drifts by one byte per umlaut. When it lands inside a
multibyte sequence, f.read() raises UnicodeDecodeError and the endpoint returns 500.

Minimal reproduction:

open('t.log','w').write('Benutzer Müller angelegt\n')
f = open('t.log'); f.seek(11); f.read()
# UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbc in position 0

With multi-school setups the log easily grows to >1 MB with many umlauts
(we saw offset=1682314), so the error shows up on almost every run.

Environment

linuxmuster-webui7 7.3.40; code is unchanged on master / 7.3.46.

Possible fix

Use byte offsets consistently, e.g. read the file in binary mode and let the
frontend track the received byte length (e.g. via a response header), or at least
open(path, errors='replace') so a misaligned offset no longer causes a 500.

主要语言
HTML
星标
14
派生
9
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

linuxmuster/linuxmuster-webui7 的其他 Issue

查看 linuxmuster/linuxmuster-webui7 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。