Commit Graph
228 Commits
Author SHA1 Message Date
tymlipari 4113737a6e Handle internal overflow of the write buffer in WriteAsync by introducing new cases:
1) Internal buffer overflows, but write can fit in next buffer - Fill the existing buffer, copy the remaining data into a new buffer, and flush the original to disk

2) Internal buffer is non-empty, overflows, and the remaining data won't fit in a second buffer - Chain the flush operation to a second write operation which writes the entire incoming block directly to disk.

Additionally, adds a new unit test to ensure the different buffering cases are being covered.


Commit migrated from https://github.com/dotnet/corefx/commit/b69caa929d3cb3b87574ee31a651d799f61e3a75
2015-08-24 16:50:56 -04:00
Nick Guerrera 16d140fd57 Use shims for open, close, unlink, shm_open, shm_unlink
Commit migrated from https://github.com/dotnet/corefx/commit/709afe1d4f6b2d5ca75a0565e4c24e16a5254ee7
2015-08-20 15:50:44 -07:00
stephentoub 4992aaa978 Fix access to user's home directory on Unix
Today in several places we get a user's home directory by accessing the HOME environment variable.  This is the right place to check first, but in certain cases it may not be set, such as in initialization scripts.

This commit implements a fallback, such that if HOME doesn't have a path, we consult the pw_dir path from a call to getpwuid_r for the current user.

As long as I was adding getpwuid_r to the native shim, I also moved our existing geteuid and getegid imports to the shims.


Commit migrated from https://github.com/dotnet/corefx/commit/5b8f55c8d43a880147478cb7d2191fa607000594
2015-08-19 15:06:32 -04:00
Nick Guerrera b4c8ad5504 Use Stat from System.Native shim throughout
Replace all usage of GetFileInformation from libcoreclr with newer
Stat from System.Native shim.


