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

lstat with bytes file name fails #517

Closed
sagi-z opened this issue Feb 13, 2020 · 3 comments
Closed

lstat with bytes file name fails #517

sagi-z opened this issue Feb 13, 2020 · 3 comments
Labels

Comments

@sagi-z
Copy link

sagi-z commented Feb 13, 2020

Describe the bug
Using dulwich for git access, and it is using byte strings to access files. This normally works on python. Not working with pyfakefs.

How To Reproduce

from pyfakefs import fake_filesystem
filesystem = fake_filesystem.FakeFilesystem()
os_module = fake_filesystem.FakeOsModule(filesystem)
filesystem.create_file('/delme')
os_module.stat('/delme')  # works
os_module.stat(b'/delme')  # works
os_module.lstat('/delme')  # works
os_module.lstat(b'/delme')  # fails
FileNotFoundError: [Errno 2] No such file or directory in the fake filesystem: b'/delme'

Your enviroment
Please run the following and paste the output.

python -c "import platform; print(platform.platform())"
python -c "import sys; print('Python', sys.version)"
python -c "from pyfakefs.fake_filesystem import __version__; print('pyfakefs', __version__)"

Linux-4.15.0-76-generic-x86_64-with-debian-buster-sid
Python 3.7.3 (default, Nov 21 2019, 15:51:40)
[GCC 7.4.0]
pyfakefs 3.7.1

@mrbean-bremen
Copy link
Member

Good catch - thanks!

@mrbean-bremen
Copy link
Member

see also #325

@mrbean-bremen
Copy link
Member

Ok, this one will take a bit longer - byte string handling is not implemented consistently at the moment, so this needs some thinking through and some restructuring. While it would be easy to fix this concrete problem, there will be similar problems with byte strings in other use cases.

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

No branches or pull requests

2 participants