Conversation
1. Force LANG=C/LANGUAGE=C on the grub-mkpasswd-pbkdf2 subprocess via QProcessEnvironment so its output stays English regardless of the system locale. 2. Extract the PBKDF2 hash with a regex (grub\.pbkdf2\.sha\d+\.\d+\.[0-9A-Fa-f]+\.[0-9A-Fa-f]+) instead of the fixed index fields.at(3), which returned "your" under non-Chinese locales and silently broke grub edit auth. 3. Add #include <QProcessEnvironment>. Log: Fixed grub boot menu edit auth not prompting for password under non-Chinese locales Influence: 1. Set grub edit auth password under C and zh_CN locales and verify the hash is written correctly. 2. Reboot and press 'e' in grub to confirm a password is required on affected arches (e.g. sw64). 3. Verify the existing zh_CN locale path still works after the change. fix: 强制 C locale 解析 grub pbkdf2 哈希 1. 通过 QProcessEnvironment 为 grub-mkpasswd-pbkdf2 子进程强制注入 LANG=C/LANGUAGE=C,固定输出为英文格式,消除对系统 locale 的依赖。 2. 哈希提取改用正则 (grub\.pbkdf2\.sha\d+\.\d+\.[0-9A-Fa-f]+\.[0-9A-Fa-f]+) 替代固定下标 fields.at(3),后者在非中文 locale 下取到 "your",导致 grub 编辑认证 被静默绕过。 3. 新增 #include <QProcessEnvironment>。 Log: 修复非中文 locale 下 grub 启动菜单编辑认证不弹出密码的问题 Influence: 1. 在 C 和 zh_CN locale 下设置 grub 编辑认证密码,确认哈希正确写入。 2. 重启在 grub 按 e 键确认受影响架构(如 sw64)需要密码。 3. 确认改动后原有 zh_CN locale 路径仍能正常工作。 PMS: BUG-371591
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideForces grub-mkpasswd-pbkdf2 to run under the C locale and replaces positional-field parsing with a regex-based parser to robustly extract PBKDF2 hashes from localized output, adding the necessary Qt includes and environment setup. Sequence diagram for updated passwdEncrypt PBKDF2 hash extractionsequenceDiagram
participant CommonInfoWork
participant QProcess_pbkdf2 as QProcess_pbkdf2
participant grub_mkpasswd_pbkdf2
CommonInfoWork->>QProcess_pbkdf2: setProgram("grub-mkpasswd-pbkdf2")
CommonInfoWork->>QProcess_pbkdf2: setProcessChannelMode(SeparateChannels)
CommonInfoWork->>QProcess_pbkdf2: setProcessEnvironment(env LANG=C LANGUAGE=C)
CommonInfoWork->>QProcess_pbkdf2: start()
QProcess_pbkdf2->>grub_mkpasswd_pbkdf2: execute under C locale
QProcess_pbkdf2-->>CommonInfoWork: waitForFinished()
CommonInfoWork->>QProcess_pbkdf2: readAllStandardOutput()
QProcess_pbkdf2-->>CommonInfoWork: PBKDF2 output
CommonInfoWork->>CommonInfoWork: pbkdf2HashRe.match(line)
alt match.hasMatch()
CommonInfoWork->>CommonInfoWork: captured(0) // grub.pbkdf2.shaX.iter.salt.hash
CommonInfoWork-->>CommonInfoWork: return hash
else no match
CommonInfoWork-->>CommonInfoWork: continue search or return empty
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
TAG Bot New tag: 6.1.104 |
|
TAG Bot New tag: 6.1.105 |
|
TAG Bot New tag: 6.1.106 |
|
TAG Bot New tag: 6.1.107 |
|
TAG Bot New tag: 6.1.109 |
修复 grub 启动菜单编辑认证在非中文 locale 下失效
问题
在非中文 locale(如 sw64 的 2500 基础镜像缺少中文翻译)下,
grub-mkpasswd-pbkdf2输出英文格式,passwdEncrypt()按固定字段下标fields.at(3)提取到"your"而非哈希,导致 grub 编辑认证被静默绕过——开关显示已开启但实际无密码保护。改动
grub-mkpasswd-pbkdf2子进程经QProcessEnvironment强制注入LANG=C/LANGUAGE=C,固定输出为英文格式,消除对系统 locale 的依赖。grub\.pbkdf2\.sha\d+\.\d+\.[0-9A-Fa-f]+\.[0-9A-Fa-f]+(captured(0)),替代固定下标fields.at(3),无论哈希落在第 4 字段(zh_CN)还是第 7 字段(C/en_US)都能正确提取,且自带格式校验。#include <QProcessEnvironment>。关联
审核 / 编译状态
Summary by Sourcery
Ensure grub PBKDF2 password hashing works reliably across locales by making hash extraction locale-independent.
Bug Fixes:
Enhancements: