This makes tests more reproducible, and makes it easier to copy commands between workspaces, or between a failing bot and a local workspace.
Change-Id: Ic8dd10a3540f314a406e5c5b0a23d97032e5d01d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508364
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Fixes#63418
When IOOverrides are active, `fseGetType` and `fseGetTypeSync` used
`utf8.encode(path)` which does not null-terminate the path. Native
APIs require null-terminated paths. Through luck the sync path worked
but the async path failed with `notFound`.
Update them to use `FileSystemEntity._toUtf8Array(path)` which correctly
null-terminates the path.
Tested: added a regression test to tests/standalone/io/io_override_test.dart
TAG=agy
CONV=ab6af504-d536-4a8d-88be-bc487b60e24d
R=bkonyi@google.com
CoreLibraryReviewExempt: No API changes.
Change-Id: I24e31efdcbecc703800b96a144e41a095a445cff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505201
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
The tests in `tests/standalone/package/` don't use the top level
`package_config.json` file; they use their own internal file, which
apparently hasn't been updated recently. This change bumps the version
of `package:expect` in that file to version 3.13, which will allow
`package:expect` to start using Dart language 3.13 features without
breaking tests.
Change-Id: Ia2975d540aa503e8f69944e0e1c275c56a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505580
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This CL enables the primary constructors feature by default in Dart 3.13.
The primary constructors feature is a brevity feature. There are no new semantics, but it allows us to express declarations in a less verbose way.
This feature allows one constructor and a set of instance variables to be specified in the header of a declaration.
Currently a declaration with a constructor and some fields is written as:
```dart
// Current syntax.
class Point {
int x;
int y;
Point(this.x, this.y);
}
```
With a primary constructor, we would write the above as:
```
class Point(var int x, var int y);
```
If a primary constructor needs an initializer list or a body, they can be
specified inside the class using the `this` body syntax:
```dart
class Point(var int x, var int y) {
this : assert(x >= 0) {
print('Point created at $x, $y');
}
}
```
As part of this feature, you can also use the `new` and `factory` keywords to
declare constructors in the class body without repeating the class name:
```dart
class Point {
int x, y;
// Equivalent to Point(this.x, this.y)
new(this.x, this.y);
// Equivalent to Point.origin()
new origin() : x = 0, y = 0;
// Equivalent to factory Point.clone(Point other)
factory clone(Point other) => Point(other.x, other.y);
}
```
To learn more about the feature, check out the feature specification located here: https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md
Tested: Has existing language, CFE, analyzer, analysis server tests.
Bug: https://github.com/dart-lang/sdk/issues/61524
Change-Id: I296f2fcd918b87bf2a1dd00256340759866c2423
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489241
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
1. The redirect credential leak was caused because the arguments to `shouldCopyHeaderOnRedirect` were passed in the wrong order
2. The HTTP request smuggling was caused by incorrect identification of chunked transfer encoding.
Closes https://github.com/dart-lang/sdk/pull/63133
GitOrigin-RevId: 1e6189fd7cd7b0360566f01d02c82a71de5d0f0a
Change-Id: I7c76615d12b6dac8888c1cdc3a6cab46199f6b0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493600
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
The `Match.operator[]` does the same thing and is
generally recommended (and shorter).
(I want to deprecate `group` and `groups`)
Tested: Refactoring.
CoreLibraryReviewExempt: Calling equivalent function.
Change-Id: I4c758968ae622fe16b7322be1b29b05b91e7fcd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489021
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Not removing from any file with a language marker.
Also not touching anything in `tests/language/primary_constructors`
or `.../private_named_parameters`, which are both assumed to be
primary constructor feature aware.
Two files rewritten from multi-test to error-test.
Change-Id: I43d444a35a41c7734f266794e9f167655692473f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480640
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Pausing read on the SecureSocket should pause read on the underlying
socket, because otherwise we will be stuck calling _readHandler
which will not read anything but still schedule an SSL filter
wasting CPU time.
Fixes https://github.com/dart-lang/sdk/issues/62037
CoreLibraryReviewExempt: No API changes, VM specific implementation change
Change-Id: I4144815d34c1e77a68533b6ebcb66c146a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467804
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Don't call native methods on a socket which is closed
or in process of being closed. On some OSes this will
crash the VM because underlying FD is actually a malloc
allocated handle object which will be destroyed by
the event handler once it receives and processes close
request.
BUG=b/335437875
TEST=standalone/io/abrupt_close_test
Change-Id: I557d725a6cce020a6a1e3df0bd3e2c836a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467841
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Basic support for Unix domain sockets on Windows within
the limitations of the operating system itself: no
support for abstract addresses, datagram or
packet sockets and ancillary data.
This also fixes File::GetType on Windows to correctly
identify reparse points representing AF_UNIX sockets
as such, rather then identify them as links.
Finally, it is worth noting that there is an existing
discrepancy between POSIX OSes and Windows: on POSIX OSes
File(sockPath).existsSync() returns true, but on Windows the
same code returns false because Unix domain sockets are not
considered regular files by stat.
This CL does a bunch of refactoring around RawAddr class which
surves as a wrapper around various structures in sockaddr_* family.
Distinguishing anonymous AF_UNIX address from abstract AF_UNIX
address requires passing around the length of the address
structure. Thus we incorporate this information into
RawAddr. This will also make possible to properly support
full-range of abstract AF_UNIX addresses in the future because
supporting these requires properly handling embedded NUL bytes.
(See https://github.com/dart-lang/sdk/issues/46158).
Fixes https://github.com/dart-lang/sdk/issues/41161
TEST=standalone/io/unix_socket
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try
Change-Id: I016cb33ebdd62f0cac1ae97d822105366a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457720
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Fixes bug in commit 25df2b3f11.
The code for converting FSEventStream notification into Dart format
was checking file existence using relative path instead of absolute
path. This caused it to incorrectly classify rename events which
were creations as deletions.
This was not caught by testing because this was not well covered
by the test and the test closest to checking this was even
disabled on Mac. CL updates updates the test to cover this better.
Fixes https://github.com/dart-lang/sdk/issues/61693
TEST=standalone/io/file_system_watcher_test
Change-Id: I2a7c984dfcec0be74c974f13b6ead7d86a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453880
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Existing implementation is an entangled mess which consists of shared
code residing in the base class which in random places invokes a number
of undocumented poorly named methods overloaded in OS specific
subclasses. Some of these methods mutate static state. There are no
clear lifetime guarantees for different parts of the system (including
comments saying that some values might or might not be valid at certain
points).
The rewrite aims to clean most of this up - sharing everything that can
be shared and moving OS specific logic to clearly documented methods.
Furthermore, we change the code to ensure proper lifetime guarantees -
so we no longer find ourself in situations where we don't know whether
pathId is valid or not.
This refactoring by itself fixes a number of issues, most specifically a
bug where watcher would stop receiving events on Windows because
DirectoryWatchHandle ends up allocated at precisely the same address as
a previous destroyed one - which confuses Dart side to think that newly
created handle is the same as the old one (due to a race between event
handler thread and Dart thread).
We fix Windows lifetime issue by a) not keeping pathId based mapping in
the watcher anymore and b) keeping DirectoryWatchHandler alive until it
is stoped by the Dart side - this is achieved by retaining it after it
is created and releasing it once path is unwatched. This way Dart side
is always sure that pathId values are valid until they are explicitly
released via _unwatchPath - which makes code very uniform.
To make sure that native objects created by _watchPath are released when
surrounding isolate exists abruptly (e.g. via Isolate.exit - without
letting Dart code to shutdown and call _unwatchPath naturally) we attach
NativeFinalizer to them. This fixes the existing leak of file watchers
on Mac OS X - as Node objects it created were not freed if surrounding
isolate exited. Note that inotify descriptors did not leak in the same
way because they were wrapped into sockets.
Finally, this refactoring also make sure that the last subscriber
cancelling subscription on filesystem event stream will get a proper
cancellation future back and can wait for the watcher to shutdown.
Previously implementation used broadcast streams which simply return an
already completed future when subscriber cancels. New implementation
uses Stream.multi instead which gives a better result. Now doing
watch().listen().cancel() returns a future which will only complete once
watcher is fully disposed (e.g. inotify descriptor is closed). Bad
behavior was revealed by analysing standalone/regress_52715 - which
revealed that repeatedly watching and cancelling might flakely cause us
to hit fd limit depending on whether eventhandler thread can keep up
closing file descriptors created by the main thread or not.
Fixes https://github.com/dart-lang/sdk/issues/61378
TEST=standalone/{regress_61378,file_system_watcher_isolate_exit_leak}
CoreLibraryReviewExempt: VM only changes.
Change-Id: I6a6a69642b1f2673f2be78434bc64270846ad8c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450921
Reviewed-by: Lasse Nielsen <lrn@google.com>
Bytecode doesn't fully support dart:mirrors and support for
dart:mirrors is already disabled in dart2bytecode.
This change disables dart:mirrors in the standalone VM running with
--interpreter flag and updates status files.
TEST=ci
Change-Id: Id9423bafb10926e8274835b77a6f50a825ad7fd7
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try,vm-ffi-dyn-mac-debug-simarm64_arm64-try,vm-ffi-dyn-mac-release-simarm64_arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/451580
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Avoid doing unnecessary allocations,
don't use `String.operator[]` to access single characters,
or creating substrings that are not needed.
Reuse the date-parser for cookie dates, instead of having two
separate parsers. The cookie-date-parser was very forgiving,
and only tested very little.
It's unlikely that there will be wildly different cookie formats
in actual use, when the specification only allows for one format.
Change-Id: I81b3620cc4476af3584b859f9c1eb80362f83979
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448383
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>