Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

add mockedFiles to directory listing commands #172

Description

@matthandlersux

when a script attempts to list items in a directory that has mockedFiles, we should intercept the syscalls responsible for that and include the mocked files in the response(s).

for example: in ruby, if i do Dir.glob("/foo/*") i get the following (truncated) debug output:

807: Open(filename: "/tmp/test.8MzdhLsx0kws/file") -> 11
807: Fcntl(fd: 11, cmd: F_SETFL) -> 0
807: Fstat(fd: 11) -> 0
807: Fstat(fd: 11) -> 0
807: Ioctl() -> ENOTTY: Not a typewriter
807: Read(fd: 11) -> 20
807: Read(fd: 11) -> 0
807: Close(fd: 11) -> 0
807: Lstat() -> 0
807: Lstat() -> 0
807: Lstat() -> 0
807: Open(filename: "/foo") -> 11
807: Fstat(fd: 11) -> 0
807: Getdents() -> 576
807: Getdents() -> 264
807: Getdents() -> 0
807: Close(fd: 11) -> 0
807: Rt_sigaction() -> 0
807: Rt_sigaction() -> 0
807: Close(fd: 8) -> 0
807: Close(fd: 10) -> 0
807: Munmap() -> 0

i believe Fstat and Getdents are the two calls we need to intercept in order to make this work.

Activity

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions