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

Play apps with a bundled start script split JAVA_OPTS unquoted, breaking multi-word values

未关闭
#1,441 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
bash, go, java

调研方向

This is the start-script launch path for Play apps (bin/<name> from sbt-native-packager), not the buildpack javaexec path used when no start script exists. Trace how JAVA_OPTS is passed into that script versus the no-start-script branch (play.core.server.NettyServer). Done means multi-word JAVA_OPTS (e.g. a quoted cron -D) survive as tokens, likely via -J<flag> as the issue suggests, without relying on unquoted ${java_opts[@]}. Related context is cloudfoundry/java-buildpack#1435.

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

描述

Play apps packaged with a start script (bin/<name>, generated by sbt-native-packager, used whenever the app ships one — staged and dist Play 2.x builds) are launched directly via that script, not via the buildpack's shell-free javaexec launcher. javaexec is only used when no start script is present.

sbt-native-packager's own script template does:

if [[ "$JAVA_OPTS" != "" ]]; then
  java_opts="${JAVA_OPTS}"
fi
execRunner "$java_cmd" ${java_opts[@]} ...

${java_opts[@]} is unquoted, so $JAVA_OPTS is word-split on whitespace (and glob-expanded). A value containing embedded spaces, e.g. a quoted cron expression (-DcronExpr="0 */7 * * * *"), splits into separate bare words; a bare word like */7 with no leading - can be misread as the main class by java, causing Could not find or load main class *.7 and a crash loop.

Command substitution in the value cannot occur here (it's plain variable expansion, not re-parsed source) — this is a launch-correctness issue, pre-existing and independent of #1432/#1435's javaexec fix, which only covers the no-start-script branch (play.core.server.NettyServer invocation).

Possible fix: route the start-script branch through a safe tokenizer too, passing JAVA_OPTS tokens as -J<flag> arguments (the convention sbt-native-packager scripts already support for exactly this purpose) instead of relying on the script reading $JAVA_OPTS directly.

Found while investigating cloudfoundry/java-buildpack#1435.

主要语言
Go
星标
452
派生
2.5k
平均合并
1 天 2 小时
30 天内合并 PR
23

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

cloudfoundry/java-buildpack 的其他 Issue

查看 cloudfoundry/java-buildpack 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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