You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
proot-rs is currently not aware of the / at the end of the path during path translation. This causes the behavior of ls to be inconsistent with that on host.
inside guestfs:
in hostfs:
This issue and #40 are both related to handling trailing slash
The text was updated successfully, but these errors were encountered:
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.
```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
proot-rs is currently not aware of the / at the end of the path during path translation. This causes the behavior of ls to be inconsistent with that on host.
inside guestfs:
in hostfs:
This issue and #40 are both related to handling trailing slash
The text was updated successfully, but these errors were encountered: