AppImage / AppImage/type2-runtime

`OWD` is not set when `APPIMAGE_EXTRACT_AND_RUN=1`

Đang mở
#23 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C
Star
73
Fork
35
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

See https://github.com/lalten/rules_appimage/issues/156

To reproduce:
```
cd `mktemp -d`

echo 'bazel_dep(name="rules_appimage", version="1.8.0")' > MODULE.bazel

cat <<'EOF' >BUILD
load("@rules_appimage//appimage:appimage.bzl", "appimage")
sh_binary(
name = "test_sh",
srcs = ["test.sh"],
)
appimage(
name = "test.appimage",
binary = ":test_sh",
)
EOF

cat <<'EOF' >test.sh
#!/bin/bash
pwd
env | sort
EOF

chmod +x test.sh

bazel build //:test.appimage
```
I've attached the resulting test.appimage:
[test.appimage.tar.gz](https://github.com/AppImage/type2-runtime/files/14947147/test.appimage.tar.gz)

```
❯ env -i -- PATH="/bin" bazel-bin/test.appimage
/tmp/.mount_test.aIPOIGM/test_sh.runfiles/_main
APPDIR=/tmp/.mount_test.aIPOIGM
APPIMAGE=/home/user/.cache/bazel/_bazel_user/5f48ff965103b174f3c248651ebad24d/execroot/_main/bazel-out/k8-fastbuild/bin/test.appimage
ARGV0=bazel-bin/test.appimage
BUILD_WORKING_DIRECTORY=/home/user/repo
OLDPWD=/home/user/repo
OWD=/home/user/repo
PATH=/bin
PWD=/tmp/.mount_test.aIPOIGM/test_sh.runfiles/_main
RUNFILES_DIR=/tmp/.mount_test.aIPOIGM/test_sh.runfiles
SHLVL=1
TMPDIR=/tmp
_=/bin/env
```
```
❯ env -i -- PATH="/bin" APPIMAGE_EXTRACT_AND_RUN=1 bazel-bin/test.appimage
/tmp/appimage_extracted_065248ba50a9cbfc7dc25b7b2eaffc36/test_sh.runfiles/_main
APPDIR=/tmp/appimage_extracted_065248ba50a9cbfc7dc25b7b2eaffc36
APPIMAGE=/home/user/.cache/bazel/_bazel_user/5f48ff965103b174f3c248651ebad24d/execroot/_main/bazel-out/k8-fastbuild/bin/test.appimage
APPIMAGE_EXTRACT_AND_RUN=1
ARGV0=bazel-bin/test.appimage
BUILD_WORKING_DIRECTORY=
OLDPWD=/home/user/repo
PATH=/bin
PWD=/tmp/appimage_extracted_065248ba50a9cbfc7dc25b7b2eaffc36/test_sh.runfiles/_main
RUNFILES_DIR=/tmp/appimage_extracted_065248ba50a9cbfc7dc25b7b2eaffc36/test_sh.runfiles
SHLVL=1
TMPDIR=/tmp
_=/bin/env
```

you can see the `OWD` variable from https://github.com/AppImage/type2-runtime/blob/9594e2b1306a83b1020145f4e4e29c61065536a4/src/runtime/runtime.c#L1710 is set only when the appimage is mounted via fuse, but not when running with APPIMAGE_EXTRACT_AND_RUN=1.

It probably also makes sense to prefix the env var with APPIMAGE_ but that's a different issue.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.