[BUG] occ wrapper does not preserve arguments containing spaces

未關閉 適合新手
#552 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
75/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
bash, docker
領域
cli

研究方向

找到透過 bash -c 執行 php /app/www/public/occ 的 occ 包裝器,並檢查它如何傳遞引數。報告指出 $* 是引數拆分的原因,並建議在呼叫 OCC 時保留原始引數界線。當包含空格的值作為一個引數傳遞到 OCC 時,即為完成;該 issue 沒有指定測試或檔案。

由索引模型根據 Issue 內容生成。

描述

Is there an existing issue for this?
  • I have searched the existing issues
Current Behavior

The occ wrapper uses $* when passing arguments to php occ through bash -c:

sudo -u abc -s /bin/bash -c "php /app/www/public/occ $*"

This causes arguments containing spaces to lose their original argument boundaries when expanded and interpreted by the inner shell.

As a result, commands that pass a single argument containing spaces may behave incorrectly because the argument gets split into multiple arguments.

Expected Behavior

The wrapper should preserve the original argument boundaries, including arguments containing spaces, quotes, and special characters.

Using "$@" instead of $* would preserve the individual arguments. Ideally, the additional bash -c invocation should also be avoided.

For example:

sudo -u abc -- php /app/www/public/occ "$@"
Steps To Reproduce
  1. Run the LinuxServer Nextcloud container.
  2. Execute an OCC command with an argument containing spaces:
occ config:app:set myapp setting --value="hello world"
  1. Observe that the argument is split into multiple arguments when passed to the underlying OCC command.
  2. Compare with the expected behaviour, where hello world should be passed as a single argument.
Environment
- OS: debian trixie
- How docker service was installed: https://get.docker.com
CPU architecture

arm64

Docker creation
not relevant
Container logs
not relevant
主要語言
Dockerfile
星號
898
分支
143
PR 合併指標
30 天內沒有已合併 PR

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

linuxserver/docker-nextcloud 的其他 Issue

查看 linuxserver/docker-nextcloud 的全部 Issue

相似的 Issue

更多 CLI Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。