Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Add downstream integration test for hercules-ci/gitignore #245

Open
Profpatsch opened this issue Nov 27, 2019 · 3 comments
Open

Add downstream integration test for hercules-ci/gitignore #245

Profpatsch opened this issue Nov 27, 2019 · 3 comments
Labels
bug Something isn't working P2 major: an upcoming release tracking Tracking an issue in an upstream repo

Comments

@Profpatsch
Copy link
Collaborator

In hercules-ci/gitignore.nix#32 we noticed that using readDir (and searching for .gitignore files outside of the project directory) would watch way to many directories recursively. hercules-ci/gitignore.nix#33 should fix that, but we have to confirm.

@Profpatsch Profpatsch added bug Something isn't working P2 major: an upcoming release tracking Tracking an issue in an upstream repo labels Nov 27, 2019
@curiousleo
Copy link
Collaborator

More context: #211 (comment), #211 (comment)

@curiousleo
Copy link
Collaborator

I haven't been able to repro with a simplistic setup.

Setup

# default.nix
{ pkgs ? import <nixpkgs> {} }:
let
  gitignoreSrc = pkgs.fetchFromGitHub { 
    owner = "hercules-ci";
    repo = "gitignore";
    # rev = "f9e996052b5af4032fe6150bba4a6fe4f7b9d698";
    # sha256 = "sha256:0jrh5ghisaqdd0vldbywags20m2cxpkbbk5jjjmwaw0gr8nhsafv";
    rev = "f9525682432c116edfb390482dcc7f72ae3df64b"; # before "don't readDir the store"
    sha256 = "sha256:1iy502qi8ljj7c31vsjb75vnrbfkpc2pnfq85j33zvnr2li3kb4i";
  };
  inherit (import gitignoreSrc { inherit (pkgs) lib; }) gitignoreSource;
in
  pkgs.stdenv.mkDerivation {
    name = "hercules-gitignore-test";
    src = gitignoreSource ./.;
  }
# Makefile
install:
        echo 'Done'

and shell.nix is a soft link to default.nix.

As a sanity check, this succeeds:

$ nix-build .

Result

In neither case did lorri start watching / or /nix or /nix/store.

@curiousleo
Copy link
Collaborator

curiousleo commented Nov 28, 2019

straceing this, it looks to me like the readDirs stop at the Git repo boundary in either case, except for special files like $HOME/.gitconfig and $XDG_CONFIG_DIR/git/config.

If there is a $HOME/.gitconfig then lorri will watch its parent directory, $HOME, and that may already lead to watcher issues.

This does not explain why users were seeing / and /nix being watched by lorri. But it does point to a problem that is not solved by hercules-ci/gitignore.nix#32.


Aside: why does lorri watch the parent directory? From https://docs.rs/notify/5.0.0-pre.1/notify/trait.Watcher.html#tymethod.watch:

On some platforms, if the path is renamed or removed while being watched, behaviour may be unexpected. [...] If less surprising behaviour is wanted one may non-recursively watch the parent directory as well and manage related events.

Possibly related: #232

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working P2 major: an upcoming release tracking Tracking an issue in an upstream repo
Projects
None yet
Development

No branches or pull requests

2 participants