Skip to content

Cannot cache build in the presence of __FILE_FULL_PATH__ #2840

Closed

Description

@Geod24

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.

Activity

  1. kinke commented on Feb 7, 2024

    @kinke
    Contributor

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

  2. added 7 commits that reference this issue on Feb 7, 2024
    59a3f63
    1c247de
    934a0f5
    e1b42a5
    dde236b
    c245b80
    1342318
  3. added a commit that references this issue on Feb 9, 2024
    5a9e230
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions