Commit Graph
1557 Commits
Author SHA1 Message Date
Adam Sitnik 8f87ac7bca avoid code duplication for disabling parallelization with xUnit (#62132)
The collection definitions must be in the same assembly as the test that uses them
2021-11-30 15:52:48 +01:00
Carlos Sanchez a2af8ae757 Re-enable Windows test that verifies DriveInfo.VolumeLabel setter fails on SUBST'd drive (#59850)
* Re-enable test that verifies DriveInfo.VolumeLabel setter fails on SUBST'd drive
2021-11-25 14:38:38 -08:00
Tom Deseyn a0fdc25640 FileSystem.Unix: Directory.Delete: remove per item syscall. (#59520)
* FileSystem.Unix: Directory.Delete: remove per item syscall.

By recursing using FileSystemEnumerable we know the file type and
can omit the stat calls made by DirectoryInfo.Exists.

For the top level path, we can omit the call also and handle
non-directories when rmdir errno is ENOTDIR.

For the recursive case we can avoid recursion when the top level path rmdir
succeeds immediately.

FileSystemEntry is updated so IsSymbolicLink remembers the file is symbolic link
and does not make a syscall for it.
2021-11-23 15:51:37 +01:00
Ankit JainandAlexander Köplinger ce93c291e4 [wasm] Run AOT, and Wasm.Build.Tests on windows (#59479)
Adds two new jobs to runtime-staging for Windows - AOT, and Wasm.Build.Tests.

AOT - runs with the same conditions as the one in runtime
Wasm.Build.Tests - run for rolling builds, or when a narrow set of paths related to wasm build change
And do this for corresponding job in runtime for linux

Co-authored-by: Alexander Köplinger <[email protected]>
2021-11-19 20:19:19 -05:00
Tom Deseyn 5181d12906 FileSystemEntry.Unix: ensure properties are available when file is deleted. (#60214)
* FileSystemEntry.Unix: ensure attributes are available when file is deleted.

When the file no longer exists, we create attributes based on what we know.

The test for this was passing because it cached the attributes before the
item was deleted due to enumerating with skipping FileAttributes.Hidden.

* GetLength: fix reading from uninitialized cache.
2021-11-18 10:28:27 +01:00
Adam SitnikandDan Moseley d1b381661c Minor File.ReadAllBytes* improvements (#61519)
* switch from FileStream to RandomAccess

* use Array.MaxLength as a limit for File.ReadAllBytes and fix an edge case bug for files: Array.MaxLength < Length < int.MaxValue

* there is no gain of using FileOptions.SequentialScan on Unix, as it requires an additional sys call

Co-authored-by: Dan Moseley <[email protected]>
2021-11-17 13:29:49 +01:00
Hamish Arblaster f9d05bd2f3 Fix LastWriteTime and LastAccessTime of a symlink on Windows and Unix (#52639)
* Implement most of the fix for #38824

Reverts the changes in the seperate PR https://github.com/dotnet/runtime/commit/a617a01195b4dad3cb5f300962ad843b46d4f175 to fix #38824.
Does not re-enable the test because that relies on #49555, will add a seperate commit to whichever is merged last to enable the SettingUpdatesPropertiesOnSymlink test.

* Most of the code for PR #52639 to fix #38824

• Deal with merge conflicts
• Add FSOPT_NOFOLLOW for macOS and use it in setattrlist
• Use AT_SYMLINK_NOFOLLOW with utimensat (note: there doesn't seem to be an equivalent for utimes)
• Add SettingUpdatesPropertiesOnSymlink test to test if it actually sets it on the symlink itself (to the best that we can anyway ie. write + read the times)
• Specify FILE_FLAG_OPEN_REPARSE_POINT for CreateFile in FileSystem.Windows.cs (is there any other CreateFile calls that need this?)

* Remove additional FILE_FLAG_OPEN_REPARSE_POINT

I added FILE_FLAG_OPEN_REPARSE_POINT before and it was then added in another PR, this removes the duplicate entry.

* Add missing override keywords

Add missing override keywords for abstract members in the tests.

* Fix access modifiers

Fix access modifiers for tests - were meant to be protected rather than public

* Add more symlink tests, rearrange files

• Move symlink creation api to better spot in non-base files
• Add IsDirectory property for some of the new tests
• Change abstract symlink api to CreateSymlink that accepts path and target
• Create a CreateSymlinkToItem method that creates a symlink to an item that may be relative that uses the new/modified abstract CreateSymlink method
• Add SettingUpdatesPropertiesCore to avoid code duplication
• Add tests for the following variants: normal/symlink, target exists/doesn't exist, absolute/relative target
• Exclude nonexistent symlink target tests on Unix for Directories since they are counted as files

* Fix return type of CreateSymlink in File/GetSetTimes.cs

* Remove browser from new symlink tests as it doesn't support creation of symlinks

Remove browser from new symlink tests as it doesn't support creation of symlinks

* Use lutimes, improve code readability, simplify tests

• Use lutimes when it's available
• Extract dwFlagsAndAttributes to a variable
• Use same year for all tests
• Checking to delete old symlink is unnecessary, so don't
• Replace var with explicit type

* Change year in test to 2014 to reduce diff

* Rename symlink tests, use 1 core symlink times function, and check that target times don't change

Rename symlink tests, use 1 core symlink times function, and check that target times don't change

* Inline RunSymlinkTestPart 'function'

Inline RunSymlinkTestPart 'function' so that the code can be reordered so the access time test can be valid.

* Share CreateSymlinkToItem call in tests and update comment for clarity

* Update symlink time tests

• Make SettingUpdatesPropertiesOnSymlink a theory
• Remove special case for Unix due to https://github.com/dotnet/runtime/pull/52639#discussion_r739009259 (will revert if fails)
• Rename isRelative to targetIsRelative for clarity

* Remove unnecessary Assert.All

* Changes to SettingUpdatesPropertiesOnSymlink test

• Rename item field to link field
• Don't use if one-liner
• Use all time functions since only using UTC isn't necessary
• Remove the now-defunct IsDirectory property since we aren't checking it anymore

* Remove unnecessary fsi.Refresh()

• Remove unnecessary fsi.Refresh() since atime is only updated when reading a file

* Updates to test and pal_time.c

• Remove targetIsRelative cases
• Multi-line if statement
• Combine HAVE_LUTIMES and #else conditions to allow more code charing

* Remove trailing space
2021-11-15 11:45:31 -08:00
Viktor Hofer 0964be0ae9 Update slngen and solution files (#60871)
Update slngen tooling to latest stable version and solution files since
a lot changed since the last time they were updated:
- NET7 (removal of older TFMs)
- Source Generators
2021-10-26 21:23:54 +02:00
Hamish ArblasterandDavid Cantú 7cd8f19225 Fix setting creation date for OSX-like platforms (#49555)
* Fix setting creation date for OSX

Fix for #39132

* Fix setting creation date for OSX - fix for setattrlist

This commit adds a fallback for setattrlist failing.
It can sometimes fail on specific volume types, so this is a workaround to use the old behaviour on unsupported filesystems.

Fix for #39132

* Fix setting creation date for OSX - fix for caching when set time & possible stack overflow

This commit adds _fileStatusInitialized = -1; which resets the cache for the file status after setting a time value to the file using the setattrlist api version so that it will not simply return the last cached time.
It also fixes SetCreationTime_OtherUnix method so that it calls SetLastWriteTime_OtherUnix directly instead of SetLastWriteTime because otherwise you'll get stuck in an infinite loop on OSX when the fallback is theoretically needed.

Fix for #39132

* Fix setting creation date for OSX - changes for PR 1

Fix the behaviour of SetLastWriteTime (OSX) when setting lastwritetime before creationtime.
Use Invalidate() instead of _fileStatusInitialized = -1, and only when appropriate as per PR #49555.
Add SettingUpdatesPropertiesAfterAnother test to test things such as setting lastwritetime to before creationtime.
Rename the added _OtherUnix methods to _StandardUnixImpl, a more logical name given their purpose (#49555)

Fix for #39132 and issues in #49555.

* Fix setting creation date for OSX - changes for PR 2

Added a new test to test the behaviour of the file time functions on symlinks as per standard Windows behaviour, and also what I use in my code today. It makes sure that the times are set on the symlink itself, not the target. It is likely to fail on many unix platforms, so these will be given the [ActiveIssue] attribute when we discover which ones.
Make access time be set using setattrlist on OSX to fix following symlinks issue that would've failed the new test.
Fix and update wording of comment in SetAccessOrWriteTime.
Add T CreateSymlinkToItem(T item) to BaseGetSetTimes<T> (and implementation in inheritors) for the new test.
Made the SettingUpdatesPropertiesAfterAnother test skip on browser since it only, in effect, has one date attribute.

Fix for #39132 and issues in #49555.

* Fix setting creation date for OSX - changes for PR 3

Revert change in last commit: Make access time be set using setattrlist on OSX to fix following symlinks issue that would've failed the new test. It is now using the other API as otherwise some file watcher tests fail.
Set AT_SYMLINK_NOFOLLOW in pal_time.c to not follow symlinks for access time on OSX, or any times on other unix systems.

* Fix setting creation date for OSX - fix test for Windows and browser + update comments

Fix the SettingUpdatesPropertiesOnSymlink test for Windows by setting FILE_FLAG_OPEN_REPARSE_POINT in the CreateFile used for setting times.
Disable the SettingUpdatesPropertiesOnSymlink test for Browser as it can't use symlinks with the current API in the test project.
Update comments.
Add FILE_FLAG_OPEN_REPARSE_POINT.

Fix for #39132 and issues in #49555.

* Fix setting creation date for OSX - make modification time use normal unix APIs

Only implement creation time setting with setattrlist.
Here is why: eg. the old code doesn't account for setting creation time to 2002, then setting modification time to 2001, and then setting access time (since access time didn't have the creation date check).
I've split up SetAccessOrWriteTime into 3 parts - SetAccessOrWriteTime, SetAccessOrWriteTime_StandardUnixImpl, and SetAccessOrWriteTimeImpl (this last one contains the logic of the method without the things like refreshing the times so it's not called twice on OSX). In this process I replaced the _fileStatusInitialized = -1 calls with Invalidate() calls. And to make sure that if the creation time is needed to be set by SetAccessOrWriteTime, then we don't get in an infinite loop in case setattrlist fails, so we call SetAccessOrWriteTime_StandardUnixImpl.

* Fix setting creation date for OSX - hotfix: Remove ATTR_CMN_MODTIME

Adding this commit now to avoid 2x CI.
It was meant to be in the last one, but I forgot to save the file.

Fix for #39132 and issues in #49555.

* Fix setting creation date for OSX - revert windows changes & simplify code

Revert the changes for Windows & disable the SettingUpdatesPropertiesOnSymlink test on Windows.
Remove unnecessary setting to 0 on the attrList variable.
Remove the unnecessary MarshalAs attributes in the AttrList type.

Fix for #39132 and issues in #49555.

* Fix setting creation date for OSX - hotfix: change to CULong for marshalling with setattrlist

Use CULong as per https://github.com/dotnet/runtime/pull/49555#discussion_r599986776

Fix for #39132 and issues in #49555.

* Fix setting creation date for OSX - hotfix: change to CULong for marshalling with setattrlist 2

Use CULong as per #49555 (comment)
Forgot to save the other file's changes

Fix for #39132 and issues in #49555.

* Fix setting creation date for OSX - consolidate unix nanosecond calculation

Consolidate unix nanosecond calculation into UnixTimeSecondsToNanoseconds as per https://github.com/dotnet/runtime/pull/49555#discussion_r600004629.

Fix for #39132 and issues in #49555.

* Use InvalidateCaches instead of Invalidate and EnsureCachesInitialized instead of EnsureStatInitialized

* Fixes for reviews in PR #49555

Add an identifying field to the TimeFunction tuple and a function to get a TimeFunction from the name.
This function is then used so that SettingUpdatesPropertiesAfterAnother can be written as a Theory, and is a lot more readable.
Fix some comments that were incorrect.

* Hotfix for missing parameter

* Fix naming

* Revert changes re SettingUpdatesPropertiesAfterAnother (mainly) and revert using a Theory

Reversion as per https://github.com/dotnet/runtime/pull/49555#discussion_r633895912
This change can be unreverted if that's what's decided.

* Fix errors of #49555 due to missing variables

* Remove the parameters that were meant to be removed

* Finish merge

* Remove duplicate file

* Add custom error handling for setattrlist

Add custom error handling for setattrlist as per https://github.com/dotnet/runtime/pull/49555#discussion_r633788259.

ENOTDIR means it is not a directory, so directory not found seems logical to me, I think the other errors can be dealt with by an IOException, happy to change this.

* Remove symlink specific code from this PR

Removes the symlink specific code as per https://github.com/dotnet/runtime/pull/49555#issuecomment-904413721.
This will be reverted (and modified) as per https://github.com/dotnet/runtime/pull/49555#issuecomment-904413721 into #52639.

* Remove custom ENOTDIR handling, enable tests for other OSX-like platforms + move items in project file

• Removed ENOTDIR handling as per https://github.com/dotnet/runtime/pull/49555#discussion_r705012504
• Enabled tests for other OSX-like platforms since the code was included on them (IsOSXLike is presumably defined at src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs). If it fails on any of these platforms, they'll be fully explicitly excluded everywhere for this PR or fixed.
• Move item in project file (System.Private.CoreLib.Shared.projitems) as per https://github.com/dotnet/runtime/pull/49555#discussion_r705032218

* Rename files according to review

Rename files according to https://github.com/dotnet/runtime/pull/49555#discussion_r705073538 (and nearby comments).

* Change names of functions to improve readability and refactor code

This commit changes and refactors the core functions of this PR to have clearer names and to create a more logical flow of the code. It also updates some comments and fixes some oversights. Changes are based on the discussion https://github.com/dotnet/runtime/pull/49555#discussion_r705180391 (read whole conversation).

* Fix the wrongly named variable and add the missing 'unsafe' keyword

Fix the wrongly named variable and add the missing 'unsafe' keyword

* Better comments and minor improvements

Changes according to https://github.com/dotnet/runtime/pull/49555#pullrequestreview-753354257
• Use explicit type `IEnumerable<TimeFunction>` instead of var
• Use PlatformDetection rather than OperatingSystem
• Move the InvalidateCaches code for creation time setting to avoid unnecessary checks
• Update explanatory comments to be more useful

* Add additional tests and improvements

- Use tuple destruction to swap variables
- Add SettingOneTimeMaintainsOtherDefaultTimes and AllDefaultTimesAreSame test as per https://github.com/dotnet/runtime/pull/49555#discussion_r712787328
- Change TFM(/s) as per https://github.com/dotnet/runtime/pull/49555#discussion_r717042126
- Avoid unnecessary call to `UnixTimeToDateTimeOffset` as per https://github.com/dotnet/runtime/pull/49555#discussion_r712606875
- Use InvalidOperationException as per https://github.com/dotnet/runtime/pull/49555#discussion_r717040240

* Fix typos

* Revert to <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser</TargetFrameworks>

Revert to using <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser</TargetFrameworks> since <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> failed; I wouldn't be surprised if this failed too.

* Remove SettingOneTimeMaintainsOtherDefaultTimes and AllDefaultTimesAreSame tests

Remove SettingOneTimeMaintainsOtherDefaultTimes and AllDefaultTimesAreSame tests since they don't work on windows because it is apparently an invalid time. Additionally, the function SettingOneTimeMaintainsOtherDefaultTimes wasn't working and needed to be fixed.

* Fix: setattrlist can only return 0 or -1

As per https://github.com/dotnet/runtime/pull/49555#discussion_r731451808, use GetLastErrorInfo to get the error when setattrlist indicates that there is one.

Co-authored-by: David Cantú <[email protected]>

* Update code comment for SettingUpdatesPropertiesAfterAnother test

The comment is now clearer and grammatically correct :)

* Update code comment for SettingUpdatesPropertiesAfterAnother test

Describe how utimensat change more dates than would be desired

* Update comment for SettingUpdatesPropertiesAfterAnother for consistency

Update for consistency with the comment in FileStatus.Unix.cs

* Fixes for compilation and update to comment

• Fix trailing spaces and incorrect capitalisation in FileStatus.SetTimes.OSX.cs
• Add more info to the comment in the SettingUpdatesPropertiesAfterAnother test

* Update FileStatus.SetTimes.OSX.cs

Use the Error property

* Move comments and add explicit types to SettingUpdatesPropertiesAfterAnother test

Move comments and add explicit types to SettingUpdatesPropertiesAfterAnother test

Co-authored-by: David Cantú <[email protected]>
2021-10-20 11:04:40 -07:00
David Cantú 661a0cdb72 Move NoInt32OverflowInTheBufferingLogic to OuterLoop and address pending feedback (#60606) 2021-10-19 10:42:43 +02:00
Santiago Fernandez Madero b201a16e1a Merge feature/use-dllimport-generator to main #59579 2021-10-18 16:12:39 -07:00
Adam SitnikandCarlos Sanchez ea58ba6717 Fix Int32 overflow bug in buffering logic (#60459)
* add a failing test

* fix the bug in BufferedFileStreamStrategy

* extend the test and fix it in the BufferedStream as well

* large files are currently not supported on WASM

* Apply suggestions from code review

Co-authored-by: Carlos Sanchez <[email protected]>

Co-authored-by: Carlos Sanchez <[email protected]>
2021-10-15 14:19:59 -07:00
Elinor Fung 5a79d9623c Merge branch 'main' into feature/use-dllimport-generator 2021-10-15 14:16:34 -07:00
Adam Sitnik 53590db55d disable flaky ReadAllBytes_NonSeekableFileStream_InWindows (#60471)
* shorten the timeout

* try to reorder the operations

* Revert "try to reorder the operations"

This reverts commit 413ee9b14f114246fc5659d4a1515e6fefc21cd2.

* disable the test for now
2021-10-15 12:43:36 -07:00
Elinor Fung 39048dd5de Undo solution and config changes from DllImportGenerator (#60481)
* Remove dotnet-experimental feed from NuGet.config
* Revert changes to solution files and restore configs
2021-10-15 11:06:12 -07:00
cf49643711 File.*AllText* optimizations (#58167)
Co-authored-by: Stephen Toub <[email protected]>
Co-authored-by: David Cantú <[email protected]>
2021-10-14 16:39:59 +02:00
Theodore TsirpanisandStephen Toub 37d25143b7 Follow up on Scatter/Gather API changes (#58447)
* Allocate an array of memory handles only if needed.

* Remove an unnecessary variable in the multiple-syscall write gather.

* Actually verify the content read by the read scatter operation.

* Delay allocating native memory.

* Verify that the whole file was read in the scatter/gather test.

* Test the case when the scatter/gather buffers are acceptable by the Windows API.

* Avoid null pointer dereferences when passing an empty segment array.

* Test performing scatter/gather I/O with an empty segment array.

Co-authored-by: Stephen Toub <[email protected]>
2021-10-14 15:22:13 +02:00
Carlos Sanchezandcarlossanlop dac1290d46 Run on both Win and Linux, but in OuterLoop with longer timeout. (#60149)
Co-authored-by: carlossanlop <[email protected]>
2021-10-14 14:36:56 +02:00
LateApexEarlySpeedandAdam Sitnik c2f287c945 Support unseekable filestream when ReadAllBytes[Async] (#58434)
Co-authored-by: Adam Sitnik <[email protected]>
2021-10-13 20:17:14 +02:00
825b264092 Fallback to read/write if pread/pwrite fails (#59846)
* Fallback to read/write if pread/pwrite fails

* * Cache whether a handle supports random access
* Keep avoiding pread/pwrite for unseekable files
* Fallback to read/write only for known error ENXIO

* Test more device paths and add tests for WriteAll*

* Fix CI: skip test when device can't be opened

* * Do not use SkipTestException
* Exclude EBADF from assertion

* use NullableBool in _supportsRandomAccess

* Add tests for mkfifo and socketpair

* Rename test file

* Address feedback in src

* Address suggestions

* Address suggestions

* Update src/libraries/System.IO.FileSystem/tests/FileStream/DevicesPipesAndSockets.cs

Use Lazy for thread-safety

Co-authored-by: Adam Sitnik <[email protected]>

* Use IEnumerable<string> in Lazy and fix usages

Co-authored-by: David Cantu <[email protected]>
Co-authored-by: Adam Sitnik <[email protected]>
2021-10-11 14:18:22 -07:00
Theodore Tsirpanis 3de620787a Remove Net5CompatFileStreamStrategy. (#57735) 2021-10-09 01:18:01 -07:00
Jeremy Koritzinsky 78f4fa8d82 Merge branch 'main' into feature/use-dllimport-generator 2021-10-07 16:40:51 -07:00
Jeremy Koritzinsky 2dff7cd61b Dllimport generator build and test fixes (#59658) 2021-10-06 09:40:26 -07:00
Tom DeseynandCarlos Sanchez 25d4999c5e FileStream.Unix: improve DeleteOnClose when FileShare.None. (#55327)
* FileStream.Unix: improve DeleteOnClose when FileShare.None.

Use FileShare.None lock to detect when another Handle that has
DeleteOnClose deleted the file, and then re-open it.

* Rephrase comment

* FileStream_DeleteOnClose: handle a few special cases.

* Try avoiding test timeout on arm

* Limit check to filemodes that open an existing file, or create it when it doesn't exist.

* PR feedback

* Limit functional change to FileMode.OpenOrCreate, and increase test timeout.

* Fix comment.

Co-authored-by: Carlos Sanchez <[email protected]>

Co-authored-by: Carlos Sanchez <[email protected]>
2021-10-05 12:45:21 -07:00
Jeremy Koritzinsky ea7e8171f6 Merge branch 'main' into feature/use-dllimport-generator 2021-10-01 18:35:26 -07:00
Dan MoseleyandStephen Toub 12b0ddb6b5 Remove 3 active issues (#59790)
* Remove 3 active issues

* Apply suggestions from code review

Co-authored-by: Stephen Toub <[email protected]>

Co-authored-by: Stephen Toub <[email protected]>
2021-10-01 09:40:55 -06:00
Jeremy Koritzinsky 752533d113 Merge branch 'main' into feature/use-dllimport-generator 2021-09-30 14:44:57 -07:00
Dan Moseley 96d72db9cb Partially disable test (#59760) 2021-09-29 18:30:59 -06:00
Jan Kotas 1a828eb9af Delete unused file (#59585) 2021-09-24 15:02:33 -07:00
Jeremy Koritzinsky d924fbc7e9 Merge branch 'main' of github.com:dotnet/runtime into merge-main 2021-09-24 09:26:18 -07:00
Tom DeseynandDavid Cantú 44b44501c7 File preallocationSize: align Windows and Unix behavior. (#59338)
* File preallocationSize: align Windows and Unix behavior.

This aligns Windows and Unix behavior of preallocationSize for the
intended use-case of specifing the size of a file that will be written.

For this use-case, the expected FileAccess is Write, and the file should be
a new one (FileMode.Create*) or a truncated file (FileMode.Truncate).
Specifing a preallocationSize for other modes, or non-writable files throws ArgumentException.

The opened file will have a length of zero, and is ready to be written to by the user.

If the requested size cannot be allocated, an IOException is thrown.

When the OS/filesystem does not support pre-allocating, preallocationSize is ignored.

* fix pal_io preprocessor checks

* pal_io more fixes

* ctor_options_as.Windows.cs: fix compilation

* Update tests

* tests: use preallocationSize from all public APIs

* pal_io: add back FreeBSD, fix OSX

* tests: check allocated is zero when preallocation is not supported.

* Only throw for not enough space errors

* Fix compilation

* Add some more tests

* Fix ExtendedPathsAreSupported test

* Apply suggestions from code review

Co-authored-by: David Cantú <[email protected]>

* Update System.Private.CoreLib Strings.resx

* PR feedback

* Remove GetPathToNonExistingFile

* Fix compilation

* Skip checking allocated size on mobile platforms.

Co-authored-by: David Cantú <[email protected]>
2021-09-23 09:25:49 -07:00
Jeremy Koritzinsky 27034bc84b Run slngen to regenerate the solution files. 2021-09-22 17:02:14 -07:00
Andrii Kurdiumov 5588f94924 Remove usused rd.xml files (#59201)
Closes #51112
2021-09-16 16:53:54 -06:00
Jeremy Koritzinsky 81293bfc1e Merge branch 'main' of https://github.com/dotnet/runtime into merge-main 2021-09-14 16:29:42 -07:00
Adam SitnikandStephen Toub 6115ca293f Align preallocationSize behavior (#58726)
Co-authored-by: Stephen Toub <[email protected]>
2021-09-14 13:30:39 +02:00
David Cantú 98c05df043 Address Windows recommendations for Link APIs (#58592)
* NT prefix shall not be treated as a relative path

* Remove file-folder-match validation

* Use SubstituteName instead of PrintName since the latter is just for display and can be misleading

* Fix MS.IO.Redist

* Fix whitespace in Strings.resx

* Address suggestions
2021-09-09 22:48:35 -07:00
Viktor Hofer 36b6247cc7 Update solution files for correct ordering of elements (#58655)
With the newest udpate of slngen, the order of elements (configuration, folders, etc.) is in sync with how Visual Studio arranges them.
Also the order is now deterministic.

Based on that, updating all solution files to have the correct ordering of elements. This change also unblocks adding CI protection for
making sure that solution files are up-to-date in regards to their dependencies as slngen is now generating the files deterministically.
2021-09-04 00:16:15 +02:00
Dan Moseley a161f34667 A few more regex test (#58154)
* Rust parser tests

* Update msg

* comment

* Work around #56945

* Add license notice

* Update url

* feedback
2021-08-31 10:51:12 -06:00
Theodore Tsirpanis 8750e9a849 Enforce scatter/gather file I/O Windows API requirements et. al. (#57424) 2021-08-31 10:28:06 +02:00
David Cantú de6b1e984a Fix detection of unsupported links (#58391)
* Fix detection of unsupported links

* Add Directory.Exists check

* Fix CI issue caused by local testing code
2021-08-30 17:20:11 -07:00
David Cantú cc0c121300 Clean-up duplicated PathInternal files (#57988)
* Clean-up duplicated PathInternal files

* Move PathInternal*.cs to Common
2021-08-27 21:28:12 -07:00
f7848bc095 Add internal junction support to link APIs (#57996)
* Add mount point support to link APIs.

* Add junction and virtual drive tests.

* Move PrintName comment outside of if else of reparseTag check.

* Add Windows platform specific attribute to junction and virtual drive test classes.

* Revert FILE_NAME_OPENED to FILE_NAME_NORMALIZED

* Revert addition of FILE_NAME_OPENED const.

* Remove unnecessary enumeration junction test.

* Rename GetNewCwdPath to ChangeCurrentDirectory

* Make Junction_ResolveLinkTarget a theory and test both resolveFinalTarget

* Shorter name for targetPath string. Typo in comment. Fix Debug.Assert.

* Clarify test comment. Change PlatformDetection for OperatingSystem check.

* Cleaner unit tests for virtual drive, add indirection test

* Skip virtual drive tests in Windows Nano (subst not available). Small test rename.

* Simplify Junctions tests, add indirection test

* Address test suggestions.

* Revert MountHelper.CreateSymbolicLink changes. Unrelated, and will be refactored/removed in the future.
Detect if SUBST is available in Windows machine, to bring back Nano.

* Add dwReserved0 check for mount points in GetFinalLinkTarget.

* Use Yoda we don't.

* Fix CI issues

Co-authored-by: carlossanlop <[email protected]>
Co-authored-by: David Cantu <[email protected]>
2021-08-27 11:36:02 -07:00
Adam Sitnik 3157403165 extend the NO_BUFFERING tests and cover all scenarios: (#57717)
- sync operations on async handle
- async operations on async handle
- sync operations on sync handle
- async operations on sync handle
2021-08-19 16:15:32 +02:00
Viktor Hofer 49c74eec15 Update changed solution files under src/libraries (#57483)
* Update slngen logic and remove unnecessary P2Ps

* Update changed soluion files under src/libraries

* Fix Platforms build

* Update comment in slngen.targets
2021-08-18 19:35:54 +02:00
David Cantú f7ba49d726 Remove validation to stat call for symlinks since is a breaking change (#57551)
* Remove validation to stat call for symlinks since is a breaking change, subsequently remove the symlink cache logic as is no longer needed

* Undo try-catch workaround in PhysicalFileProvider

* Fix tests that were failing due to changes
2021-08-17 11:51:46 -07:00
Adam Sitnik 6442090067 fix IncompleteReadCantSetPositionBeyondEndOfFile test (#57271)
* use ten unique arrays, not the same array 10 times (this should fix the test failure)

* don't run this test for the old FileStream implementation
2021-08-13 07:47:41 +02:00
Adam Sitnik cbc1f6a551 Fix .NET 5 FileStream compat detection in the test utility project (#57288) 2021-08-12 20:41:26 +02:00
Mitchell HwangandMitchell Hwang 126e29cd6e [MacCatalyst][libraries] Update MacCatalyst as Case Preserving for tests (#57167)
Co-authored-by: Mitchell Hwang <[email protected]>
2021-08-11 09:38:58 +02:00
David KarlašandJeff Handley f03c995111 Fix performance for File.GetLastWriteTimeUtc on Unix (#53070)
All this changes are to internal methods which are later called by other public methods which correctly call `ToLocalTime` for local time "overloads".
Performance hit is most visible for application which doesn't need to load local timezone information which takes ~30ms on 2016 MacBook Pro.

Co-authored-by: Jeff Handley <[email protected]>
2021-08-10 10:12:13 +02:00
Adam Sitnik 27059fb834 Ensure Directory.Delete works fine even if user has no ListDirectory permissions (#56996) 2021-08-09 18:56:58 +02:00