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
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
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
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
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
* 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
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
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
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.
- Resolvesdotnet/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
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
- 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.
- Resolvesdotnet/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
- 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
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
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
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
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
- 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
UTF16 encoded files trip up both Git and GitHub since the huristic they
use to determine if a file is binary or not depends on the existence of
null bytes in a file, which is common in UTF-16 encoded source.
This converts all the UTF-16 encoded files into UTF-8 with an explicit
byte order marker.
Commit migrated from https://github.com/dotnet/corefx/commit/b660da388085b5048f7dfc101d6d0634661a30dd
-Updated over a dozen test files to use the modern Xunit syntax.
-Solved file-in-use concurrency issues in the altered tests. Resolvesdotnet/corefx#1313, dotnet/corefx#2227
-Tests will no longer intermittently fail.
-Slightly improved code coverage for the FileSystem files whose tests I altered (Directory, DirectoryInfo, File, FileInfo)
-Most tests altered now inherit from similar tests to consolidate the testing robustness into as few locations as possible. For example, Directory_GetFiles_str now inherits from Directory_GetFileSystemEntries_str since the tests for Directory_GetFiles_str were the exact same ones as in Directory_GetFileSystemEntries_str anyways.
-All altered tests now use the System.IO.FileSystem.Tests namespace
-Renamed the File_WriteAll_all class name/file name to File_WriteAllText.
-I tested my changes on Windows overnight to verify that there is no more intermittent test failures. I didn't have to modify all of the files listed in dotnet/corefx#2227 to get them to pass; this concerns me but I found no way to replicate the errors I was receiving before. My guess would be that the tests in the files I didn't alter (e.g. File_WriteAll and File_ReadAll) used the same names as the tests I did alter but now that the tests I altered are changed they no longer share test file names and no longer fail as a result.
Commit migrated from https://github.com/dotnet/corefx/commit/d21ce06332afe7aba0a52491187983744c10b4a4