fix: 修复 term_title.awk 直接硬编码 \033 导致部分系统上解析出错的问题#68
Merged
Conversation
…t PEBKAC parser errors in awk
engigu
marked this pull request as ready for review
July 14, 2026 07:15
lloydzhou
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
描述
本 PR 修复了
term_title.awk在部分操作系统或定制的awk解释器/安全检测中,因直接硬编码\033和\007导致解析出错的问题。腾讯云服务器会出现报错
修复详情
1. 修复
term_title.awk中报PEBKAC error: invalid character '\033'的解析/安全检测拦截问题在
term_title.awk源码中,直接硬编码写入了\033(ESC)和\007(BEL)字符串序列。在某些特定的操作系统环境(例如
OpenCloudOS、部分企业容器环境)中,定制的awk解释器、安全检测代理或自定义脚本如果直接在传入的源代码字符串中检测到非转义的 ESC 等控制序列,会抛出fatal: PEBKAC error: invalid character '\033' in source code句法错误或者触发安全合规拦截。在
term_title.awk的END块中,使用sprintf("%c", 27)(ESC)和sprintf("%c", 7)(BEL)来动态生成这些控制字符,从而在awk源码中彻底避免直接硬编码包含\033和\007的字样,以增强脚本的平台兼容性并规避安全拦截。