Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proot: ./path/path.c:546: compare_paths2: Assertion `length1 > 0' failed. #182

Open
zaoqi opened this issue Jul 18, 2019 · 7 comments
Open

Comments

@zaoqi
Copy link

zaoqi commented Jul 18, 2019

Steps to Reproduce the Problem

do not mkdir tmp

  1. fakechroot fakeroot chroot . ./proot/src/proot -R alpine-minirootfs-3.10.1-x86_64

Specifications

  • Proot/Care version: commit 803e54d
  • Kernel version: 4.19.56
  • Host distribution: manjaro
  • Guest distribution: alpine
@zaoqi
Copy link
Author

zaoqi commented Jul 18, 2019

if mkdir tmp

$ fakechroot fakeroot chroot . ./proot/src/proot -R alpine-minirootfs-3.10.1-x86_64
proot error: execve("/bin/sh"): No such file or directory
proot info: possible causes:
  * the program is a script but its interpreter (eg. /bin/sh) was not found;
  * the program is an ELF but its interpreter (eg. ld-linux.so) was not found;
  * the program is a foreign binary but qemu was not specified;
  * qemu does not work correctly (if specified);
  * the loader was not found or doesn't work.
fatal error: see `proot --help`.
proot error: can't chmod '/tmp/proot-22405-7CHcGd': No such file or directory
proot error: can't chdir to '/': No such file or directory

@oxr463
Copy link
Collaborator

oxr463 commented Jul 18, 2019

Interesting.. I'll look into it.

Thanks for providing such detailed debugging information!

@0pq76r
Copy link

0pq76r commented Mar 15, 2020

I had a similar issue. The problem is, that the detranslate_path function somehow is called with empty strings for path and/or t_referrer.

Also length1 and length2 are of type size_t, thus, unsigned integers and by the looks of it the case length1==0 is supposed to be handled in the if statement immediately after the assert.

There's probably a better way to fix it, but this works for me: 0pq76r/proot@7d7479c

@V6ser
Copy link

V6ser commented Jan 24, 2021

Still not fixed as of latest version.

@angelsl
Copy link

angelsl commented Jul 24, 2021

This is a bit tricky. At least one cause of this crash is when readlinkat is called with an empty string for the path, which is allowed: (see readlinkat(2))

Since Linux 2.6.39, pathname can be an empty string, in which case the call operates on the symbolic link referred to by dirfd (which should have been obtained using open(2) with the O_PATH and O_NOFOLLOW flags).

proot doesn't handle this case, and I'm not sure if simply making detranslate_path ignore an empty t_referrer is correct. In fact, I'm not sure if proot's readlinkat handling is otherwise correct at all.

@ruanformigoni
Copy link

ruanformigoni commented Mar 19, 2023

Hi, I'm also experiencing this issue:

proot: ./path/path.c:547: compare_paths2: Assertion `length2 > 0' failed.

This makes pacman fail in arch. It also makes wine GUI fail when running inside the new root.

Edit: The changes provided by @0pq76r fix both issues.

@alexhenrie
Copy link

I am having the same problem. Here is a Dockerfile that reproduces it:

FROM ubuntu:mantic

RUN apt-get update && apt-get install -y proot systemd

RUN proot dpkg-reconfigure systemd

docker build . fails with the message:

0.402 proot: ./path/path.c:541: compare_paths2: Assertion `length2 > 0' failed.

Is there a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants