-
Notifications
You must be signed in to change notification settings - Fork 229
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
fix: symlinks handling #3298
base: master
Are you sure you want to change the base?
fix: symlinks handling #3298
Changes from 51 commits
0189750
7320081
963b645
b87e533
c087295
6e23dcc
b9b9314
4486f00
e49c45b
7e1cb20
05f6cd9
0a6ffaa
10b8e3e
f6bd8d2
bfc30e5
b1b69bc
d97bfe2
add6e5c
380a1e0
6623ea2
8e6aa02
aa391dc
dfb47e5
2705410
f3aa7c3
ad092c5
003a59d
73455c6
fa09a85
1a72dc3
3a58e92
ce5544a
d5b595b
7745fc7
af93eb1
8aa575d
9700d92
0dcf557
9c2c78d
42b0821
020f465
07b8cf9
68831dc
cdb66d3
f98d77d
599a42f
4ed382a
0c56b15
f620e18
7679721
f8ee397
6d2ef92
3bd1765
3837226
66b1ae3
d4a89e0
8909acf
778e35c
b179ccf
2d8ec9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,69 @@ | ||||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file | ||||||
// for details. All rights reserved. Use of this source code is governed by a | ||||||
// BSD-style license that can be found in the LICENSE file. | ||||||
|
||||||
import 'dart:io'; | ||||||
|
||||||
import 'package:path/path.dart' as p; | ||||||
import 'package:tar/tar.dart'; | ||||||
import 'package:test/test.dart'; | ||||||
|
||||||
import '../descriptor.dart'; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
To follow the pattern we have in other files. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||
import '../test_pub.dart'; | ||||||
|
||||||
Future<void> main() async { | ||||||
test('symlink directories are replaced by their targets', () async { | ||||||
await validPackage().create(); | ||||||
await dir('a', [file('aa', 'aaa')]).create(); | ||||||
await file('t', 'ttt').create(); | ||||||
|
||||||
await dir(appPath, [ | ||||||
dir('b', [file('bb', 'bbb')]), | ||||||
]).create(); | ||||||
Link(p.join(sandbox, appPath, 'symlink_to_dir_outside_package')) | ||||||
.createSync(p.join(sandbox, 'a')); | ||||||
sigurdm marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
Link(p.join(sandbox, appPath, 'symlink_to_dir_outside_package_relative')) | ||||||
.createSync(p.join('..', 'a')); | ||||||
Link(p.join(sandbox, appPath, 'symlink_to_dir_inside_package')) | ||||||
.createSync(p.join(sandbox, appPath, 'b')); | ||||||
Link(p.join(sandbox, appPath, 'symlink_to_dir_inside_package_relative')) | ||||||
.createSync('b'); | ||||||
Link(p.join(sandbox, appPath, 'b', 'l')).createSync(p.join(sandbox, 't')); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||
|
||||||
await runPub(args: ['publish', '--to-archive=archive.tar.gz']); | ||||||
|
||||||
final reader = TarReader( | ||||||
File(p.join(sandbox, appPath, 'archive.tar.gz')) | ||||||
.openRead() | ||||||
.transform(GZipCodec().decoder), | ||||||
); | ||||||
|
||||||
while (await reader.moveNext()) { | ||||||
final current = reader.current; | ||||||
expect(current.type, isNot(TypeFlag.symlink)); | ||||||
} | ||||||
|
||||||
await runPub(args: ['cache', 'preload', 'archive.tar.gz']); | ||||||
|
||||||
await dir('test_pkg-1.0.0', [ | ||||||
...validPackage().contents, | ||||||
dir('symlink_to_dir_outside_package', [ | ||||||
file('aa', 'aaa'), | ||||||
]), | ||||||
dir('symlink_to_dir_outside_package_relative', [ | ||||||
file('aa', 'aaa'), | ||||||
]), | ||||||
dir('b', [file('bb', 'bbb')]), | ||||||
dir('symlink_to_dir_inside_package', [ | ||||||
file('bb', 'bbb'), | ||||||
file('l', 'ttt'), | ||||||
]), | ||||||
dir('symlink_to_dir_inside_package_relative', [ | ||||||
file('bb', 'bbb'), | ||||||
file('l', 'ttt'), | ||||||
]), | ||||||
]).validate( | ||||||
p.join(sandbox, cachePath, 'hosted', 'pub.dev'), | ||||||
); | ||||||
}); | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done