Lf: Renaming file by just capitalizing a letter

Created on 29 Apr 2020  路  10Comments  路  Source: gokcehan/lf

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

<a href="portion_2020:04:29@02">portion_2020:04:29@02</a>:38:47

bug

Most helpful comment

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

All 10 comments

I cannot reproduce this. What is your set shell?

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

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

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

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

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.

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)

@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.

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mvrozanti picture mvrozanti  路  6Comments

doronbehar picture doronbehar  路  3Comments

pr4th4m picture pr4th4m  路  7Comments

itmitica picture itmitica  路  6Comments

nostdm picture nostdm  路  6Comments