Commit migrated from https://github.com/dotnet/corefx/commit/2de10733ebca8a9612f72ea9df490a14edfb315f
2015-08-16 21:42:02 -07:00
Eric St. John d7a0ae297b Update corefx packages to latest
Commit migrated from https://github.com/dotnet/corefx/commit/23f0b695bd162e0f665427c95180dc21931e5c70
2015-08-14 15:43:23 -07:00
Eric St. John 9142282fd7 Fix ref-def mismatch in FileSystem tests
Since FileSystem tests are using a project reference to
System.Runtime.Extensions, and S.R.E uses a project reference
to System.Diagnostics.Debug (due to
https://github.com/dotnet/corefx/issues/2817) these tests  must
also use a P2P reference to S.D.D.


Commit migrated from https://github.com/dotnet/corefx/commit/0cc8949ef5474c8da77cf873ed5e01ea1cd91d21
2015-08-14 14:50:56 -07:00
Eric St. John 77309d4821 Update the version of all assemblies
This change updates the assembly versions of all of the corefx assemblies
as needed after we shipped stable versions.  Assemblies with API differences
get a minor version bump.  Assemblies with only bugfixes get a build version
bump.

In order to facilitate this I had to update the reference assemblies, so I took
the opportunity to port them all to the open.

[tfs-changeset: 1514419]


Commit migrated from https://github.com/dotnet/corefx/commit/40723b795917f2e98b64d45c17effb2546dd0cae
2015-08-13 17:07:57 -07:00
Stephen Toub 06871ac655 Merge pull request dotnet/corefx#2795 from dotnet-bot/from-tfs
Merge changes from TFS

Commit migrated from https://github.com/dotnet/corefx/commit/0268cb85fe9e0feebdccb18189f79d93c2d4b6de
2015-08-13 19:00:09 -04:00
Eric St. John 6cb20f1e7c Fix regression caused by https://github.com/dotnet/corefx/commit/dotnet/corefx@b00fed79842d13d9931cf963749aa00006fdacc0
[tfs-changeset: 1514359]


Commit migrated from https://github.com/dotnet/corefx/commit/0d0c501379b6091b4613cac512a1c22dd9db16d6
2015-08-13 14:46:34 -07:00
Ian Hays 1bc633088f Fixed test that was leaving temp directories in root folder
One of the Extended Path FileSystem tests was leaving temporary test directories in the root folder of the running directory. This small change modified the tests to instead treat the user's temp directory as the root.


Commit migrated from https://github.com/dotnet/corefx/commit/bd2d87d7abcf092840e0929c6df1116665f90460
2015-08-13 14:28:37 -07:00
Justin Van Patten 25383ad4d0 Eliminate extra IFileSystemObject allocation on Win32 and Unix
FileSystemInfo/FileInfo/DirectoryInfo all carry a IFileSystemObject
which is used internally for the actual implementation. While this
enables FileSystemInfo/FileInfo/DirectoryInfo to be used with WinRT,
it comes with the cost of an extra unnecessary allocation for plain
Win32 and Unix. This change eliminates the allocation on Win32 and
Unix. After this change, the extra object allocation only happens
when the WinRT APIs need to be used.


Commit migrated from https://github.com/dotnet/corefx/commit/b00fed79842d13d9931cf963749aa00006fdacc0
2015-08-13 10:49:08 -07:00
Justin Van Patten f391a759ca Rename [Unix|Win32]FileSystemObject.cs files
Rename the following files in preparation for a refactor:
- UnixFileSystemObject.cs -> FileSystemInfo.Unix.cs
- Win32FileSystemObject.cs -> FileSystemInfo.Windows.cs

The renames are being done in their own commit first to help git
maintain source history for the renamed files.


Commit migrated from https://github.com/dotnet/corefx/commit/24820ce8305c87d520d776ebcb300e37dddc48c4
2015-08-13 10:49:07 -07:00
Stephen Toub ce4b088056 Merge pull request dotnet/corefx#2737 from ianhays/overlap
Removed USE_OVERLAPPED from FileSystem

Commit migrated from https://github.com/dotnet/corefx/commit/0c677d5b22514f41119ec7de4ac403a42f04e914
2015-08-11 22:01:45 -04:00
Ian Hays 80e4b09f9b Removed USE_OVERLAPPED from FileSystem
All ifdefs around USE_OVERLAPPED have been removed such that the new behavior mimics the old behavior when USE_OVERLAPPED = true. Resolves dotnet/corefx#2722


Commit migrated from https://github.com/dotnet/corefx/commit/a227ab403b7da8edae7ce2758536452fb14a0549
2015-08-11 15:45:49 -07:00
Ian Hays e8723ef1b5 Cleaned up tests for closed issues
Design review feedback brought about the closed issues dotnet/corefx#2537, dotnet/corefx#2403, dotnet/corefx#2402, dotnet/corefx#2369, dotnet/corefx#1728. This Commit cleaned up the tests around those decisions and removed OuterLoop from the GetSetTimes tests.


Commit migrated from https://github.com/dotnet/corefx/commit/3eb22a0ef2eb007b8fc8410d1a0fefc23311dc08
2015-08-11 14:53:51 -07:00
Stephen Toub 3d03788188 Merge pull request dotnet/corefx#2698 from justinvp/filestream_verifyhandleissync
Avoid the byte[] alloc in Win32FileStream.VerifyHandleIsSync

Commit migrated from https://github.com/dotnet/corefx/commit/328035557beac29cf51b1d00d0a634dd8a969aaa
2015-08-11 15:08:46 -04:00
Justin Van Patten 89d3a6bcbd Avoid the byte[] alloc in Win32FileStream.VerifyHandleIsSync
Call the native ReadFile and WriteFile interop functions directly,
passing a stack allocated byte, instead of allocating a byte[]
of length 1 on the heap. Added common error handling for
ERROR_INVALID_HANDLE.


Commit migrated from https://github.com/dotnet/corefx/commit/fe22fb00349400a198417f48979bd6bae7645b6e
2015-08-11 08:37:20 -07:00
Dmitry Turin f4055ca36c Pass message to ArgumentNullException in ReadAsync/WriteAsync
For consistency with synchronous Read/Write.


Commit migrated from https://github.com/dotnet/corefx/commit/9c21d464eb8d2f5da8c0e99bc00cd6f4a6e4812e
2015-08-11 12:39:16 +03:00
Jeremy Kuhne 3b5bfc51a3 Allow extended long path directories
Add methods for checking max length as it varies on path format.

Most code paths hit PathTooLong with GetFullPath- directories are a special
case as Win32 apis have a special limit (248) for directory creation.


Commit migrated from https://github.com/dotnet/corefx/commit/6f363e65bfd09bebdf09ba236f63da952948ba8e
2015-08-09 19:19:27 -07:00
Dmitry Turin 3310274f8b Return cached task at synchronous completion
Commit migrated from https://github.com/dotnet/corefx/commit/0c6ae1b2730bf1d9ecc31e481fa1b3296d91d0c2
2015-08-08 22:16:25 +03:00
Ian Hays 6f2190dc4e Fixed AccessTime, WriteTime, and CreationTime getters
Previously, AccessTime, WriteTime, and CreationTime would return DateTime objects with an unspecified DateTimeKind. This commit modified that behavior to have them instead return Local DateTime objects. Extra tests were also added to catch more potential error cases.

- Resolves dotnet/corefx#2603
- Resolves dotnet/corefx#2610


Commit migrated from https://github.com/dotnet/corefx/commit/df06e562a49b739655efff4b6b9f0faa23d09b78
2015-08-07 10:16:52 -07:00
Nick Guerrera b760fb6fb0 Merge pull request dotnet/corefx#2606 from nguerrera/add-errno-shim
Add errno shim (+ existing shim cleanup precursor)

Commit migrated from https://github.com/dotnet/corefx/commit/b9fc9e6d00fef3e83f2d80951e210b868627c328
2015-08-06 20:41:35 -07:00
stephentoub d6467ac0af Use RuntimeInformation across corefx for platform detection
This commit deletes our temporary Interop.PlatformDetection.cs mechanism and replaces usage of it with usage of System.Runtime.InteropServices.RuntimeInformation.dll.


Commit migrated from https://github.com/dotnet/corefx/commit/6861b625b391566544be9a60356c8c03b15e5fb5
2015-08-06 10:25:17 -04:00
Nick Guerrera f6ce429b8e Respond to PR feeback
* Defer conversions until necessary
* Rename Errno -> RawErrno
* Return null for ERANGE for strerror
* Add conversion helper for Error -> ErrorInfo
* Fix typos
* Remove unnecessary _POSIX_C_SOURCE define
* Fix names and sizes of managed FileStatus members
* Don't double-initialize ErrorInfo out param
* Zero out BirthTime when not available
* Put back newline at EOL
* Restore size of UnixFileSystemObject
* Use ignored local name for ignored error info
* Rename Interop.System to Interop.Sys to avoid
  collision with System namespace


Commit migrated from https://github.com/dotnet/corefx/commit/e82401bd3feea682832215d1e97dbb4bb73e211a
2015-08-06 06:52:01 +00:00
Nick Guerrera ef4deeef20 Use new errno shim from managed code
Commit migrated from https://github.com/dotnet/corefx/commit/2b01345b2a925400569269b1149afd645c77b790
2015-08-06 06:52:01 +00:00
Stephen Toub 7b28c3d30e Merge pull request dotnet/corefx#2630 from stephentoub/consolidate_tempfiles
Change System.IO.FileSystem.Tests to use FileCleanupTestBase

Commit migrated from https://github.com/dotnet/corefx/commit/37b0abb008ef543e57cbe02e0b4435bc1908a303
2015-08-05 12:20:05 -04:00
stephentoub 2e9fbca627 Change System.IO.FileSystem.Tests to use FileCleanupTestBase
When I rewrote the MemoryMappedFiles tests, I cribbed from the
System.IO.FileSystem test's base class and created a Common base class
that could be used by test projects that had temporary files to be cleaned up.
At the time, however, FileSystem's tests were undergoing heavy changes and
so I didn't update FileSystem's tests to use the common base.  Now that
things have quieted down, I've made that change.

In doing so, I made a few tweaks to the FileSystem tests, where tests were
assuming that the test directory was always in the current directory, and
the consolidated base class puts temporary files in the user's temporary
directory instead.


Commit migrated from https://github.com/dotnet/corefx/commit/d7a19e92824e8a038553de20abf2497db0424ddb
2015-08-04 23:24:06 -04:00
Stephen Toub d61e0ec805 Merge pull request dotnet/corefx#2588 from ianhays/linkunlink
Modified the Unix implementation of FileMove and fixed the corresponding broken FileSystemWatcher tests

Commit migrated from https://github.com/dotnet/corefx/commit/2f50375d7b84501179d87d3958a5a57fb458a73a
2015-08-04 23:15:39 -04:00
stephentoub b6046f97e0 Fix UnixFileSystem.MaxDirectoryName to be MaxPath
UnixFileSystem's override of MaxDirectoryName was assuming the property meant the maximum size of the file name of a directory, i.e. the component length, not the full path length of everything from the beginning of the root.  As a result, checks against MaxDirectoryName, such as in CreateDirectory, were failing incorrectly with longer path lengths.

The fix is just to return MaxPath from MaxDirectoryName; there's no difference on Unix.  I also added a test to cover this case, included a previously excluded test, and deleted a faulty test.


Commit migrated from https://github.com/dotnet/corefx/commit/5de40bfa898dc2a03fd5efb3f21ea2f69d16a94a
2015-08-04 21:48:54 -04:00
Ian Hays e6e252aabf Modified Unix File.Move to use link/unlink instead of rename
Changed the way the UnixFileSystem does File moving; it was previously implemented using the rename syscall but now uses a combination of link and unlink. The side effect of this change is that the FileSystemWatcher will now treat File.Move as a deletion.

- Resolves dotnet/corefx#2460
- Removed all tests from FileSystemWatcher that made calls to File.Move and consolidated them into a new file: FileSystemWatcher.MoveFile.cs. This new file separates tests into Windows and Unix categories and uses Theories to supply the input WatcherChangeType and whether a move should trigger an event for the given type. If we later decide to change the Unix behavior of MoveFile, changing the FileSystemWatcher tests will be a simple matter of flipping the boolean values for the affected tests.
- Fixed some comments in UnixFileSystem to be more specific to FileSystemWatcher
- Changed variable names for FSW Move tests to be more descriptive
- Modified FSW MoveFile and Utitlity helper classes to use guids so that they may be run concurrently.


Commit migrated from https://github.com/dotnet/corefx/commit/cae7c5116d46c0d98e6f0fb3526fa2a15945501a
2015-08-04 15:47:56 -07:00
Eric Mellino 66969e748b Re-lock dependencies with latest xunit
Commit migrated from https://github.com/dotnet/corefx/commit/795cbc75f8e167047a7c19cd7e21e99b9b9f4308
2015-08-03 16:40:33 -07:00
Eric Mellino c0015fc582 Move all tests to latest xunit beta
Commit migrated from https://github.com/dotnet/corefx/commit/7c12b0120834f92d5c591124f692ea1b64c6a877
2015-08-03 11:27:48 -07:00
Eric St. John 47aaf9fcf8 Use stable package dependencies and move our packages to post-stable versions
This change modifies the build to consume the stable version where available.

This disables building the dowlevel packages since we shipped them once as stable and we're done.
From here on out, we'll only build the latest version (except for a servicing event, which would
be handled by syncing to a hash).

