Skip to content

Conversation

uggla
Copy link
Contributor

@uggla uggla commented Aug 31, 2020

Sanity check:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code changes

  • Are you doing the PR on the next branch?

Explanation:
Remove unc on windows platform see #1110 .
Sorry I mistakenly closed the previous PR on that topic #1129 .

So here is the new one I did 3 things:

  • Bump to rust 1.45 version which is the minimal one required.
  • Put a comment as requested on the LOCAL_UNC const.
  • Add a new test that will fail as soon as the canonicalize function will be fixed by the rust team. So this workaround will have to be removed.
@uggla uggla changed the title Fix/unc Aug 31, 2020
@Keats Keats merged commit 5ec3a9c into getzola:next Sep 1, 2020
@Keats
Copy link
Collaborator

Keats commented Sep 1, 2020

Thanks!

linux-pinned:
imageName: 'ubuntu-16.04'
rustup_toolchain: 1.43.0
rustup_toolchain: 1.45.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need the bump btw?

Copy link
Contributor Author

@uggla uggla Sep 1, 2020

Choose a reason for hiding this comment

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

@Keats,

error[E0658]: use of unstable library feature 'str_strip': newly added
  --> src/cmd/init.rs:65:26
   |
65 |     match path_to_refine.strip_prefix(LOCAL_UNC) {
   |                          ^^^^^^^^^^^^
   |
   = note: see issue #67302 <https://github.com/rust-lang/rust/issues/67302> for more information

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
error: could not compile `zola`.

This was stabilized in 1.45, (https://github.com/rust-lang/rust/blob/master/RELEASES.md#stabilized-apis-1), I manage to confirm using rustc as well. So minimum version to bump is 1.45 to avoid this error. I'm gonna change that accordingly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't trim_start_matches do the same?

Copy link
Contributor Author

@uggla uggla Sep 2, 2020

Choose a reason for hiding this comment

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

In that case, I think yes. To be honest I used strip_prefix because I looked at the documentation and it was what I needed and I did not look further at it. (shame on me)
As I used a version > 1.45, I have not realize that this method was not stable before that release.
Anyway, would you like me to use trim_start_matches instead of strip_prefix and come back to 1.43 for the pinned version ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you have time and don't mind sure

@OvermindDL1
Copy link

It looks like this is only doing a trivial string prefix removal instead of actually testing that it's valid. UNC paths can represent paths on windows that are otherwise unrepresentable, so removing it can make a path invalid. It should only be removed (if at all) if the resultant path is still valid. This is also why the current rust method returns what it does, because it is the kernel itself performing the canonicalization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants