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

Copying over a symlink clobbers the symlink instead of its target on Windows #43376

Open
jamesderlin opened this issue Sep 10, 2020 · 2 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. library-io vm-regression

Comments

@jamesderlin
Copy link
Contributor

Steps to reproduce:

  1. On a Windows 10 machine with Dart 2.10, run the following code, which copies a file with a symlink as the destination.
import 'dart:io' as io;

void main() {
  var f = io.File('foo')..createSync()..writeAsStringSync('foo');
  io.File('bar')..createSync()..writeAsStringSync('bar');
  io.Link('symlink').createSync('bar');
  f.copySync('.\\symlink');
  print(io.FileSystemEntity.typeSync('symlink', followLinks: false));  // Expect: FileSystemEntityType:<link>
  print(io.File('bar').readAsStringSync()); // Expect: foo
}

Expected result:

Expected output is:

FileSystemEntityType:<link>
foo

which indicates that the copied file overwrites the symlink target instead of the symlink itself.

Actual result:

With Dart SDK version: 2.10.0-7.3.beta (beta) (Wed Aug 26 09:46:50 2020 +0200) on "windows_x64", I get:

FileSystemEntityType:<file>
bar

The copied file overwrote the symlink itself, not the symlink's target.

Additional details:

  • This works as expected with Dart SDK version: 2.9.3 (stable) (Tue Sep 8 11:21:00 2020 +0200) on "windows_x64", so this is a regression.
  • This seems to happen only if copySync's destination includes an explicit directory. That is, I get the expected behavior if I use f.copySync('symlink'); instead of f.copySync('.\\symlink').
  • This seems Windows-specific. (I tested on Windows 10 version 2004.)

This has been causing CI failures for package:file's LocalFileSystem tests on Windows.

@tvolkert tvolkert added area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. library-io vm-regression labels Sep 10, 2020
@tvolkert
Copy link
Contributor

@a-siva (relatively recent regression)

@a-siva
Copy link
Contributor

a-siva commented Sep 18, 2020

/cc @aam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. library-io vm-regression
Projects
None yet
Development

No branches or pull requests

3 participants