I can't rev the package versions in the normal way yet (by modifying the assembly version of the contents)
because that turned out to be too big of a problem to tackle in this change. Instead I added a
parameter to the task that calculates package versions to do the rev for anything that was
stable, but only when building the package itself, not when calculating the dependencies.
This has the downside of not permitting a dependency on a incremented pre-release version if we've
shipped a stable version, but that is a small point in time problem until I can rev the assembly
versions.

[tfs-changeset: 1508664]


Commit migrated from https://github.com/dotnet/corefx/commit/ee1ec2891c7c65b46fa9dfb078636be503bb2a60
2015-07-31 15:47:51 -07:00
Ian Hays a9766775b0 - Added an overload to GetTestFilePath that takes an integer index parameter to add to the generated filename so that calls to the function within loops will be able to differentiate themselves
- Resolves dotnet/corefx#1434


Commit migrated from https://github.com/dotnet/corefx/commit/1dbfabb32d61a8c2db25c82bb22743bcc15c2ccb
2015-07-29 15:23:33 -07:00
Ian Hays 8d7c94172a - Resolves dotnet/corefx#2458. FileInfo.Open(FileMode.Append) didn't allow appending per so I modified FileInfo to allow it
- References dotnet/corefx#2460. File.Move and FileInfo.MoveTo no longer always overwrite the destination file; added a non-concurrent validity check to MoveFile in the Unix implementation to serve as a temporary solution.
- Resolves dotnet/corefx#2459. Reenabled Directory_CreateDirectory.DriveLetter_Unix as it's previous failures were not the fault of the method but of the system.
- Added test checks to work around the issue in dotnet/corefx#2537 until a final decision is reached for the desktop.
- Added Interop.Link to the Interop files for the (possible) implementation of File.Move
- Consolidated all of the related files that did nothing but inherit from other classes (e.g. File_GetFiles_str and File_GetFiles_str_str were consolidated into File_GetFiles)
- Removed the "partial" keyword from some test classes
- Finished overhauling all test cases that don't directly require solutions to Build System issues before being re-added (e.g. those that require networked drives or altering the current directory)
- Added some tests to increase code coverage slightly in some cases.
- All classes and files have been renamed to match the standard set by FileStream: only include parameters in the test/class name if there are overloads
- Modified the Unix behavior for distinguishing between a FileNotFoundException and a DirectoryNotFoundException to match that of Windows.
- Removed some redundant error checks that never catch
- DirectoryInfo.MoveTo(destPath) did not have checks for destinations with paths that are over MAXPATH. I added them to better match the behavior and error timing of Directory.Move(source, dest).


