Comments (2)
Fixed in commit 6db9b17
from proot-rs.
Document the steps to solve this problem:
-
The expected behavior:
-
Causes of this issue:
The reason is similar to the one of the previous issue.
When translating a path, proot-rs needs to create a new path by iterating over the components in the path (with
Path::components()
). However, the trailing slash is not shown in the results ofPath::components()
, with is a flaw in the implementation of the rust standard library.
rust-lang/rust#29008 (comment) -
According to POSIX
A pathname that contains at least one non- character and that ends with one or more trailing characters shall not be resolved successfully unless the last pathname component before the trailing characters names an existing directory or a directory entry that is to be created for a directory immediately after the pathname is resolved. Interfaces using pathname resolution may specify additional constraints1 when a pathname that does not name an existing directory contains at least one non- character and contains one or more trailing characters.
If a symbolic link is encountered during pathname resolution, the behavior shall depend on whether the pathname component is at the end of the pathname and on the function being performed. If all of the following are true, then pathname resolution is complete:
- This is the last pathname component of the pathname.
- The pathname has no trailing .
- The function is required to act on the symbolic link itself, or certain arguments direct that the function act on the symbolic link itself. -
Something maybe helpful: https://elixir.bootlin.com/linux/latest/source/fs/namei.c#L97
```rust /* [Feb-Apr 2000 AV] Complete rewrite. Rules for symlinks: * inside the path - always follow. * in the last component in creation/removal/renaming - never follow. * if LOOKUP_FOLLOW passed - follow. * if the pathname has trailing slashes - follow. * otherwise - don't follow. * (applied in that order). */ ```
-
Way to fix:
- Extend
PathBuf
to add two functions:fn with_trailing_slash(&self) -> bool;
: Check if this path contains trailing slash.try_add_trailing_slash(&mut self);
: Add a trailing slash ("/") to PathBuf.
- In path translation function
translate_absolute_path()
:- Add a appropriate slash to the end of translated path, so that trailing slash will not be eaten by proot-rs.
- In
enter()
function of each path related syscalls:- Add trailing slash as a consideration for whether to follow the last component
- Extend
from proot-rs.
Related Issues (20)
- Add support for Android platform and other architectures (e.g. arm, aarch64) HOT 9
- Rewrite loader in rust
- Failed to execute statically linked binaries HOT 2
- Binding a file to dir/file will result in a ENOTDIR: Not a directory HOT 2
- A call to unshare(CLONE_FS) from tracee may break the emulation of cwd. HOT 1
- Processing the result of getdents64()
- thread 'main' panicked at 'get stopped tracee' HOT 2
- Document Usage in README.md file
- Update Dockerfile with Android SDK HOT 8
- Publish static binaries for each GitHub Release HOT 10
- According to the proot manual, the --bind option should support the ! character to avoid dereference the guest location.
- docker-compose error: want driver overlay2, got devicemapper
- proot-rs --version doesn't show the version number HOT 1
- Generate a changelog
- Cannot run Debian in Termux HOT 1
- Generate man page
- Integrate SonarCloud
- Unable to run the ./proot-rs application in termux HOT 10
- compilation fails on riscv64
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proot-rs.