Skip to content

Case changing silently breaks on case-insensitive FS #114

@particleflux

Description

@particleflux

Tick this box to confirm you have reviewed the above.

  • I've discovered a new issue with F2.

What version of F2 are you using?

f2 version 2.1.1
https://github.com/ayoisaiah/f2/releases/2.1.1

How did you install F2?

GH binary

What operating system are you using F2 on?

Gentoo / Linux 6.14.6

Describe your bug.

Case changing silently breaks on case-insensitive FS.
Trying to rename a file and only changing the case on a mounted CIFS/Samba share aka a case-insensitive FS does report OK but silently fails in the middle of the renaming operation.

The mounted FS has these options:

type cifs (rw,relatime,vers=3.1.1,cache=strict,upcall_target=app,addr=192.168.178.222,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,reparse=nfs,nativesocket,symlink=native,rsize=4194304,wsize=4194304,bsize=1048576,retrans=1,echo_interval=60,actimeo=1,closetimeo=1)

What are the steps to reproduce the behavior?

  • mount a CIFS FS
  • rename a file there, e.g.
touch FOO
f2 -f FOO -r Foo 
f2 -f FOO -r Foo -x

What behaviour did you observe?

  • file is renamed to a temporary name
  • f2 reports "everything OK" regardless
  • undo won't work since it thinks all is OK
$ ls -la
total 4.0K
drwxr-xr-x 2 stefan stefan 0 May 25 12:08 .
drwxr-xr-x 2 stefan stefan 0 May 25 12:06 ..
-rwxr-xr-x 1 stefan stefan 0 May 25 12:06 FOO

$ f2 -f FOO -r Foo -V
*——————————*—————————*————————*
| ORIGINAL | RENAMED | STATUS |
*——————————*—————————*————————*
| FOO      | Foo     | ok     |
*——————————*—————————*————————*
dry run: commit the above changes with the -x/--exec flag

$ f2 -f FOO -r Foo -V -x
renamed: 'FOO' to 'Foo'

$ ls -la
total 4
drwxr-xr-x 2 stefan stefan 0 May 25 12:08 .
drwxr-xr-x 2 stefan stefan 0 May 25 12:06 ..
-rwxr-xr-x 1 stefan stefan 0 May 25 12:06 __1748167688837658691__Foo__1748167688837658691__


$ f2 -u
*——————————*—————————*——————————————————*
| ORIGINAL | RENAMED |      STATUS      |
*——————————*—————————*——————————————————*
| Foo      | FOO     | source not found |
*——————————*—————————*——————————————————*
conflict: resolve manually or use -F/--fix-conflicts

As a comparison, this is what mv does

$ mv BAR Bar
mv: 'BAR' and 'Bar' are the same file

What is the expected behaviour?

It should probably abort with a conflict, since the files are the same.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working as expected

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions