You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Copy-Item is assuming case insensitive on Linux #1930
The cmdlet does a case-insensitive comparison of the source and destination file paths, which is appropriate for Windows file systems. However, simply changing the test to case-sensitive on Linux is not sufficient since Linux is perfectly happy to use, for example, the FAT file system which is case-insensitive regardless of the OS using it.
Removing the test entirely, and allowing the call to FileInfo.CopyTo to fail is probably reasonable, although the IOExceptions thrown on FullCLR, CoreCLR Windows, and CoreCLR Linux are different. On FullCLR, the exception's HRESULT is 0x80070050 (ERROR_FILE_EXISTS) and the Message property reflects that. In CoreCLR the HRESULT is 0x80070020 (ERROR_SHARING_VIOLATION) on Windows and 11 (EAGAIN) on Linux---in both cases the Message is "The process cannot access the file because it is being used by another process."
Also, if we were to remove the test entirely on Linux and MacOS, users would not see the same error text across platforms.
@PowerShell/powershell-committee we should honor the filesystem case-sensitivity instead of just assuming case-sensitive on Linux and case-insensitive on Windows
Activity
jeffbi commentedon Feb 27, 2017
The cmdlet does a case-insensitive comparison of the source and destination file paths, which is appropriate for Windows file systems. However, simply changing the test to case-sensitive on Linux is not sufficient since Linux is perfectly happy to use, for example, the FAT file system which is case-insensitive regardless of the OS using it.
Removing the test entirely, and allowing the call to FileInfo.CopyTo to fail is probably reasonable, although the IOExceptions thrown on FullCLR, CoreCLR Windows, and CoreCLR Linux are different. On FullCLR, the exception's HRESULT is 0x80070050 (
ERROR_FILE_EXISTS) and the Message property reflects that. In CoreCLR the HRESULT is 0x80070020 (ERROR_SHARING_VIOLATION) on Windows and 11 (EAGAIN) on Linux---in both cases the Message is "The process cannot access the file because it is being used by another process."Also, if we were to remove the test entirely on Linux and MacOS, users would not see the same error text across platforms.
[-]Copy-Item is assuming case insensive on Linux[/-][+]Copy-Item is assuming case insensitive on Linux[/+]SteveL-MSFT commentedon Mar 2, 2017
@PowerShell/powershell-committee we should honor the filesystem case-sensitivity instead of just assuming case-sensitive on Linux and case-insensitive on Windows
edit: typo fixed, thanks Ilya (@iSazonov)
iSazonov commentedon Apr 22, 2017
Giovanni Bassi (@giggio) Thanks for your report! The Issue was fixed. You can recheck the fix in Alfa.19.