apache / apache/arrow

[C++] LocalFileSystem cannot list Linux directory recursively when permission to subdirectory contents are denied

Open
#32,089 2 comments 0 reactions 0 assignees View on GitHub
Component: C++ good-second-issue Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

The following code to list my root directory fails:

 
```java

FileSelector file_selector;
file_selector.base_dir = "/";
file_selector.allow_not_found = true;
file_selector.recursive = true;
auto result = fs.GetFileInfo(file_selector);
```
The result.ok() value returns {}false{}, and then result.status().message() returns {}Cannot list directory '/var/run/wpa_supplicant'{}.

An examination of the /run directory (which /var/run symlinks to) shows:

 
```java

$ ls -al /run
drwxr-xr-x 35 root              root  1040 Jun  6 06:11 .
drwxr-xr-x 20 root              root  4096 May 20 12:42 ..
...
drwxr-x---  2 root              root    60 Jun  4 12:14 wpa_supplicant
```
And then attempting to list this directory reveals:

 
```java

$ ls -al /run/wpa_supplicant/
ls: cannot open directory '/run/wpa_supplicant/': Permission denied
```
 

As a user of LocalFileSystem, I should be able to list all of the files that I have access to.

 

 

**Environment**: Ubuntu 20.04 LTS
**Reporter**: [David Rauschenbach](https://issues.apache.org/jira/browse/ARROW-16753)
#### PRs and other links:
- [GitHub Pull Request #13435](https://github.com/apache/arrow/pull/13435)

**Note**: *This issue was originally created as [ARROW-16753](https://issues.apache.org/jira/browse/ARROW-16753). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

Contributor guide

Open the contributing guide

Research direction

Start with LocalFileSystem and the GetFileInfo call shown in the issue, then review pull request #13435 for prior work. Done should mean recursive listing continues past directories whose contents are inaccessible and still reports files the user can access.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.