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

mv change case of file extension causes: 'test.txt' and 'test.TXT' are the same file #4767

Closed
twatzl opened this issue Dec 16, 2019 · 5 comments
Labels

Comments

@twatzl
Copy link

twatzl commented Dec 16, 2019

Hello,

I have the following issue

  • Your Windows build number: Microsoft Windows [Version 10.0.17763.914]

  • What you're doing and what's happening:

$~> cd /mnt/c/
$/mnt/c> mkdir tmp
$/mnt/c> cd tmp/
$/mnt/c/tmp> ls
$/mnt/c/tmp> touch test.txt
$/mnt/c/tmp> mv test.txt test.TXT
mv: 'test.txt' and 'test.TXT' are the same file
  • What's wrong / what should be happening instead:

mv command cannot be used to rename file extension to upper case. I would expect similar behavior as in Windows Explorer or other tools that i can simply rename a file and change the case of the extension. I tested the same thing under Fedora and there it works without any issues.

@WSLUser
Copy link

WSLUser commented Dec 17, 2019

I wanted to say this was correct behavior but I too tested on a Fedora cloud image and mv does indeed allow changing file extension case, not just file name. I think this a bug in mv personally, why would you have 2 identical files that only differ in case by file extension, NOT file name? I think there are a number of issues that can stem from that. I wouldn't change behavior for Windows and Linux should model Windows with this behavior.

@twatzl
Copy link
Author

twatzl commented Dec 17, 2019

Well, the thing is that I some devices produce files with uppercase endings like .JPG, .PNG, etc. and some software uses lowercase endings by default and I wrote a bash script for renaming them all to uppercase, because that is what I need them to be (i don't care if upper or lower case, just consistent).

mv is used here for renaming and I don't have two files which are different in case, I just want to change the case of the file extension.

This works in Windows Explorer and on other operating systems so why should it not work in WSL?

I just tested again and it also works in ~ directory in WSL (OpenSuse), but not in /mnt/c

~> touch test.txt
~> mv test.txt test.TXT
~> mv test.TXT test.txt
~> cd /mnt/c/tmp/
/mnt/c/tmp> mv test.txt TEST.txt
mv: 'test.txt' and 'TEST.txt' are the same file

@WSLUser
Copy link

WSLUser commented Dec 17, 2019

Ah ok, I see what you mean. Yes, just to make them all consistent (I personally prefer lowercase as it's easier to read to me) this should work. Do you have case sensitivity enabled in wsl.conf? If not, that would be why it's not working. You'd find the same issue exists for both WSL1 and WSL2.

@benhillis
Copy link
Member

If you want DrvFs to behave case-sensitive you have to supply the case sensitive mount option:

https://devblogs.microsoft.com/commandline/improved-per-directory-case-sensitivity-support-in-wsl/

@therealkenc
Copy link
Collaborator

therealkenc commented Jan 19, 2020

This one nominally asked and answered, caveat #3356 and #2937 (message) notwithstanding. The OP behavior is by-design by default.

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

4 participants