Skip to content

test -r followed by echo $? gives exit code 1 even though exit status shows 0 #390

Description

@abrahamjoel

Expected Behavior

root@435d13901d69:/# test -r test.txt ###file exists
root@435d13901d69:/# echo $?
0

Actual Behavior

root@435d13901d69:/# test -r test.txt ###file exists
root@435d13901d69:/# echo $?
1

Steps to Reproduce the Problem

  1. touch test.txt
  2. test -r test.txt
  3. echo $?

Specifications

  • Proot/Care version: v5.3.1-99a84175
  • Kernel version: 6.1.112-122.189.amzn2023.x86_64
  • Host distribution: Alpine
  • Guest distribution: Ubuntu

Command Output

root@435d13901d69:/# test -r $(pwd)/test.txt
proot info: vpid 3: pid 384proot info: vpid 3: sysenter start: newfstatat(0x1, 0x7f640ab0444f, 0x7fffa731a2f0, 0x1000, 0x7f640ab48a70, 0x5000001565e0) = 0xffffffffffffffda [0x7fffa731a2e8,
0]
proot info: vpid 1: sysenter start: wait4(0xffffffff, 0x7fffa731a570, 0xa, 0x0, 0x7fffa731a660, 0x1) = 0xffffffffffffffda [0x7fffa731a548, 0]
proot info: vpid 3: **exited with status 0**
proot info: vpid 1: sysenter start: wait4(0xffffffff, 0x7fffa7319f10, 0xb, 0x0, 0x7fffa731a5e0, 0x0) = 0xffffffffffffffda [0x7fffa7319ee8, 0]
root@435d13901d69:/# echo $?
proot info: vpid 1: sysenter start: newfstatat(0x1, 0x7f640ab0444f, 0x7fffa731a6d0, 0x1000, 0x7f640aafd460, 0x7fffffff) = 0xffffffffffffffda [0x7fffa731a6c8, 0]
1
root@435d13901d69:/#

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions