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

Renaming file by just capitalizing a letter #343

Closed
noib3 opened this issue Apr 29, 2020 · 10 comments
Closed

Renaming file by just capitalizing a letter #343

noib3 opened this issue Apr 29, 2020 · 10 comments
Labels

Comments

@noib3
Copy link

noib3 commented Apr 29, 2020

Renaming a file by just capitalizing one or more of its letters causes an error. For ex if I try to rename test to Test, I get the following error

portion_2020:04:29@02:38:47

@BachoSeven
Copy link

I cannot reproduce this. What is your set shell?

@noib3
Copy link
Author

noib3 commented Apr 29, 2020

I have not set it, so it's the default one.

@eggeek
Copy link

eggeek commented May 12, 2020

I got same problem. What's worse, the renamed file will disappear.
My lf --version is 14, the lfrc is from the official example

asciicast

@BachoSeven
Copy link

what shell and terminal are you using? I still cannot reproduce it

@shabahengam
Copy link

I cannot reproduce it too.
as I know Windows and Mac are case-insensitive so maybe that cause the problem.

@eggeek
Copy link

eggeek commented May 12, 2020

I cannot reproduce it too.
as I know Windows and Mac are case-insensitive so maybe that cause the problem.

Yes, I'm using macOS.
But I also tried to set the shell by set shell zsh.
And the renaming is work in my command line and in LF command mode e.g. %mv A.txt a.txt.

The problem is that I cannot find any log (under /tmp), thus I don't know how the LF execute the "rename" command that causes the file to disappear.

@shabahengam
Copy link

I had a similar situation but get fixed.check this issue #253
maybe that issue is not completely fixed for other OSes.(I'm using Linux)

@BachoSeven
Copy link

BachoSeven commented May 13, 2020

@eggeek I don't know anything about go, but I digged around this points in the code: eval.go and nav.go; you can see from nav.go that there's a function called os.Rename imported from the package os, which you can find at https://golang.org/pkg/os/#Rename. It turns out that this function calls another rename function from this file. There, I found the following comment which could be useful to you:

                // However, if the old name and new name are not the same, yet
		// they refer to the same file, it implies a case-only
		// rename on a case-insensitive filesystem, which is ok.

Anyways, the function then seems to call yet another Rename function, this time from syscall: on an AMD64 architecture, it should be the one in here at line 1297.
So the library called for the rename operation is probably libc_rename_trampoline.

I still have no idea what causes the error nor the file disappearance, but hopefully this can point you in a Darwin-oriented debugging of the issue.

@gokcehan
Copy link
Owner

gokcehan commented Jun 3, 2020

We fixed the older issue by simply checking if the new name is the same as old in a case-sensitive way which apparently fails for case-insensitive file systems. I'm not sure what would be the easiest way to fix this without adding some platform dependent code.

@n0ibe This is an important issue we should fix as soon as possible. Thanks for reporting.

@gokcehan gokcehan added the bug label Jun 3, 2020
gokcehan added a commit that referenced this issue Jun 17, 2020
gokcehan added a commit that referenced this issue Jun 17, 2020
@gokcehan
Copy link
Owner

I have pushed a fix for this and everything should be working fine now. Closing this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants