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

Cannot cache build in the presence of __FILE_FULL_PATH__ #2840

Closed
Geod24 opened this issue Feb 7, 2024 · 1 comment
Closed

Cannot cache build in the presence of __FILE_FULL_PATH__ #2840

Geod24 opened this issue Feb 7, 2024 · 1 comment

Comments

@Geod24
Copy link
Member

Geod24 commented Feb 7, 2024

Reported by @kinke .

#!/usr/bin/env dub
/++ dub.json:
   {
       "name": "build"
   }
+/

import std.format;

immutable FullPath = __FILE_FULL_PATH__;

void main (string[] args)
{
    assert(args.length == 2, "Expected a single argument");
    assert(args[1] == FullPath, format("%s != %s -- %s", args[1], FullPath, args[0]));
}
echo "$CODE" > build.d && chmod +x build.d
./build.d $(pwd)/build.d
mkdir nested && cp build.d nested/ && cd nested
./build.d $(pwd)/build.d

Results in:

[email protected](15): /home/mlang/projects/dlang/dub/foo/nested/build.d != /home/mlang/projects/dlang/dub/foo/build.d -- /tmp/.dub/build/build-~master/application-debug-zjWJHxauIHQN4hH1LrZ2uA/build
----------------
??:? [0x563be84e1f06]
??:? [0x563be84e1b82]
??:? [0x563be85080d6]
??:? [0x563be84e96ef]
??:? [0x563be84e0bd3]
build.d:15 [0x563be84a7b4f]
??:? [0x563be84e93bc]
??:? [0x563be84e92b6]
??:? [0x563be84e910d]
/home/mlang/dlang/ldc-1.35.0/bin/../import/core/internal/entrypoint.d:42 [0x563be84a7d41]
??:? [0x7faca72c3d8f]
??:? __libc_start_main [0x7faca72c3e3f]
??:? [0x563be84a7984]
Error Program exited with code 1

Because the program does not get rebuilt.

@kinke
Copy link
Contributor

kinke commented Feb 7, 2024

Just for the record, rdmd uses a global cache too (in /tmp), but the cache key is different for identical files in different directories.

Geod24 added a commit to Geod24/dub that referenced this issue Feb 7, 2024
By including the package path in the buildid we avoid the problem,
at the expense of not sharing the cache for packages that could be
shared, but we would need to know if the code depends on __FILE__
and __FILE_FULL_PATH__ or not.
Geod24 added a commit to Geod24/dub that referenced this issue Feb 7, 2024
By including the package path in the buildid we avoid the problem,
at the expense of not sharing the cache for packages that could be
shared, but we would need to know if the code depends on __FILE__
and __FILE_FULL_PATH__ or not.
Geod24 added a commit to Geod24/dub that referenced this issue Feb 7, 2024
By including the package path in the buildid we avoid the problem,
at the expense of not sharing the cache for packages that could be
shared, but we would need to know if the code depends on __FILE__
and __FILE_FULL_PATH__ or not.
Geod24 added a commit to Geod24/dub that referenced this issue Feb 7, 2024
By including the package path in the buildid we avoid the problem,
at the expense of not sharing the cache for packages that could be
shared, but we would need to know if the code depends on __FILE__
and __FILE_FULL_PATH__ or not.
Geod24 added a commit to Geod24/dub that referenced this issue Feb 7, 2024
By including the package path in the buildid we avoid the problem,
at the expense of not sharing the cache for packages that could be
shared, but we would need to know if the code depends on __FILE__
and __FILE_FULL_PATH__ or not.
Geod24 added a commit to Geod24/dub that referenced this issue Feb 9, 2024
By including the package path in the buildid we avoid the problem,
at the expense of not sharing the cache for packages that could be
shared, but we would need to know if the code depends on __FILE__
and __FILE_FULL_PATH__ or not.
Geod24 added a commit to Geod24/dub that referenced this issue Feb 9, 2024
By including the package path in the buildid we avoid the problem,
at the expense of not sharing the cache for packages that could be
shared, but we would need to know if the code depends on __FILE__
and __FILE_FULL_PATH__ or not.
@Geod24 Geod24 closed this as completed in 5a9e230 Feb 9, 2024
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