Commit migrated from https://github.com/dotnet/corefx/commit/481d5c645763da79145af50d123db3f4041aa05e
2015-07-29 08:04:18 -07:00
Justin Van Patten 2170b1c248 Reduce allocations in Win32 file system enumeration
- Lazily create and cache SearchResultHandler<TSource> instances
- Only allocate _searchStack when needed
- Remove the unnecessary SearchOption field on SearchData
- Replace SearchData class with unified PathPair struct with Unix.
- Remove the SearchResult class
- Pass WIN32_FIND_DATA by ref instead of copying (large struct)
- Various minor cleanup


Commit migrated from https://github.com/dotnet/corefx/commit/b5a268d22cbe2f10d7f347cd19fc89f5e16fa287
2015-07-27 10:59:29 -07:00
Wes Haggard 1917a92051 Add P2P reference for new IO tests to System.Runtime.Extensions
Until we can publish a new packages with the new System.Runtime.Extensions
implementation reference the locally built version. We need to change to a
P2P reference to avoid the race condition that is inherit in using
TestWithLocalLibraries. That can only be used if we know all the
dependencies are built first.


Commit migrated from https://github.com/dotnet/corefx/commit/018763c4dad4c0c1c1cc63befdcba249b7c11b05
2015-07-24 17:17:53 -07:00
Jeremy Kuhne 7f446020aa Allow extended syntax for paths
Additional work unblocking extended syntax. Fixes a few issues,
adds a number of tests, normalizes naming a bit more and moves/adds
helpers to shared code.

