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

Misleading error message when Curl not found. #2906

Open
dukc opened this issue May 4, 2024 · 1 comment
Open

Misleading error message when Curl not found. #2906

dukc opened this issue May 4, 2024 · 1 comment

Comments

@dukc
Copy link

dukc commented May 4, 2024

System information

  • dub version: 1.33.1
  • OS Platform and distribution: Nixos 23.11
  • compiler version ldc-1.34.0

Bug Description

$ dub build -v
Using dub registry url 'https://code.dlang.org/'
Note: Failed to determine version of package fps-godot-modules at .. Assuming ~master.
  Version selection for dependency godot-dlang (godot-dlang) of fps-godot-modules is missing.
  Missing dependency godot-dlang ~>0.6.0 of fps-godot-modules
Checking for missing dependencies.
Search for versions of godot-dlang (1 package suppliers)
Scanning local packages...
     Warning Package godot-dlang not found in registry at https://code.dlang.org/ (fallbacks registry at https://codemirror.dlang.org/, registry at https://dub.bytecraft.nl/, registry at https://code-mirror.dlang.io/): Failed to download https://code.dlang.org/api/packages/infos?packages=%5B%22godot-dlang%22%5D&include_dependencies=true&minimize=true
Nothing found for godot-dlang
Error Failed to find any versions for package godot-dlang, referenced by fps-godot-modules ~master

An error message like this leads me to think I would have connection problems, code.dlang.org would be down, or the package would be missing. None of those was the case. Instead, Strace revealed the problem:

# Lots of openats like those below...
openat(AT_FDCWD, "/nix/store/sdhmm56jv7r449hf7f57cl3pvnsy3cbg-xgcc-12.3.0-libgcc/lib/libcurl-gnutls.so.4", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/1q6qwq8csbhyy0pv54sab00jxlmb3rw2-gcc-12.3.0-libgcc/lib/libcurl-nss.so.4", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/gqghjch4p1s69sv4mcjksb2kb65rwqjy-glibc-2.38-23/lib/libcurl-nss.so.4", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/sdhmm56jv7r449hf7f57cl3pvnsy3cbg-xgcc-12.3.0-libgcc/lib/libcurl-nss.so.4", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/1q6qwq8csbhyy0pv54sab00jxlmb3rw2-gcc-12.3.0-libgcc/lib/libcurl.so.3", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/gqghjch4p1s69sv4mcjksb2kb65rwqjy-glibc-2.38-23/lib/libcurl.so.3", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/sdhmm56jv7r449hf7f57cl3pvnsy3cbg-xgcc-12.3.0-libgcc/lib/libcurl.so.3", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, "\33[1;33;49m     Warning\33[0m Packa"..., 367     Warning Package godot-dlang not found in registry at https://code.dlang.org/ (fallbacks registry at https://codemirror.dlang.org/, registry at https://dub.bytecraft.nl/, registry at https://code-mirror.dlang.io/): Failed to download https://code.dlang.org/api/packages/infos?packages=%5B%22godot-dlang%22%5D&include_dependencies=true&minimize=true
) = 367
# ...

The real problem here is with the library search paths, as they obviously aren't patched to include curl, meaning something with the Nix derivation used to install it is wrong.

Dub didn't help diagnosing the problem, though. If it can't find curl, I'd expect it to report that in the error message instead of "download failed", or even worse "package not found in registry".

How to reproduce?

Hide the Curl library from DUB and try to build something that local caches aren't enough for.

@Geod24
Copy link
Member

Geod24 commented Jun 10, 2024

So this lazy initialization is done by Phobos. If it can't find Curl, it throws an Exception.

Which we end up catching:

dub/source/dub/dub.d

Lines 1804 to 1807 in a913071

} catch (Exception e) {
logWarn("Package %s not found in %s: %s", pack, ps.description, e.msg);
logDebug("Full error: %s", e.toString().sanitize);
}

I assume dub --verbose would help here, but we should probably handle this better.

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

No branches or pull requests

2 participants