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

run_make_support: rectify symlink handling #130427

Merged
merged 2 commits into from
Sep 17, 2024
Merged

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Sep 16, 2024

Avoid confusing Unix symlinks and Windows symlinks. Since their
semantics are quite different, we should avoid trying to make it
automagic in how symlinks are created and deleted. Notably, the tests
should reflect what type of symlinks are to be created to match what std
does to make it less surprising for test readers.

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 16, 2024
@jieyouxu

This comment was marked as outdated.

@bors

This comment was marked as outdated.

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 16, 2024
run_make_support: rectify symlink handling

Avoid confusing Unix symlinks and Windows symlinks, and since their
semantics are quite different we should avoid trying to make it to
automagic in how symlinks are created and deleted. Notably, the tests
should reflect what type of symlinks are to be created to match what std
does to make it less surprising for test readers.

r? `@ghost`

try-job: x86_64-msvc
try-job: aarch64-apple
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors

This comment was marked as outdated.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 16, 2024
}
#[cfg(windows)]
{
rfs::windows::symlink_file(
Copy link
Contributor

@Kobzol Kobzol Sep 16, 2024

Choose a reason for hiding this comment

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

This seems quite cumbersome, error-prone and hard to read. Can't we create more precise variants of the symlink functions (symlink_file, symlink_dir - or whatever other versions needed) and then let each runmake test decide which exact variant it needs, and handle the implementation difference itself in rfs?

The test will probably always do the same thing on Unix and Windows; we just need to force the test to be more explicit in what kind of symlink it needs.

Like this:

// runmake test
rfs::symlink_file("a", "b");
rfs::symlink_dir("x", "y");

// rfs
unix::symlink_file => symlink
unix::symlink_dir => symlink
windows::symlink_file => symlink_file
windows::symlink_dir => symlink_dir

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that seems reasonable. I'll change this tomorrow.

Copy link
Member Author

Choose a reason for hiding this comment

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

(I lied I changed this today)

@jieyouxu jieyouxu marked this pull request as ready for review September 16, 2024 11:50
@jieyouxu
Copy link
Member Author

Should be ready for review now.

r? @Kobzol since you're already looking at it

Avoid confusing Unix symlinks and Windows symlinks, and since their
semantics are quite different we should avoid trying to make it to
automagic in how symlinks are created and deleted. Notably, the tests
should reflect what type of symlinks are to be created to match what std
does to make it less surprising for test readers.
Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Left one nit, otherwise LGTM. Is symlink_metadata intended for future usage or are you planning to modify more tests in this PR?

tests/run-make/symlinked-libraries/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/symlinked-extern/rmake.rs Outdated Show resolved Hide resolved
@jieyouxu
Copy link
Member Author

symlink_metadata is intended for future usage, but if we have metadata and support symlinks, then we do need to provide a way to interrogate metadata on a given file without potentially traversing a symlink.

@jieyouxu
Copy link
Member Author

Fixed the tests to use path(). Locally ./x test run-make and ./x doc run-make-support both seem to pass on msvc (well except the ones that still use make).

@Kobzol
Copy link
Contributor

Kobzol commented Sep 16, 2024

Good :) You can r=me once CI is green.

@jieyouxu
Copy link
Member Author

CI is green, so
@bors r=@Kobzol rollup

@bors
Copy link
Contributor

bors commented Sep 17, 2024

📌 Commit 7d76428 has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 17, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 17, 2024
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#130380 (coverage: Clarify some parts of coverage counter creation)
 - rust-lang#130427 (run_make_support: rectify symlink handling)
 - rust-lang#130447 (rustc_llvm: update for llvm/llvm-project@2ae968a0d9fb61606b020e898d88…)
 - rust-lang#130448 (fix: Remove duplicate `LazyLock` example.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 07ca905 into rust-lang:master Sep 17, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 17, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 17, 2024
Rollup merge of rust-lang#130427 - jieyouxu:rmake-symlink, r=Kobzol

run_make_support: rectify symlink handling

Avoid confusing Unix symlinks and Windows symlinks. Since their
semantics are quite different, we should avoid trying to make it
automagic in how symlinks are created and deleted. Notably, the tests
should reflect what type of symlinks are to be created to match what std
does to make it less surprising for test readers.
@jieyouxu jieyouxu deleted the rmake-symlink branch September 17, 2024 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants