Package Details: wps-office-cn-bwrap 12.1.0.17900-2

Git Clone URL: https://aur.archlinux.org/wps-office-cn-bwrap.git (read-only, click to copy)
Package Base: wps-office-cn-bwrap
Description: Kingsoft Office (WPS Office) CN version - an office productivity suite
Upstream URL: https://linux.wps.cn
Keywords: bwrap cn kingsoft portable sandbox wps
Licenses: LicenseRef-WPS-EULA
Conflicts: kingsoft-office, wps-office, wps-office-cn
Provides: wps-office, wps-office-cn
Submitter: Kimiblock
Maintainer: Kimiblock (haakuya)
Last Packager: Kimiblock
Votes: 0
Popularity: 0.000000
First Submitted: 2025-02-20 14:09 (UTC)
Last Updated: 2025-05-28 05:14 (UTC)

Required by (20)

Sources (4)

Latest Comments

Kimiblock commented on 2025-06-04 02:12 (UTC)

@haakuya Valid point. Can you open a PR @ https://github.com/Kraftland/portable?

I'm out for a trip now and doesn't have a trusted computer around.

haakuya commented on 2025-06-03 15:08 (UTC)

我又研究了一下,wps-helper 中 launchTarget 中的 env 似乎是不必要的。

同时为了更好的处理参数解析以处理含空格文件,对 /usr/lib/portable/helper 做如下变更:

--- /usr/lib/portable/helper    2025-06-01 04:20:26.000000000 +0800
+++ helper  2025-06-03 22:59:36.632325566 +0800
@@ -31 +31,4 @@
-$@
+echo "Arg:$@"
+cmd=$1
+shift
+$cmd "$@"
@@ -59 +62 @@
-fi
\ 文件末尾没有换行符
+fi

wps-helper:

--- /bin/wps-helper 2025-05-30 14:46:22.938658935 +0800
+++ wps-helper  2025-06-03 22:52:19.805002176 +0800
@@ -6,3 +5,3 @@
-if [[ -f "$2" ]]; then
-   export bwBindPar="$2"
-fi
+export bwBindPaths="$HOME/Desktop:$HOME/Documents:$HOME/Downloads:$HOME/workspaces" # TODO 
+
+export bwBindPar="${@:2}"
@@ -10 +9 @@
-exec portable -- $3
+exec portable -- "${@:2}"

portable:

@@ -484 +501 @@
-           /usr/lib/portable/helper ${launchTarget} ${targetArgs}
+           /usr/lib/portable/helper "${launchTarget}" "${targetArgs}"

Kimiblock commented on 2025-06-03 09:54 (UTC)

感谢你指出的问题, 我将设置你为 Co-Maintainer

haakuya commented on 2025-06-03 09:27 (UTC) (edited on 2025-06-03 09:31 (UTC) by haakuya)

我看了脚本代码,我的理解是 bwBindPar 通过传递的文件名作为参数,使用 dev-bind 绑定特定文件(夹)来透过 bwarp,但是似乎有几个问题:

  1. 调用bwarp传递参数没有使用引号包裹,导致特殊字符被转译,且空格会被当做参数分隔符

    当使用 env PORTABLE_LOGGING=debug_portableConfig=cn.wps.wpp wps-helper /usr/lib/wps-office-cn-bwrap/wpp /some/dir/AA\ -\ BB.ppt

    能够看到

    [Info] Application argument interpreted as: /some/dir/AA - BB.ppt

    [Info] bwBindPar is --dev-bind /some/dir/AA - BB.ppt /some/dir/AA - BB.ppt

    bwrap: Unknown option -

  2. execApp()if [ -z ${bwBindPar} ] && [ -f ${bwBindPar} ] 应该是个逻辑错误,应该是 if [ -z ${bwBindPar} ] || [ ! -f ${bwBindPar} ]

  3. wps-helper 未处理 portable --actions share-files 等参数

  4. wps-helperexec portable -- $3 似乎没有传递参数给 portable ,或许修改为 exec portable -- ${@:2} 更合适

  5. 当已经有wps实例时,无法将新的文件绑定进沙盒,如果支持绑定多个目录,则更为方便

  6. targetArgs 是一个数组,传入 /usr/lib/portable/helper 似乎导致 wps 无法将含有空格的参数解析为文件名, /usr/lib/wps-office-cn-bwrap/wpp AA -\ BB.ppt 是可以成功打开文件的

我做了个 patch 增加了绑定目录的功能,并修复了一、二两个问题

--- /bin/portable   2025-06-01 04:20:26.000000000 +0800
+++ portable    2025-06-03 17:21:24.863474467 +0800
@@ -313 +313 @@
-   if [ -z ${bwBindPar} ] && [ -f ${bwBindPar} ]; then
+   if [[ -z "${bwBindPar}" || ! -e "${bwBindPar}" ]]; then
@@ -316 +315,0 @@
-       export bwBindPar="--dev-bind "${bwBindPar}" "${bwBindPar}""
@@ -318,0 +318,17 @@
+   if [[ -z "${bwBindPaths}" ]]; then
+       bwBindPaths=""
+   else
+       bwBindPathArr=()
+       IFS=':' read -ra _paths <<<"$bwBindPaths"
+       for path in "${_paths[@]}"; do
+           if [ -e "$path" ]; then
+               pecho debug "Binding path: ${path}"
+               bwBindPathArr+=("--bind" "$path" "$path")
+           else
+               pecho warn "Path ${path} does not exist, skipping"
+               continue
+           fi
+       done
+       pecho info "bwBindPath is ${bwBindPathArr[*]}"
+   fi
+
@@ -480 +496,2 @@
-       ${bwBindPar} \
+       ${bwBindPar:+--dev-bind "${bwBindPar}" "${bwBindPar}"} \
+       ${bwBindPathArr[*]} \

Kimiblock commented on 2025-05-30 14:22 (UTC)

bwBindPar accepts directories, and yes, we can use portable --actions share-files to select files to be put inside sandbox home/Shared

haakuya commented on 2025-05-30 08:56 (UTC)

目前脚本里的bwBindPar目前只能绑定某个文件,请问后续有无相关计划增加特定环境变量以支持绑定一些目录

Kimiblock commented on 2025-05-28 03:40 (UTC)

Done, but on GNOME the input method still doesn't work

mixout commented on 2025-05-27 16:23 (UTC)

@Kimiblock 好像是 wps-helper 里面的 QT_IM_MODULE=xim 把 portable 设置的覆盖了

Kimiblock commented on 2025-05-25 13:35 (UTC)

@mixout portable 应该会自动检测输入法并设置环境变量. 用 htop 找到有问题的进程按 e 看看有没有变量?

mixout commented on 2025-05-25 12:29 (UTC)

在 Wayland 下有些地方的输入法无法使用,可能需要 patch 一下启动脚本加上设置 QT_IM_MODULE=fcitx 的环境变量?