unambitious macos case sensitivity `move`

macos struggles even with itself about filename case-sensitivity:

$ mv file.txt FILE.TXT
mv: 'file.txt' and 'FILE.TXT' are the same file

this means when one does mv file.txt a ; mv a FILE.TXT on one computer, syncthing breaks even across (case-insensitive) macos machines. I think one then needs to hunt and hand-fix files.

I am guessing that the problem here is that the macos rename file command gives an error, which in turn gives a syncthing error. however, this should be relatively uncontroversial to fix, i.e., without implications for sync-ing to case-sensitive computers. it would merely require testing if lc() is the same, and if it is, to rename through an intermediate tmp file.


(stupid apple!)

For what it’s worth, this doesn’t happen to me on current macOS (10.15.5) and Go (1.14.4). Maybe it’s been fixed somewhere along the way.

That is, this works and does what it says on the tin:

func main() {
	os.Mkdir("testdir", 0755)
	ioutil.WriteFile("testfile", []byte("data"), 0644)
	fmt.Println(os.Rename("testfile", "TESTfile"))
	fmt.Println(os.Rename("testdir", "testDIR"))

(mv from the command line also works, but who knows what magic it does behind the scenes)

In the Go standard library it seems to boil down to just a rename syscall, so I’m guessing this has been fixed at the OS level at some point.

thx, jakob. first, I made a mistake. command line works. I was using the brew gnu coreutils, which failed. duh.

please try the following:

$ echo "hello" > test.txt
$ sleep 60
$ /bin/mv test.txt test.TXT
$ sleep 60
$ ssh remote...check whether you have test.TXT or test.txt

I see on my indications of ‘Out of Sync Items’ which do not clear up for me.

(I am using latest macos, too, and syncthing 1.6.1 macos Fermium Flea local. I cannot get to the remote host…locked up. I think it is the same.)

Case-only renames between two insensitive systems doesn’t work, for long standing reasons. The problem here is really on the source side, where we can see that TEST has materialized but we can’t tell that test has disappeared, so we assume that both now exist. Renaming test to TEST on FreeBSD (on a case sensitive filesystem) and syncing that change to my Mac works fine for me, though. I tested it now.

1 Like

thx, jakob. and I do not want to take more of your time. apple’s idea of file naming sucks.

given how common macos is, this may warrant a little extra code…or not…

the next time I rename my photo files from IMG*.JPG to img*.jpg, I will watch out and pull it through another directory first. right now, I have to work through painful attempts to get rid of the sync errors.