Skip to content

fix: correct Linux PENDIN termios constant#1835

Merged
gnodet merged 1 commit into
masterfrom
ci-issue-1833
Apr 25, 2026
Merged

fix: correct Linux PENDIN termios constant#1835
gnodet merged 1 commit into
masterfrom
ci-issue-1833

Conversation

@gnodet
Copy link
Copy Markdown
Member

@gnodet gnodet commented Apr 25, 2026

Summary

  • Fix PENDIN local flag constant: 0x0002000 (8192) → 0x0004000 (16384) per Linux asm-generic/termbits.h (octal 0040000)
  • Applied to both JNI (LinuxNativePty) and FFM (CLibrary) terminal providers

Impact

Currently low — JLine uses this constant symmetrically in toTermios() and toAttributes(), so the wrong value roundtrips correctly. However, interoperability with termios structs set by other programs (e.g., reading terminal state set by the shell) would silently lose this flag.

Closes #1833

Summary by CodeRabbit

  • Bug Fixes
    • Fixed incorrect terminal attribute flag configuration on Linux platforms, improving terminal behavior and compatibility.

The PENDIN local flag was 0x0002000 (8192) but should be 0x0004000
(16384) per Linux asm-generic/termbits.h (octal 0040000).

Fix applied to both JNI and FFM terminal providers.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 07bd8131-9275-4fb7-ad3b-189496779827

📥 Commits

Reviewing files that changed from the base of the PR and between da637d3 and 6178700.

📒 Files selected for processing (2)
  • terminal-ffm/src/main/java/org/jline/terminal/impl/ffm/CLibrary.java
  • terminal-jni/src/main/java/org/jline/terminal/impl/jni/linux/LinuxNativePty.java

📝 Walkthrough

Walkthrough

Two files are updated to correct the Linux PENDIN termios constant from an incorrect value (0x0002000) to the correct Linux kernel definition (0x0004000), fixing interoperability with externally-set terminal state.

Changes

Cohort / File(s) Summary
FFM Implementation
terminal-ffm/src/main/java/org/jline/terminal/impl/ffm/CLibrary.java
Updated Linux PENDIN local flag constant from 0x0002000 to 0x0004000 to align with actual kernel definition.
JNI Implementation
terminal-jni/src/main/java/org/jline/terminal/impl/jni/linux/LinuxNativePty.java
Updated Linux PENDIN local flag constant from 0x0002000 to 0x0004000 to align with actual kernel definition.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A bit was amiss, now it's right and precise,
The PENDIN flag hops to the kernel's device,
From 0x2000 to 0x4000 we leap,
Terminal states now their secrets can keep! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: correct Linux PENDIN termios constant' clearly and concisely describes the main change: correcting an incorrect Linux constant value from 0x0002000 to 0x0004000.
Linked Issues check ✅ Passed The PR successfully corrects the PENDIN constant from 0x0002000 to 0x0004000 in both JNI and FFM implementations, directly addressing all requirements in issue #1833.
Out of Scope Changes check ✅ Passed All changes are directly scoped to correcting the PENDIN constant across the two terminal provider implementations, with no unrelated modifications present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci-issue-1833

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

@gnodet gnodet merged commit 6f67142 into master Apr 25, 2026
15 checks passed
@gnodet gnodet deleted the ci-issue-1833 branch April 25, 2026 18:44
gnodet added a commit that referenced this pull request Apr 25, 2026
The TermiosMapping classes were extracted from pre-fix NativePty code
and still had the old bugs. Apply fixes from #1834, #1835, #1837, #1838:

- LinuxTermiosMapping: fix PENDIN constant, add IUCLC/OLCUC/XCASE/VSWTC wiring
- SolarisTermiosMapping: fix all octal-as-hex constants, add IUCLC/OLCUC/XCASE/VSWTC wiring
- FreeBsdTermiosMapping: fix PENDIN/NOFLSH constants, add VERASE2 wiring
@gnodet gnodet added the fix Bug fix label May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Linux PENDIN termios constant is incorrect

1 participant