One nice side effect of this change is that you can now delete directories
that were undeletable before (if you had subdirectories that had trailing
spaces as one example).


Commit migrated from https://github.com/dotnet/corefx/commit/0721434e19e7f9ecf8bf6dba7485f6c86827388c
2015-07-23 19:17:34 -07:00
Jeremy Kuhne c25bace1a2 Merge pull request dotnet/corefx#2410 from JeremyKuhne/AllowExtended
Allow extended syntax for paths

Commit migrated from https://github.com/dotnet/corefx/commit/14e98f7acc0420c93218768f89dd69c9b4c12c86
2015-07-23 15:52:33 -07:00
Matt Mitchell b92c666b03 Enable globstar in run-test.sh
Globstar is not enabled by default, and a recent commit attempting to increase the number of directories being run for the Linux build actually skipped a bunch of stuff.  Enable globstar in the script (this is local) to fix.

Mark DriveLetter_Unix as a failing test, which appears to have snuck in in the meantime


Commit migrated from https://github.com/dotnet/corefx/commit/0b798760c7844e489bfb1432dd97b3ce184bb374
2015-07-23 10:28:52 -07:00
Jeremy Kuhne 911f36ebd9 Allow extended syntax for paths
Start on unblocking extended syntax. Moves some shared code to PathInternal.
Start adding tests for key scenarios. Temporarily use local libraries when
testing FileSystem (until we get an updated Runtime.Extensions package).


