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

[Bug] sbin/replace-conf-from-env.sh word-splits the whole environment and corrupts iotdb-system.properties

未关闭 适合新手
#18,655 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
shell
领域
devops

调研方向

阅读 sbin/replace-conf-from-env.sh 的第 56-58 行附近内容,然后运行提供的 docker 复现,并检查 conf/iotdb-system.properties 的末尾。多词环境值不再被拆分成垃圾行、内部变量被跳过,并且 dn_rpc_address=0.0.0.0 能够可靠地保持应用时,修复就完成了。

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

描述

Search before asking
  • I searched in the issues and found nothing similar.
Version
  • IoTDB Version 2.0.11
  • Containerized deployment
Describe the bug and provide the minimal reproduce step

At container startup, replace-conf-from-env.sh regenerates iotdb-system.properties from the live environment. It iterates over env unquoted (for v in $(env), ~line 56), so any variable whose value contains spaces gets word-split into individual tokens. Every lowercase token then passes the key filter and is appended as a junk line, which shifts the script's delete-line-N / append-after-N sed math and can displace or drop legitimate overrides such as dn_rpc_address.

Minimal reproduce:

docker run --rm \
  -e "SOME_VAR=this is a multi word value" \
  -e "dn_rpc_address=0.0.0.0" \
  apache/iotdb:2.0.11-standalone

Then inspect the tail of the generated config inside the container:

tail conf/iotdb-system.properties
What did you expect to see?
  • Only real config keys patched from the environment.
  • Multi-word env values ignored (or handled intact), never split and appended as junk.
  • dn_rpc_address=0.0.0.0 reliably applied, so the DataNode binds 0.0.0.0 and accepts network connections.
What did you see instead?

The multi-word value was split and appended to iotdb-system.properties as separate lines, one word per line:

# dn_metric_reporter_list=
dn_metric_prometheus_reporter_port=9092
is
a
multi
word
value
_=/usr/bin/env
  • Multi-word env values split into word-tokens, each appended as a junk property line (log symptoms: stray append … lines and grep: Unmatched [ errors).
  • The trailing _=/usr/bin/env line shows the internal-var guard is dead (see "Anything else?").
  • The sed line math shifted by the junk, dropping the dn_rpc_address override so the DataNode fell back to the packaged default 127.0.0.1 and bound loopback-only.
  • Nondeterministic output: the same intended config produces different files depending on unrelated env values (and even env ordering).
Anything else?

Second bug in the same loop: the internal-var guard ! 2w$key_name =~ ^_ (~line 58) has a 2w typo, so the "skip internal vars" check never fires (e.g. append _=/usr/bin/env).

Suggested fix:

  • Iterate with env -0 + read -r -d '' (or equivalent) so values are never word-split.
  • Restrict patching to an allowlist of known keys (dn_* / cn_* / wal_*).
  • Fix the 2w typo in the internal-var guard.
Are you willing to submit a PR?
  • I'm willing to submit a PR!
主要语言
Java
星标
6.4k
派生
1.2k
平均合并
1 天 8 小时
30 天内合并 PR
129

贡献指南

打开贡献指南

从这里开始

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

apache/iotdb 的其他 Issue

查看 apache/iotdb 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

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