8000 Copy-Item is assuming case insensitive on Linux · Issue #1930 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Copy-Item is assuming case insensitive on Linux #1930

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

Closed
giggio opened this issue Aug 19, 2016 · 3 comments
Closed

Copy-Item is assuming case insensitive on Linux #1930

giggio opened this issue Aug 19, 2016 · 3 comments
Assignees
Labels
Committee-Reviewed PS-Committee has reviewed this and made a decision Resolution-Fixed The issue is fixed. WG-Cmdlets general cmdlet issues
Milestone

Comments

@giggio
Copy link
giggio commented Aug 19, 2016

Steps to reproduce

cd /tmp
mkdir a
mkdir A
touch a/b
cd A
Copy-Item ../a/b

Expected behavior

File copied.

Actual behavior

File not copied, and error:

Copy-Item : Cannot overwrite the item /tmp/A/b with itself.
At line:1 char:1
+ Copy-Item ../a/b
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (/tmp/A/b:String) [Copy-Item], IOException
    + FullyQualifiedErrorId : CopyError,Microsoft.PowerShell.Commands.CopyItemCommand

Environment data

Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      Core
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.9
CLRVersion
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
@SteveL-MSFT SteveL-MSFT added the WG-Cmdlets general cmdlet issues label Sep 16, 2016
@SteveL-MSFT SteveL-MSFT added this to the 6.0.0 milestone Sep 29, 2016
@SteveL-MSFT SteveL-MSFT modified the milestones: 6.0.0-beta, 6.0.0 Dec 19, 2016
@SteveL-MSFT SteveL-MSFT added the Review - Committee The PR/Issue needs a review from the PowerShell Committee label Feb 27, 2017
@jeffbi
Copy link
Contributor
jeffbi commented Feb 27, 2017

The cmdlet does a case-insensitive comparison of the source a 8000 nd 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.

@SteveL-MSFT SteveL-MSFT changed the title Copy-Item is assuming case insensive on Linux Copy-Item is assuming case insensitive on Linux Mar 2, 2017
@SteveL-MSFT SteveL-MSFT added Committee-Reviewed PS-Committee has reviewed this and made a decision and removed Review - Committee The PR/Issue needs a review from the PowerShell Committee labels Mar 2, 2017
@SteveL-MSFT
Copy link
Member
SteveL-MSFT commented 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 @iSazonov

@iSazonov
Copy link
Collaborator

@giggio Thanks for your report! The Issue was fixed. You can recheck the fix in Alfa.19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Committee-Reviewed PS-Committee has reviewed this and made a decision Resolution-Fixed The issue is fixed. WG-Cmdlets general cmdlet issues
Projects
None yet
Development

No branches or pull requests

4 participants
0