Skip to content

[Merged by Bors] - Use the IO.FS.rename to move file instead of relying on presence of mv program#6284

Closed
MohanadAhmed wants to merge 2 commits intomasterfrom
MohanadAhmed/LeanCacheRenameFix
Closed

[Merged by Bors] - Use the IO.FS.rename to move file instead of relying on presence of mv program#6284
MohanadAhmed wants to merge 2 commits intomasterfrom
MohanadAhmed/LeanCacheRenameFix

Conversation

@MohanadAhmed
Copy link
Copy Markdown
Collaborator

The Cache program after detecting that LeanTar is old downloads it and attempts to place it in the CACHEDIR directory. It then attempts to rename it using the mv command it assumes is present on the platform. On windows cmd and powershell this does not work since mv is actually a shell built in and not an executable. (This will however work on MinGW based shells).

@digama0 added the function IO.FS.rename in Lean Lean4#2345 which calls the standard C/C++ function rename. This PR uses this function to move leantar instead of the runCmd command. When this fix succeeds the output looks like the following (in powershell).

PS W:\LeanStuff\graveyard_mathlib4\LeanCacheFix> lake exe cache get
leantar is too old; downloading more recent version
Attempting to download 3614 file(s)
Downloaded: 3614 file(s) [attempted 3614/3614 = 100%] (100% success)
Decompressing 3614 file(s)
unpacked in 323 ms

Open in Gitpod

@MohanadAhmed MohanadAhmed requested a review from digama0 August 1, 2023 12:40
@MohanadAhmed MohanadAhmed added awaiting-review easy < 20s of review time. See the lifecycle page for guidelines. labels Aug 1, 2023
@digama0
Copy link
Copy Markdown
Member

digama0 commented Aug 2, 2023

bors r+

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Aug 2, 2023
bors bot pushed a commit that referenced this pull request Aug 2, 2023
…v program (#6284)

The Cache program after detecting that LeanTar is old downloads it and attempts to place it in the `CACHEDIR` directory. It then attempts to rename it using the `mv` command it assumes is present on the platform. On windows `cmd` and `powershell` this does not work since `mv` is actually a shell built in and not an executable. (This will however work on MinGW based shells).

@digama0 added the function `IO.FS.rename` in Lean [Lean4#2345](leanprover/lean4#2345 (comment)) which calls the standard C/C++ function `rename`. This PR uses this function to move leantar instead of the runCmd command. When this fix succeeds the output looks like the following (in powershell).

```text
PS W:\LeanStuff\graveyard_mathlib4\LeanCacheFix> lake exe cache get
leantar is too old; downloading more recent version
Attempting to download 3614 file(s)
Downloaded: 3614 file(s) [attempted 3614/3614 = 100%] (100% success)
Decompressing 3614 file(s)
unpacked in 323 ms
```



Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@bors
Copy link
Copy Markdown

bors bot commented Aug 2, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title Use the IO.FS.rename to move file instead of relying on presence of mv program [Merged by Bors] - Use the IO.FS.rename to move file instead of relying on presence of mv program Aug 2, 2023
@bors bors bot closed this Aug 2, 2023
@bors bors bot deleted the MohanadAhmed/LeanCacheRenameFix branch August 2, 2023 09:22
kim-em pushed a commit that referenced this pull request Aug 3, 2023
…v program (#6284)

The Cache program after detecting that LeanTar is old downloads it and attempts to place it in the `CACHEDIR` directory. It then attempts to rename it using the `mv` command it assumes is present on the platform. On windows `cmd` and `powershell` this does not work since `mv` is actually a shell built in and not an executable. (This will however work on MinGW based shells).

@digama0 added the function `IO.FS.rename` in Lean [Lean4#2345](leanprover/lean4#2345 (comment)) which calls the standard C/C++ function `rename`. This PR uses this function to move leantar instead of the runCmd command. When this fix succeeds the output looks like the following (in powershell).

```text
PS W:\LeanStuff\graveyard_mathlib4\LeanCacheFix> lake exe cache get
leantar is too old; downloading more recent version
Attempting to download 3614 file(s)
Downloaded: 3614 file(s) [attempted 3614/3614 = 100%] (100% success)
Decompressing 3614 file(s)
unpacked in 323 ms
```



Co-authored-by: Mario Carneiro <di.gama@gmail.com>
kim-em pushed a commit that referenced this pull request Aug 3, 2023
…v program (#6284)

The Cache program after detecting that LeanTar is old downloads it and attempts to place it in the `CACHEDIR` directory. It then attempts to rename it using the `mv` command it assumes is present on the platform. On windows `cmd` and `powershell` this does not work since `mv` is actually a shell built in and not an executable. (This will however work on MinGW based shells).

@digama0 added the function `IO.FS.rename` in Lean [Lean4#2345](leanprover/lean4#2345 (comment)) which calls the standard C/C++ function `rename`. This PR uses this function to move leantar instead of the runCmd command. When this fix succeeds the output looks like the following (in powershell).

```text
PS W:\LeanStuff\graveyard_mathlib4\LeanCacheFix> lake exe cache get
leantar is too old; downloading more recent version
Attempting to download 3614 file(s)
Downloaded: 3614 file(s) [attempted 3614/3614 = 100%] (100% success)
Decompressing 3614 file(s)
unpacked in 323 ms
```



Co-authored-by: Mario Carneiro <di.gama@gmail.com>
kim-em pushed a commit that referenced this pull request Aug 14, 2023
…v program (#6284)

The Cache program after detecting that LeanTar is old downloads it and attempts to place it in the `CACHEDIR` directory. It then attempts to rename it using the `mv` command it assumes is present on the platform. On windows `cmd` and `powershell` this does not work since `mv` is actually a shell built in and not an executable. (This will however work on MinGW based shells).

@digama0 added the function `IO.FS.rename` in Lean [Lean4#2345](leanprover/lean4#2345 (comment)) which calls the standard C/C++ function `rename`. This PR uses this function to move leantar instead of the runCmd command. When this fix succeeds the output looks like the following (in powershell).

```text
PS W:\LeanStuff\graveyard_mathlib4\LeanCacheFix> lake exe cache get
leantar is too old; downloading more recent version
Attempting to download 3614 file(s)
Downloaded: 3614 file(s) [attempted 3614/3614 = 100%] (100% success)
Decompressing 3614 file(s)
unpacked in 323 ms
```



Co-authored-by: Mario Carneiro <di.gama@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

easy < 20s of review time. See the lifecycle page for guidelines. ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants