Skip to content

Conversation

@jadenPete
Copy link

Fixes #24212

With inlining and standard library patching, it's inevitable that, when writing TASTy files, we'll encounter sources outside the sourceroot. However, we shouldn't write those sources as absolute paths because that's non-reproducible and can cause determinism issues. Instead, we should write the paths as-is.

While these sorts of paths aren't correct when written relatively, they weren't correct to begin with because they don't actually exist on the filesystem.

With inlining and standard library patching, it's inevitable that, when
writing TASTy files, we'll encounter sources outside the sourceroot.
However, we shouldn't write those sources as absolute paths because
that's non-reproducible and can cause determinism issues. Instead, we
should write the paths as-is.

While these sorts of paths aren't correct when written relatively, they
weren't correct to begin with because they don't actually exist on the
filesystem.
@Gedochao
Copy link
Contributor

Hey, all contributors are required to sign the Scala CLA (as indicated by the failure on the CI).
https://contribute.akka.io/contribute/cla/scala
Please comment when you sign it, we'll restart the check then.

Copy link
Member

@hamzaremmal hamzaremmal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, we shouldn't write those sources as absolute paths because that's non-reproducible and can cause determinism issues. Instead, we should write the paths as-is.

As well as privacy issues.

I'm not sure here what are all the usages of this method. I'll dig further and reply back here.

path.iterator.asScala.mkString("/")
else
sourcePath.toString
jpath.toString
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scaladoc says:

It returns the absolute path of `source` if it is not contained in `reference`.

By returning jpath instead of sourcePath when sourcePath.startsWith(refPath) == false breaks the contract in the documentation.

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

Successfully merging this pull request may close these issues.

Nondeterministic source paths in TASTy files

3 participants