Commit Graph
1199 Commits
Author SHA1 Message Date
Jeremy Kuhne 3071222fa1 Check for name surrogates when deleting reparse points (dotnet/corefx#28124)
Name surrogates are the only type of reparse points that we should be simply detaching.
All other reparse points we should be drilling into- this was causing issues for OneDrive
cloud files.

Commit migrated from https://github.com/dotnet/corefx/commit/4ea280efe691313e08d7648064566440dd35190b
2018-03-16 14:53:51 -07:00
Anirudh Agnihotry 4a52e4c4e0 Fixing NonBreakingSpace test on OSX using FSAssert (dotnet/corefx#28094)
Commit migrated from https://github.com/dotnet/corefx/commit/a89e7ad8e09fe133fefd76aea902232892453561
2018-03-15 12:45:40 -07:00
Jan Kotas 27e74e82eb Fix unbounded stackalloc in System.IO.FileSystem (dotnet/corefx#28004)
Commit migrated from https://github.com/dotnet/corefx/commit/bf36018813d2724e5bc9140d72e0d8bf92f2b621
2018-03-12 21:23:36 -07:00
Wes Haggard 4195372484 Merge pull request dotnet/corefx#27881 from weshaggard/ReverseApiCompat
Enable reverse APICompat for 1:1 libraries

Commit migrated from https://github.com/dotnet/corefx/commit/c45c7a7439ab2925d1a6e17e80f396a6bd35c17b
2018-03-12 10:21:05 -07:00
Jeremy Kuhne 04f40ee2bb More FileSystem tests (dotnet/corefx#27955)
- Fix dotnet/corefx#27244 validation
- Add more enumerable tests

Fixes dotnet/corefx#27244

Commit migrated from https://github.com/dotnet/corefx/commit/b4dfbadf5dd4410616061ddb1057f1bcee7bb41f
2018-03-11 18:59:23 -07:00
Jeremy Kuhne 10c2a8b41a Add more alternate data stream tests (dotnet/corefx#27945)
Commit migrated from https://github.com/dotnet/corefx/commit/de1878e129d4e44f4bccac3bae28612357c6a79d
2018-03-10 23:31:04 -08:00
Jeremy Kuhne 4f51a26e7e Start adding alternate data stream tests (dotnet/corefx#27931)
* Start adding alternate data stream tests

Also fill out ExampleTests.

* Skip on NetFX


Commit migrated from https://github.com/dotnet/corefx/commit/f35784eec7b78132e8c257e5f96f3e62aad14533
2018-03-10 17:30:01 -08:00
Jeremy Kuhne 231f26e3dd Test changes for System.IO.FileSystem (dotnet/corefx#27923)
* Test changes

- Add new tests for more coverage on enumeration
- Re-enable tests

* Add missing assert


Commit migrated from https://github.com/dotnet/corefx/commit/0e70b43de9d13a629082ec878411c4662557e9e1
2018-03-09 20:01:56 -08:00
Wes Haggard 4d97955681 Consolidate matching ref generated baseline files
This change collapses some baseline files as well as fixes
some of the reference mis-matches


Commit migrated from https://github.com/dotnet/corefx/commit/8842923d3d6bc357d39b34c93353df952ac02079
2018-03-09 15:43:29 -08:00
Wes Haggard dccc06ade2 Baseline all reverse apicompat issues
Commit migrated from https://github.com/dotnet/corefx/commit/ddb31b5d2f393cf1a16653ff99736a6f25cd98b5
2018-03-09 15:43:29 -08:00
Anirudh Agnihotry b543c3ed1c WhiteSpace and PrefixParent subdirectory names throw exception (dotnet/corefx#27810)
Commit migrated from https://github.com/dotnet/corefx/commit/59f6987b7fc919a438060f6c502c3c9cf7c8af29
2018-03-07 17:02:05 -08:00
Anirudh Agnihotry 2a687498bb Test for enumerateDirectories NonBreaking space (dotnet/corefx#27762)
Commit migrated from https://github.com/dotnet/corefx/commit/61aaf07bf486e457fa6d3f19f8335b0d536d7bca
2018-03-07 16:59:14 -08:00
Jeremy Kuhne afb3e61fb6 Dial back \\?\ insertion (dotnet/corefx#27827)
Only premptively adding for FileSystemInfo if we end in period or space.
Long path is taken care of later.

Clean up code a little and add test for DirectoryInfo.Move.

Commit migrated from https://github.com/dotnet/corefx/commit/cc4abcad12da4d6abe4af8c5b4cd9d328ca97715
2018-03-07 15:58:06 -08:00
Jeremy Kuhne 91eeb8e129 Support trimmed paths in FileInfo (dotnet/corefx#27809)
* Support trimmed paths in FileInfo

Some paths are not creatable in Windows without special syntax. Notably paths with trailing spaces and periods. As GetFullPath() (and GetFullPathName()) trim these we would lose the correct file name as we passed the path around. With the enumeration changes we now populate FileInfo correctly- this change allows the other methods to work when wrapped around such a path.

* Tweak comments.
Remove NotSupported and SecurityException from Exists as these are no longer thrown.
Add a test fix I hadn't staged correctly.


Commit migrated from https://github.com/dotnet/corefx/commit/41a2120b233cc02c175f812e4e19e3f058396cb0
2018-03-07 10:14:24 -08:00
Anirudh Agnihotry 6dff4e5f8e enable failing tests due to paths (dotnet/corefx#27681)
Commit migrated from https://github.com/dotnet/corefx/commit/91b311e840646cd343db5cb97622b53ce14334e3
2018-03-05 10:25:12 -08:00
Jan Kotas a015dbdcc0 Cleanup one last StringBuilderCache usage in System.IO.FileSystem (dotnet/corefx#27720)
ReadAllTextAsync is convenience method that allocates a lot anyway, so the saving from StringBuilderCache is unlikely to show up. And this method is unlikely to be used for small strings where StringBuilderCache helps anyway.

Commit migrated from https://github.com/dotnet/corefx/commit/80918915b4df50047e763a3a6ee36aa20809e6da
2018-03-05 09:04:42 -05:00
Stephen Toub 7482b6a4b0 Expose and roll out ValueTask extensibility
This commit does several things:
- Exposes the new `ValueTask` extensibility model being added in coreclr.  The ValueTask-related files will separately be mirrored over to corefx to enable the netstandard build of System.Threading.Tasks.Extensions.
- Adapts all `Stream`-derived types to return `ValueTask` instead of `Task` from `WriteAsync`.
- Changes the new `WebSocket` `SendAsync` method to return `ValueTask` instead of `Task`, and updates the `ManagedWebSocket` implementation accordingly.  Most `SendAsync`s on `ManagedWebSocket` should now return a `ValueTask` that's either completed synchronously (no allocation) or using a pooled object.  It now uses the underlying transport's new `WriteAsync` overload that returns `ValueTask`.
- Switches more uses of `ReadAsync` and `WriteAsync` over to the new overloads, including in Process, DeflateStream, BrotliStream, File, HttpClient, SslStream, WebClient, BufferedStream, CryptoStream,
- Removed some unnecessary array clearing from various routines using ArrayPool (after the clearing was added we changed our minds and decided clearing was only necessary in very specific circumstances)
- Implements a custom `IValueTaskSource` in Socket, such that async receives and sends become allocation-free (ammortized).  `NetworkStream` then inherits this functionality, such that its new `ReadAsync` and `WriteAsync` are also allocation-free (in the unbounded channel implementations; we can subsequently add it in for bounded).
- Implements a custom `IValueTaskSource` in System.Threading.Channels, such that reading and writing are ammortized allocation-free up to one concurrent reader and writer.
- A few random things I noticed as I was going through, e.g. missing ConfigureAwait, some incorrect synchronization in tests, etc.
- Adds a ton of new tests, mainly in System.Threading.Tasks.Extensions, System.Threading.Channels, and System.Net.Sockets.


Commit migrated from https://github.com/dotnet/corefx/commit/6d1671b2cfcf130b7bc6c059bb0508073426532a
2018-03-02 09:56:25 -08:00
Jeremy Kuhne 26afe83908 Remove span helpers, use mirrored PathInternal helper (dotnet/corefx#27585)
* Remove span helpers, use mirrored PathInternal helper

Remove other unnecessary helpers (notably with Path.Join available)

* Fix Unix


Commit migrated from https://github.com/dotnet/corefx/commit/f25eb288a449010574a6e95fe298f3ad880ada1e
2018-02-28 22:30:31 -08:00
William Godbe c46aedadc2 Stop FileSystem WriteAsync test from writing too much data to disk (dotnet/corefx#27387)
* Stop FileSystem WriteAsync test from writing too much data to disk

* Fix TotalBytesWritten

* Move bytes written cap to inner loop

* Fix do/while syntax, add cancellation token back

* Remove token


Commit migrated from https://github.com/dotnet/corefx/commit/09b4ad86c48485426feb2536d7d48dd36ba9c884
2018-02-28 22:01:06 -08:00
Dan Moseley 0c07197707 Logging for TimesIncludeMillisecondPart test and reenable for Linux (dotnet/corefx#27559)
* Logging for TimesIncludeMillisecondPart test

* Enable test for Linux

* Formatting


Commit migrated from https://github.com/dotnet/corefx/commit/0c4fe29556861d5e728cd1f47afb687eb2711623
2018-02-28 21:45:20 -08:00
Jeremy Kuhne a7998874ee Fix a bug in TranslateWin32Expression (dotnet/corefx#27539)
Add test coverage.

Commit migrated from https://github.com/dotnet/corefx/commit/d2a2221640d86036e0d5e6cf51f6d3a8258e6baa
2018-02-28 10:11:41 -08:00
Stephen Toub ff964cd53c Disable failing System.IO tests
Commit migrated from https://github.com/dotnet/corefx/commit/303922a96cc14b3db2150c01f44ffe5dacb18fee
2018-02-28 09:03:28 -05:00
Stephen Toub 1c54785d43 Make File.Move copy when the file system doesn't support link (dotnet/corefx#27371)
Commit migrated from https://github.com/dotnet/corefx/commit/fb0cbae3e0275fdf9b2b7bc734422c88285acafb
2018-02-22 16:34:01 -05:00
Jeremy Kuhne 973cec3dd6 Update tests for Path changes (dotnet/corefx#27348)
* Update tests for Path changes

Updates for https://github.com/dotnet/coreclr/pull/16478

* Add back Unix active issue (wishful thinking that this would get the same error on Unix)

* Address feedback


Commit migrated from https://github.com/dotnet/corefx/commit/92afa6ec21817739ebf45cd66b4569a03b54d4c0
2018-02-22 12:13:29 -08:00
Jeremy Kuhne c60340730c Make final API review changes to file enumeration (dotnet/corefx#27318)
* Make final API review changes to file enumeration

Tweak stack array initialization to just zero the first element in matcher algorithm.

cc: @danmosemsft @terrajobst

* Don't null out the native name to track conversion


Commit migrated from https://github.com/dotnet/corefx/commit/62878f34d65f8bac6f7ebd91083fb9a02866de98
2018-02-21 19:32:31 -08:00
Atsushi Kanamori 0cebe1e3f1 Rename string-slicing extension methods (dotnet/corefx#27328)
* Rename string-slicing extension methods

As part of 

https://github.com/dotnet/corefx/issues/26894

the api folks have approved renaming AsROSpan and AsROMemory
on string instances to AsSpan and AsMemory (as the "readonly"
is obvious given the read-only nature of the input.)

This puts the renaming in effect. Basically a big search-replace
commit.

* Fix OpenSSL build break

* I see this is going to be a treadmill


Commit migrated from https://github.com/dotnet/corefx/commit/3538128fa1fb2b77a81026934d61cd370a0fd7f5
2018-02-21 11:48:51 -08:00
Jan Kotas 40fb7ad23d Replace ValueStringBuilder.set_Length with indexer (dotnet/corefx#27274)
Indexer that let's you see and edit the content of the pending string is more efficient and flexible.

Fixes dotnet/corefx#26643

Commit migrated from https://github.com/dotnet/corefx/commit/e45523d96acf833d727636fffeeb763b02a2360e
2018-02-20 11:14:57 -05:00
Stephen Toub 971d1b5a8d Disabling CanRecurseFromRoot test, again (dotnet/corefx#27276)
Commit migrated from https://github.com/dotnet/corefx/commit/2fe35d98cd2ceb7e5649321a49039ec27ccbff6e
2018-02-20 08:02:52 -05:00
Jeremy Kuhne 2302d48348 Handle errors getting state in Unix (dotnet/corefx#27239)
* Handle errors getting state in Unix

Throwing errors while examining extended state while enumerating isn't consistent with Windows behavior. Windows never throws past getting directory entry data as all state is already available.

Ensure entry attribute state is consistent with initial construction.

* Win 7 CI machines are also setting NotContentIndexed.


Commit migrated from https://github.com/dotnet/corefx/commit/597f44c5056badfb47f45731480454d698849800
2018-02-19 21:01:21 -08:00
Jeremy Kuhne 5fc9a345f7 Update root dir enum test (dotnet/corefx#27254)
Update assert for better logging. Skip directory entries.

fixes dotnet/corefx#27244

Commit migrated from https://github.com/dotnet/corefx/commit/59b2bfdc28ab814553601379392ebfe24eb610aa
2018-02-19 17:22:47 -08:00
Stephen Toub 47813df24c Disable CanRecurseFromRoot test (dotnet/corefx#27252)
Commit migrated from https://github.com/dotnet/corefx/commit/336bc1868948c01db4ba72be49c2b959099e542d
2018-02-19 12:57:48 -05:00
Jeremy Kuhne 1db4e20423 Fix enumerating the root directory. (dotnet/corefx#27223)
* Fix enumerating the root directory.

Shouldn't trim the trailing separator when at the root. On Windows that makes
the path drive relative- which breaks most of the logic.

Add a test to catch this case.

* Add the Unix part of the fix.


Commit migrated from https://github.com/dotnet/corefx/commit/5b4ce203c563a20053f32f9901ea6b7dc67c8e37
2018-02-16 21:52:07 -08:00
Jeremy Kuhne e9d845d7ff Use NtCreateFile on Win32 (dotnet/corefx#27195)
NtCreateFile allows passing in a base handle which makes opening child directories much faster. This cuts anywhere from 3-10% of the time off of a GetFiles() call.

It is significantly faster as it avoids normalization and path parsing overhead.

Commit migrated from https://github.com/dotnet/corefx/commit/a28a2cdda67c024126f690bbe1331174a194f9ce
2018-02-16 11:10:07 -08:00
Jeremy Kuhne 23c14fe5cf Remove FileSystem unused common files (dotnet/corefx#27184)
Also update .sln using UpdateVSConfigurations

Commit migrated from https://github.com/dotnet/corefx/commit/7eb6dba62ec630d33db7dcd9e810a937a92d975f
2018-02-15 18:45:51 -08:00
Jeremy Kuhne b6811353d3 Change RootDirectory properties to span (dotnet/corefx#27134)
Exposing string restricts the ability to change internals without introducing unnecessary allocations.

Commit migrated from https://github.com/dotnet/corefx/commit/3ac69e86e0c8e654a9802bf593fdc98ea69a4fb8
2018-02-15 16:41:51 -08:00
Jeremy Kuhne 3bbc710304 Current directory code duplicates Environment (dotnet/corefx#27153)
Just call Environment.CurrentDirectory. Remove a number of P/Invokes
that are no longer in use.

Commit migrated from https://github.com/dotnet/corefx/commit/8e6222ab2f2b48f20a274272693665dac8259c79
2018-02-15 10:32:03 -08:00
Jeremy Kuhne 8dc5e67384 Cleaning out dead code (dotnet/corefx#27150)
Also refactor Unix attribute handling a bit to be more consistent and
ensure that we don't make unnecessary addtional filesystem calls.

Commit migrated from https://github.com/dotnet/corefx/commit/16f26ba855f5cc6d52a738e8bc3856c6f77cf761
2018-02-14 22:49:17 -08:00
Maryam Ariyan 065c7bfa8e Adding test to verify FileStream.Dispose() ignores IO Related Exception in finalizer (dotnet/corefx#26921)
* Adding test to verify FileStream.Dispose() skips IO Related Exception only on finalization

* Skipping test on netfx because the behavior in netfx is different


Commit migrated from https://github.com/dotnet/corefx/commit/a15cc53eb5a4248c76bdc60beb3e31628bd8acf8
2018-02-14 22:20:00 -05:00
Jeremy Kuhne 76fff21677 Add some pattern transformation tests (dotnet/corefx#27133)
Commit migrated from https://github.com/dotnet/corefx/commit/11182e0c4e65fb1e6fa0596ca9d991e3382c9fb2
2018-02-14 16:06:04 -08:00
Jeremy Kuhne 985d730865 API tweaks to match latest updates to spec (dotnet/corefx#27102)
* API tweaks to match latest updates to spec

Add a few new tests

See dotnet/corefx#25873

* Properly clear state when enumerating on Unix.
Make sure we don't include special directories in subdir processing. Add test.
Collapse helper that was only called in one place, and remove dead one.


Commit migrated from https://github.com/dotnet/corefx/commit/1c9cd8118abfa13165d88a4e660fbdcc6c2ebc4c
2018-02-13 21:49:57 -08:00
Stephen Toub f8e6f41b81 Clear initlocals in a bunch of assemblies (dotnet/corefx#26993)
* Clear initlocals in a bunch of assemblies

Sets
```XML
<ILLinkClearInitLocals>true</ILLinkClearInitLocals>
```
for the assemblies:
    - System.IO.FileSystem
    - System.IO.Pipes
    - System.Memory
    - System.Net.Http
    - System.Net.Http.WinHttpHandler
    - System.Net.NameResolution
    - System.Net.NetworkInformation
    - System.Net.Primitives
    - System.Net.Requests
    - System.Net.Security
    - System.Net.Sockets
    - System.Net.WebSockets
    - System.Net.WebSockets.Client
    - System.Net.WebSockets.WebSocketsProtocol
    - System.Private.Uri
    - System.Runtime
    - System.Runtime.Extensions

Eventually we'd ideally set the flag for the whole repo; these are just the ones I audited thus far.  In a few cases I had to make code changes to adapt, where the code was expecting stackallocs to be cleared.  I also looked at a few other projects (System.Collections, System.Runtime.Numerics) where there were more significant dependencies on clearing and I decided to leave those for later.

* Disable ILLinkClearInitLocals running on Unix until it works there


Commit migrated from https://github.com/dotnet/corefx/commit/f0a032e4a1c8a848574a5db3e69e8a6fa0aae91e
2018-02-13 06:30:25 -05:00
Jeremy Kuhne 478a57f64e Switch from using SafeHandle for Unix enumeration (dotnet/corefx#27052)
* Switch from using SafeHandle for Unix enumeration

* Address feedback

* Fix faceplant, dispose in test.


Commit migrated from https://github.com/dotnet/corefx/commit/c9100ffc2988a0faf0e92898762a445ccb3c0e13
2018-02-12 13:56:17 -08:00
Jeremy Kuhne fbbfa8167b Fix *Info classes for Unix when opened on root (dotnet/corefx#27024)
Commit migrated from https://github.com/dotnet/corefx/commit/5349873018e481a2ad8a14bbdd5ff237780f02e3
2018-02-10 17:19:49 -08:00
Stephen Toub e82ffa3f5f Add FileStream tests for custom OwnedMemory with Read/WriteAsync (dotnet/corefx#26931)
Commit migrated from https://github.com/dotnet/corefx/commit/7130581c8bd7114143628679624f7ae29cb56818
2018-02-10 07:11:12 -05:00
Jeremy Kuhne 99e5facebf Fix Unix enumeration (dotnet/corefx#27019)
For non-trivial recursive enumerations we were running out of file descriptors. Stop creating them when we queue pending subdirectories and only create when we dequeue.

Commit migrated from https://github.com/dotnet/corefx/commit/430de8f582afb111697dd1e203f5c7a20f46acb2
2018-02-09 20:33:26 -08:00
Jeremy Kuhne 8d26cb462d Make Unix filename conversion lazy (dotnet/corefx#26978)
* Make Unix filename conversion lazy

Also hook error handling.

* Address feedback


Commit migrated from https://github.com/dotnet/corefx/commit/ef0aca54454748002325b750c839dacba6ed3999
2018-02-08 22:50:38 -08:00
Jeremy Kuhne 113d51c8f3 Reduce Unix enumeration allocations (dotnet/corefx#26942)
* Reduce Unix enumeration allocations

This change factors out the FileStatus access into a helper struct and adds overloads
for the stat imports  that allow passing a span.

The next steps:

- Handle errors manually
- Skip using safehandle
- Look for further opportunities around UTF-8/16 conversion

* Address feedback

Shuffle code around a bit in FileInfo for clarity. Also shift directory determination
to FileSystemEntry to avoid allocation on links.


Commit migrated from https://github.com/dotnet/corefx/commit/c64171e379090b372fe232ec3f27a57ae838406c
2018-02-08 12:55:15 -08:00
Jeremy Kuhne 1ba1a9f26b Fix accessing trimmed paths (dotnet/corefx#26918)
* Fix accessing trimmed paths

Paths with trailing spaces or periods are normally trimmed by Windows. They can, however, be created using `\\?\` or be exposed via mapping of remote file systems. This change fixes the ability to work with returned *Info classes on files of this type.

This change also cleans up the Info classes:

- removes non-relevant comments
- removes "display" paths (limited trust holdover)

Also remove dead PathPair class.

* Fix helper for .NET Standard


Commit migrated from https://github.com/dotnet/corefx/commit/e2cd5a8fc468b63255f91f4f28bccddb3bb31e8f
2018-02-07 13:01:16 -08:00
Jan Kotas 5e6591c633 Delete dead or redundant code (dotnet/corefx#26890)
Commit migrated from https://github.com/dotnet/corefx/commit/2b90844626772de05c4ad4c5e349c67e1ded5aa5
2018-02-06 09:11:38 -08:00
Jeremy Kuhne 3d70535133 Add the ability to specify case matching behavior for GetFiles (dotnet/corefx#26876)
Commit migrated from https://github.com/dotnet/corefx/commit/08dad51fac5f51eaa8fe19ae0997dd6bfb9706ec
2018-02-05 20:02:52 -08:00