2

I'm trying to reimplement part of git. I'm writing integration tests (in Rust) that check byte-for-byte compatibility between the output of my library and git. I currently run both on the same files, cleaning the .git directory in between, so that the files have the same inodes and other metadata. I'm running into flaky tests. For example, the ctime of an executable file seems to get set when the file is read.

I think this is a symptom of a larger problem, which is that I really want a completely reproducible filesystem. Does such a thing exist? Ideally I would get to pick exactly what stat returns for each file.

  • [FUSE](https://en.wikipedia.org/wiki/Filesystem_in_Userspace)? Reading shouldn't set the ctime though as far as I know – ilkkachu Apr 25 '21 at 20:10
  • 1
    @ilkkachu I'm basically asking if someone has implemented a nice program on top of something like fuse for this sort of problem. It's too low level for me to use right now. – Daniel Franklin Apr 25 '21 at 20:28
  • The `stat()` system call returns it's data as given to it by the filesystem driver. You would need to write a filesystem driver to do what you want, or find if there is a way to intercept or hook in to the system `stat()` calls. – C. M. Apr 26 '21 at 08:39
  • 1
    @C.M. Thanks. I'm asking if anyone's written a filesystem driver for testing that makes it easy to configure this sort of thing. – Daniel Franklin Apr 26 '21 at 10:51
  • Do some research. For example, [take a look at this question](https://unix.stackexchange.com/questions/508314/how-do-i-implement-a-file-system-driver-driver-in-linux) -- it may not be exactly what you seek, but it has several links to resources that may be helpful in finding what you are seeking. – C. M. Apr 26 '21 at 13:40
  • @C.M. There's no need to be rude. None of the links are new to me or useful. – Daniel Franklin Apr 26 '21 at 13:53
  • Being rude was _not_ my intention, only being direct and re-iterating the site's policies. My apologies that it came across as rude. The link I gave, I followed some of the links; I found some information regarding FUSE, and some samples. I found several tidbits on the Wiki link. Same with the ibm.com link. If you are only _looking_ for finished and polished software to do what you want, instead of _researching_ the subject, then you will not find anything useful. For that, you are better off posting to a work-for-hire site, hiring someone to write such a driver for you, and you pay them. – C. M. Apr 26 '21 at 15:00

0 Answers0