lix/src/libfetchers
jade 3e151d4d77 Revert "libfetchers: make attribute / URL query handling consistent"
This reverts commit 35eec921af.

Reason for revert: Regressed nix-eval-jobs, and it appears to be this change is buggy/missing a case. It just needs another pass.

Code causing the problem in n-e-j, when invoked with `nix-eval-jobs --flake '.#hydraJobs'`:

```
n-e-j/tests/assets » ../../build/src/nix-eval-jobs --meta --workers 1 --flake .#hydraJobs
warning: unknown setting 'trusted-users'
warning: `--gc-roots-dir' not specified
error: unsupported Git input attribute 'dir'
error: worker error: error: unsupported Git input attribute 'dir'
```

```
  nix::Value *vRoot = [&]() {
        if (args.flake) {
            auto [flakeRef, fragment, outputSpec] =
                nix::parseFlakeRefWithFragmentAndExtendedOutputsSpec(
                    args.releaseExpr, nix::absPath("."));
            nix::InstallableFlake flake{
                {}, state, std::move(flakeRef), fragment, outputSpec,
                {}, {},    args.lockFlags};

            return flake.toValue(*state).first;
        } else {
            return releaseExprTopLevelValue(*state, autoArgs, args);
        }
    }();
```

Inspecting the program behaviour reveals that `dir` was in fact set in the URL going into the fetcher. This is in turn because unlike in the case changed in this commit, it was not erased before handing it to libfetchers, which is probably just a mistake.

```
(rr) up
3  0x00007ffff60262ae in nix::fetchers::Input::fromURL (url=..., requireTree=requireTree@entry=true) at src/libfetchers/fetchers.cc:39
warning: Source file is more recent than executable.
39              auto res = inputScheme->inputFromURL(url, requireTree);
(rr) p url
$1 = (const nix::ParsedURL &) @0x7fffdc874190: {url = "git+file:///home/jade/lix/nix-eval-jobs", 
  base = "git+file:///home/jade/lix/nix-eval-jobs", scheme = "git+file", authority = std::optional<std::string> = {[contained value] = ""}, 
  path = "/home/jade/lix/nix-eval-jobs", query = std::map with 1 element = {["dir"] = "tests/assets"}, fragment = ""}
(rr) up
4  0x00007ffff789d904 in nix::parseFlakeRefWithFragment (url=".#hydraJobs", baseDir=std::optional<std::string> = {...}, 
    allowMissing=allowMissing@entry=false, isFlake=isFlake@entry=true) at src/libexpr/flake/flakeref.cc:179
warning: Source file is more recent than executable.
179                                 FlakeRef(Input::fromURL(parsedURL, isFlake), getOr(parsedURL.query, "dir", "")),
(rr) p parsedURL
$2 = {url = "git+file:///home/jade/lix/nix-eval-jobs", base = "git+file:///home/jade/lix/nix-eval-jobs", scheme = "git+file", 
  authority = std::optional<std::string> = {[contained value] = ""}, path = "/home/jade/lix/nix-eval-jobs", query = std::map with 1 element = {
    ["dir"] = "tests/assets"}, fragment = ""}
(rr) list
174
175                             if (pathExists(flakeRoot + "/.git/shallow"))
176                                 parsedURL.query.insert_or_assign("shallow", "1");
177
178                             return std::make_pair(
179                                 FlakeRef(Input::fromURL(parsedURL, isFlake), getOr(parsedURL.query, "dir", "")),
180                                 fragment);
181                         }
```

Change-Id: Ib55a882eaeb3e59228857761dc1e3b2e366b0f5e
2024-06-24 22:49:17 +00:00
..
attrs.cc Fix conversion from JSON to fetch attributes 2021-01-05 02:06:25 +00:00
attrs.hh Allow tarball URLs to redirect to a lockable immutable URL 2023-06-13 14:17:45 +02:00
cache.cc util.{hh,cc}: Split out users.{hh,cc} 2024-05-29 11:01:34 +02:00
cache.hh Input: Replace markFileChanged() by putFile() 2024-03-25 15:30:36 +00:00
fetch-settings.cc Move some stuff from Settings to a new FetchSettings. 2022-03-01 01:39:25 +00:00
fetch-settings.hh doc: rewrite the multi-user documentation to actually talk about security 2024-06-12 15:34:23 -07:00
fetch-to-store.cc Merge pull request #9634 from 9999years/combine-abstract-pos-and-pos 2024-03-05 23:46:18 -07:00
fetch-to-store.hh util.hh: Delete remaining file and clean up headers 2024-05-29 12:38:51 +02:00
fetchers.cc libfetchers: fix URL logging 2024-05-25 19:37:38 -06:00
fetchers.hh Revert "libfetchers: make attribute / URL query handling consistent" 2024-06-24 22:49:17 +00:00
git.cc Revert "libfetchers: make attribute / URL query handling consistent" 2024-06-24 22:49:17 +00:00
github.cc Revert "libfetchers: make attribute / URL query handling consistent" 2024-06-24 22:49:17 +00:00
indirect.cc Revert "libfetchers: make attribute / URL query handling consistent" 2024-06-24 22:49:17 +00:00
lix-fetchers.pc.in packaging: rename nixexpr -> lixexpr and so on 2024-05-23 16:45:23 -06:00
mercurial.cc Revert "libfetchers: make attribute / URL query handling consistent" 2024-06-24 22:49:17 +00:00
meson.build build: expose option to enable or disable precompiled std headers 2024-06-06 12:46:26 -06:00
path.cc Input: Replace markFileChanged() by putFile() 2024-03-25 15:30:36 +00:00
registry.cc util.{hh,cc}: Split out users.{hh,cc} 2024-05-29 11:01:34 +02:00
registry.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
tarball.cc Revert "libfetchers: make attribute / URL query handling consistent" 2024-06-24 22:49:17 +00:00