patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: "Jakub Horký" <jakub.git@horky.net>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Sasha Levin" <sashal@kernel.org>,
	nsc@kernel.org, alexandre.f.demers@gmail.com,
	alexander.deucher@amd.com, linux-kbuild@vger.kernel.org
Subject: [PATCH AUTOSEL 6.17-5.4] kconfig/mconf: Initialize the default locale at startup
Date: Mon,  3 Nov 2025 13:02:32 -0500	[thread overview]
Message-ID: <20251103180246.4097432-19-sashal@kernel.org> (raw)
In-Reply-To: <20251103180246.4097432-1-sashal@kernel.org>

From: Jakub Horký <jakub.git@horky.net>

[ Upstream commit 3927c4a1084c48ef97f11281a0a43ecb2cb4d6f1 ]

Fix bug where make menuconfig doesn't initialize the default locale, which
causes ncurses menu borders to be displayed incorrectly (lqqqqk) in
UTF-8 terminals that don't support VT100 ACS by default, such as PuTTY.

Signed-off-by: Jakub Horký <jakub.git@horky.net>
Link: https://patch.msgid.link/20251014154933.3990990-1-jakub.git@horky.net
[nathan: Alphabetize locale.h include]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

Based on my comprehensive analysis of this commit and the kernel
repository, here is my determination:

## **Backport Status: YES**

### Analysis Summary

**Tools Used:**
- Git history analysis (git log, git show, git branch)
- File examination (Read tool on mconf.c and nconf.c)
- Web search for ncurses locale initialization patterns
- Repository comparison across branches

**Key Findings:**

### 1. **Code Change Analysis**
The commit adds just 2 lines of code:
- `setlocale(LC_ALL, "");` in the main() function before init_dialog()
- `#include <locale.h>` header (alphabetically ordered)

This is placed at scripts/kconfig/mconf.c:932, immediately after signal
handler setup and before any ncurses initialization.

### 2. **Bug Impact Assessment**
- **Scope**: Affects `make menuconfig` display in UTF-8 terminals
  (PuTTY, and others that don't support VT100 ACS by default)
- **Symptom**: Menu borders appear as "lqqqqk" instead of proper box-
  drawing characters
- **User Impact**: Degrades usability for kernel developers/users
  configuring kernels in affected terminals
- **Severity**: Non-critical but user-visible cosmetic/usability issue

### 3. **Risk Analysis**
**Extremely Low Risk:**
- This is build-time tooling only - does NOT affect kernel runtime
  behavior
- Standard ncurses programming pattern (documented in ncurses best
  practices)
- No dependencies on other kernel subsystems
- setlocale() is a standard POSIX C library function with well-defined
  behavior
- Change is isolated to menuconfig tool's main() function

### 4. **Companion Commit Evidence**
Critical finding: The companion fix for nconfig (commit 43c2931a95e6b)
**has already been backported** to 6.17 stable as commit 707f0e1262828,
signed-off by Sasha Levin on Nov 2, 2025. Both fixes address the
**identical issue** in parallel tools (mconf vs nconf).

**Inconsistency**: Having nconf fixed but not mconf creates an asymmetry
where `make nconfig` displays correctly but `make menuconfig` still has
broken borders.

### 5. **Backport Precedent**
Found evidence of similar kconfig/scripts fixes being backported:
- "kconfig: nconf: Ensure null termination where strncpy is used"
  (multiple stable backports)
- Other build system fixes when they affect user-visible behavior

### 6. **Stable Tree Compliance**
Checking against stable kernel rules:
- ✅ **Bug fix**: Yes - fixes incorrect display behavior
- ✅ **Important**: Yes - affects common developer workflow
- ✅ **Small change**: Yes - only 2 lines + include
- ✅ **Low risk**: Yes - build tooling only, standard pattern
- ✅ **Self-contained**: Yes - no dependencies
- ❌ **Security fix**: No
- ❌ **Regression fix**: No - longstanding bug
- ⚠️ **Stable tag**: No explicit "Cc: stable@vger.kernel.org" in
  original commit

### 7. **Backport Status**
The mconf fix has already been **prepared for backport** as commit
9ee168ca1754b (signed-off by Sasha Levin) and exists in
remotes/build/linus-next, but has not yet been merged into the 6.17
stable HEAD (7660ce69123ea).

### Recommendation Rationale:

**YES - This commit should be backported because:**

1. **Consistency**: The nconf companion fix is already backported; not
   backporting mconf creates an inconsistent user experience
2. **User Impact**: Improves usability for developers configuring
   kernels in common terminal emulators
3. **Zero Risk**: Build-time only, standard locale initialization, no
   runtime kernel impact
4. **Clean Application**: Should apply cleanly to all stable trees
   (verified against 6.17)
5. **Precedent**: Already prepared by stable maintainer (Sasha Levin
   signed-off 9ee168ca1754b)
6. **Simplicity**: Minimal 2-line change following best practices

**Stable kernel rule alignment:** This is a straightforward bug fix that
improves user-visible behavior with minimal code change and zero risk to
kernel runtime. While not critical, it meets the stable tree criteria of
being "important enough" to fix a common usability issue affecting
kernel developers.

 scripts/kconfig/mconf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 84ea9215c0a7e..b8b7bba84a651 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -12,6 +12,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
+#include <locale.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
@@ -931,6 +932,8 @@ int main(int ac, char **av)
 
 	signal(SIGINT, sig_handler);
 
+	setlocale(LC_ALL, "");
+
 	if (ac > 1 && strcmp(av[1], "-s") == 0) {
 		silent = 1;
 		/* Silence conf_read() until the real callback is set up */
-- 
2.51.0


  parent reply	other threads:[~2025-11-03 18:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-03 18:02 [PATCH AUTOSEL 6.17-5.10] net: tls: Cancel RX async resync request on rcd_delta overflow Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17] sched_ext: Allocate scx_kick_cpus_pnt_seqs lazily using kvzalloc() Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17] perf/x86/intel/uncore: Add uncore PMU support for Wildcat Lake Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17-6.12] net: tls: Change async resync helpers argument Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17-6.1] bcma: don't register devices disabled in OF Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17-6.12] blk-crypto: use BLK_STS_INVAL for alignment errors Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17] drm/msm: Fix pgtable prealloc error path Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17] ALSA: hda/realtek: Add quirk for Lenovo Yoga 7 2-in-1 14AKP10 Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17-6.1] cifs: fix typo in enable_gcm_256 module parameter Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17] smb: client: handle lack of IPC in dfs_cache_refresh() Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17] ASoC: rt721: fix prepare clock stop failed Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17] sched_ext: defer queue_balance_callback() until after ops.dispatch Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17-5.4] kconfig/nconf: Initialize the default locale at startup Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17-5.10] scsi: core: Fix a regression triggered by scsi_host_busy() Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17-5.15] selftests: net: use BASH for bareudp testing Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17] ALSA: hda/realtek: Fix mute led for HP Victus 15-fa1xxx (MB 8C2D) Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17-6.6] x86/microcode/AMD: Limit Entrysign signature checking to known generations Sasha Levin
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17] x86/CPU/AMD: Extend Zen6 model range Sasha Levin
2025-11-03 18:02 ` Sasha Levin [this message]
2025-11-03 18:02 ` [PATCH AUTOSEL 6.17] selftests: cachestat: Fix warning on declaration under label Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251103180246.4097432-19-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=alexander.deucher@amd.com \
    --cc=alexandre.f.demers@gmail.com \
    --cc=jakub.git@horky.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).