Commit migrated from https://github.com/dotnet/corefx/commit/72429b2ba76ebecb4c422a1d5eec05daf279b05e
2015-07-22 11:26:21 -07:00
Stephen Toub dc2151aa7b Merge pull request dotnet/corefx#2442 from stephentoub/license_headers
Add missing license headers to .cs files

Commit migrated from https://github.com/dotnet/corefx/commit/1bcb7dc4530a58bac2d7ce7743dc1e58a5c19a77
2015-07-22 13:42:47 -04:00
stephentoub b931aee629 Add missing license headers to .cs files
There are 77 .cs files in the repo lacking the standard license header we have on the other ~5400 .cs files.  This commit adds the missing ones.


Commit migrated from https://github.com/dotnet/corefx/commit/98157438d8790337f14341528f20d2f788a3279d
2015-07-21 18:52:55 -04:00
Ian Hays 55cc5920f4 Updated with PR feedback
Commit migrated from https://github.com/dotnet/corefx/commit/3098724684d3a9e2916fbf2100643301d9161127
2015-07-21 13:41:48 -07:00
Ian Hays 67541b0365 Update to FileSystem Tests
- Consolidated AccessTime, WriteTime, and CreationTime tests for FileInfo, File, DirectoryInfo, and Directory into one file per folder - GetSetTimes.cs
- Added some Unix tests
-Overhauled the Write/Read/Append tests for the File class and removed many duplicate tests
-Continuation of dotnet/corefx#2390


Commit migrated from https://github.com/dotnet/corefx/commit/5aebb5487de9fd481e3dd294c9d49aa25361dde2
2015-07-20 14:43:18 -07:00
Jeremy Kuhne 3d97204233 Merge pull request dotnet/corefx#2313 from JeremyKuhne/MinorCleanup
Move Windows File I/O helper methods into common.

Commit migrated from https://github.com/dotnet/corefx/commit/1701015acd323e7ba8def2e7a45770f63f9b03a9
2015-07-17 13:10:33 -07:00
Stephen Toub b8ed353401 Merge pull request dotnet/corefx#2118 from Maxwe11/FileStreamCompletionSource-cleanup
Remove unnecessary IAsyncResult implementation

Commit migrated from https://github.com/dotnet/corefx/commit/785e22118fd136651285c1f16312a667dd6dd52b
2015-07-16 16:09:29 -04:00
Stephen Toub 2b05e04fd9 Merge pull request dotnet/corefx#2367 from stephentoub/filestream_comments
Fix stale async-related comments in FileStream

Commit migrated from https://github.com/dotnet/corefx/commit/01a4dd8d3915965900e7a66f441d2b7f59881858
2015-07-15 14:27:15 -04:00
stephentoub ba06e5b368 Fix stale async-related comments in FileStream
Leftover after the async rewrite in dotnet/corefx#972.

Fixes dotnet/corefx#2117.


Commit migrated from https://github.com/dotnet/corefx/commit/07b5a17825f0c0130b2fae647ed36086d8562160
2015-07-15 12:46:41 -04:00
stephentoub bab02c72eb Ensure all Common includes use a <Link/>
Modifies various .csproj files to ensure that all Includes for files under Common use a <Link/> so that Visual Studio shows the files under a Common folder rather than flattened in the root.

Fixes dotnet/corefx#144


Commit migrated from https://github.com/dotnet/corefx/commit/264d92084d6c6366c3c23edaaab54a32f61d501b
2015-07-15 10:21:33 -04:00