DNX and BuildTools now support all of the nuget v2 conventions that we depend on so we can
move all remaining nuget v2 packages to the project.json file and eliminate packages.config.
This change also adds "frameworks" to the project.json so that dnu restore can calculate
applicable assets. I am not yet using "runtimes" in the project.json since we are still resolving
our runtime assets manually (eg: build tools copies known files from packages). A future
change will move us to using our runtime packages and add runtimes sections to projects
as appropriate.
Commit migrated from https://github.com/dotnet/corefx/commit/eb35a304c7e89e8b4335ed13c5d23706360d49a4
UnixFileStream.Seek was dumping the read buffer as desired, but with a SeekOrigin.Current, it wasn't factoring in the read buffer information into the offset (the fact that we have a read buffer means that the caller's definition of "Current" doesn't match the actual underlying file descriptor's position). This fix just updates the offset (as is correctly done in similar code in the Win32FileStream implementation) based on how much data we have in the read buffer.
I've also added a seek test that repeatedly seeks around and reads data. It blows up without the fix and passes with it.
Commit migrated from https://github.com/dotnet/corefx/commit/563f4977543f483ce1a5df8b9ffd9f96ffe0921f
Move the file system case sensitivity policy from an internal
FileSystem property to the common linked-source internal class
PathInternals. This allows System.IO.Compression.ZipFile to use
the same policy. We will need to update this when we add the ability
to detect the case sensitivity of the file system, rather than
assuming based on operating system.
Commit migrated from https://github.com/dotnet/corefx/commit/aa6a0d40d2abd6b2ebdac0234d3dfc73aae35b12
Most of our testing until now has been on Linux. This PR represents a pass through the tests on OSX and provides fixes to get the System.IO.FileSystem, System.IO.Pipes, and System.IO.MemoryMappedFiles tests passing at 100%. Most of these fixes are product fixes, with just a few test fixes.
Primary src fixes:
- Lots of named values (errors, open flags, sysconf names, etc.) have different values across Linux and OSX: I've fixed those to be specific to the platform being compiled for. (In the future, we should consider introducing a native shim layer through which we make _all_ calls to Unix and have it surface a consistent view, so that we don't have to worry about this kind of issue.)
- Some functions or options to functions being used on Linux don't exist on OSX, e.g. madvise's DONTFORK, posix_fadvise, etc.; these have either been removed if not truly needed or moved behind the PAL layer to only be used on Linux.
- Some functions (e.g. shm_open) have different behavior from Linux. For example, shm_open doesn't appear to work well with shared memory objects, such as not allowing MAP_PRIVATE and not supporting PROT_EXEC (though the OSX man pages don't mention this). In such cases, I've implemented a fallback, e.g. on OSX we use a temporary file rather than a shared memory object.
- Some functions have subtle differences around edge cases, e.g. mmap on Linux appears to allow the creation of a map with length that goes beyond that of the underlying medium, but then fails when trying to use it, whereas OSX moves the failure to the mmap call itself. I've implemented workarounds to smooth over these differences.
- Various error conditions were resulting in the wrong exception type based on different exception codes being returned on OSX than on Linux, e.g. additional error codes needed to be mapped to IOException when rmdir fails.
- Replaced direct usage of getenv through P/Invoke with calls to Environment.GetEnvironmentVariable. (These are a holdover from when we didn't yet have GetEnvironmentVariable available.)
- Fixed up a few places we could be using CheckIo but instead had effectively written out its implementation manually.
Primary test fixes:
- Some of the file system tests are just plain buggy, regardless of platform, with timing issues that are more likely to show up on a debug runtime. I've fixed the ones that manifested while I was doing this testing, but the file system tests really deserved to be overhauled in general.
- Windows' implementation of File/DirectoryInfo returns default values for CreationTime when created for a file that doesn't exist; this appears to be purely for back compat with previously buggy behavior, so I changed the test to only verify this on Windows, rather than implement similar buggy behavior on Linux/OSX.
- A few test cases that were previously exempted for Linux also needed to be exempted for OSX.
- Re-enabled the System.Dynamic.Runtime.Tests now that the associated runtime error that was causing them to fail has been fixed.
Commit migrated from https://github.com/dotnet/corefx/commit/5a912670b442f7f7984b6d7f0be190213f726fd4
This change updates all projects to the latest CoreFx packages which make use of nuget v3 features and thus require project.json. Packages.config remains for the packages which are not yet compatible with the new build task (mainly because we need to resolve to PCL folders).
The entire change was done by a tool in order to not miss any dependencies, and ensure we have project items for the packages.config/project.json. One side effect of using the tool is some reformatting of whitespace in the projects.
Commit migrated from https://github.com/dotnet/corefx/commit/e729c5353070b71aedff8f1300ae838573813faf
Prior to this set of changes, 110 of the FileSystem tests were failing on Linux. After this change, all allowed tests pass.
Primary product fixes:
- Using rmdir/unlink for directory/file deletion rather than using remove
- Disallowing FileStreams to be opened for directories
- Supporting copying files when only target directory (not target name) is specified
- Overhauling directory enumeration to ensure to match Win32 behaviors related to search pattern normalization, input validation, supporting re-iteration through an enumerable, outputting partial paths based on user-supplied path, using a SafeHandle to ensure resources are cleaned up
- Fixing FileSystemObject.LastWriteTime to correctly return the LastWriteTime rather than LastAccessTime
- Fixing FileAttributes.ReadOnly handling due to inappropriate caching
- Validating inputs to FileSystemObject.Attributes, and make sure that changes to attributes are visible afterwards
- Adding support for getting CreationTime if it's supported by the OS
- Marking links with FileAttributes.ReparsePoint
- Working around current runtime bug related to exception handling and finally blocks getting executed twice
Primary test fixes:
- Suppressing tests as platform-specific that dependend on Win32-isms like drive letters, alternate data streams, etc.
- Changing a bunch of '\' usage to instead use Path.DirectorySeparatorChar or Path.Combine
- Adapting to behavioral differences between Windows and Unix, e.g. whether a directory can be deleted if it's readonly, invalid path characters, max path lengths, file sharing differences, etc.
These changes should all accrue to OSX as well, but we'll need to separately do an exercise to clean this library and tests up there for anything OSX-specific.
Commit migrated from https://github.com/dotnet/corefx/commit/dd48c9dc1f0a7142a005ff1d4c162e10facda306
This commit fixes issues highlighted when running the System.IO.FileSystem.Watcher tests on Linux. There are 49 tests that pass on Windows; after these product and test fixes, only 7 of those fail on Linux, all due to Windows-specific tests that will need to be tweaked based on target system or disabled entirely on Linux:
- 2 are P/Invoking to Win32 functions related to security
- 3 are trying to overflow the event buffer but not doing so on Linux
- 2 are expecting case-insensitive file paths
Commit migrated from https://github.com/dotnet/corefx/commit/7176a0dc531a1a9c9032c36330bbf92e7ca57f65
In dotnet/coreclr c323646b, I introduced a new API on the PAL called
GetFileInformation which wraps fstat/stat since these functions differ
between OS's and architecture.
This change removes our uses of stat in favor of this API, which
provides a stable ABI across platforms.
Fixesdotnet/corefx#371
Commit migrated from https://github.com/dotnet/corefx/commit/9115af1b4f458b7dc41a040c45266898f8d84512
There are 338 System.IO.FileSystem tests currently passing on Windows. On Linux, 65 of these are currently failing, mostly negative tests expecting a certain exception and getting a different actual one or none at all.
This commit fixes 40 of those, mostly via product fixes, plus a few test tweaks (where the test was based on something specific to Windows), such that now only 25 are failing. Of those 25, 24 are tests for FileSharing that are expecting exceptions not being generated on Linux because that support isn't available in the library; we'll most likely just disable these tests for Linux. The remaining 1 test fails because it's expecting ReadAsync to complete synchronously if the read can be satisfied from the read buffer, and the current ReadAsync/WriteAsync implementations just delegate to the base class for functionality; we already have a work item open to eventually address that.
Commit migrated from https://github.com/dotnet/corefx/commit/8062cc0dbed1ad31b9e6d438ddc71d91ee066031
This change removes the closed libraries sources for libraries which we are now building in the open. Stub project files are left in the closed libraries which improt sources from the open for various build configurations.
Also includes these two changes which were not yet ported to open:
- [Serialization]: DCS/DCJS fails to serialize/deserialize XElement type - regression
- Change namespace of System.Xml.XPath.XmlDocument extensions
Validated by pre-checkin gauntlet build dotnet/corefx#150320.14337
[tfs-changeset: 1437136]
Commit migrated from https://github.com/dotnet/corefx/commit/89881048ba6bb6adca5253024ea59e8aa8790a6a
Previously, we used the catch all OS=Unix property in MSBuild to
determine if we were building for Windows vs Unix, and we shared the
same MSIL between Linux and OSX. However, we have already started to
take dependencies on Linux specific APIs and we plan on using OSX
specific APIs very soon.
We don't want to try to ship MSIL that contains both Linux and OSX
specific implementations of a feature, so the build system needs to
change a little.
We'll continue to use the OS property as the entry point for the build
to specificy what platform you want to build for. However, we now have
three platforms:
1. Windows_NT
2. Linux
3. OSX
However, the value of the OS property should not be tested directly,
instead we introduce properties about the target platform itself:
1. TargetsWindows
2. TargetsUnix
3. TargetsLinux
4. TargetsOSX
Code which works the same across Linux and OSX should be guarded by
TargetsUnix (which is true when OS is either 'Linux' or 'OSX'). Code
specific to one OS can be guarded with either TargetsLinux or
TargetsUnix.
In this change, I have simply rewritten all the '$(OS)' == 'Unix'
conditions to '$(TargetsUnix)' == 'true'. A few libraries may do Linux
specific stuff, but we will clean up that debt when we go to flesh out
the OSX implementations.
Commit migrated from https://github.com/dotnet/corefx/commit/4d07173fbf86631d49ed56623581eff9cb7d3f87
UnixFileStream's ctor that accepts a SafefileHandle was calling
_parent.CanSeek, but no calls to _parent should be made in the ctor
of a FileStreamBase because the _parent FileStream's _innerStream
hasn't yet been assigned to this FileStreamBase instance being
constructed.
Commit migrated from https://github.com/dotnet/corefx/commit/fd63109117869fc732e53247d3b77ff754efd19d
After this change we are going to have unified model for handling resources which is we always use resx files placed under Resources folder and the code will be automatically generated in SR.cs file.
We’ll access ant string resource using the SR class (e.g. SR.ArgumentException).
Commit migrated from https://github.com/dotnet/corefx/commit/db7180f04ef9789a7f199fcd9f8c527990e14673
In MultiplexingWin32WinRTFileSystem we were treating all Opens as potentially
creating a file. As a result we would walk up the path until we found some
existing folder (or failure) so that we could give the FileSystem implementation
a chance to fill in the entire missing path on a create. This was incorrect
for Open operations (FileMode.Open and FileMode.Truncate) and resulted
in poorer performance for Open as well as incorrect exceptions.
Commit migrated from https://github.com/dotnet/corefx/commit/ee3e4566814cf96c0f517d340f221a9472a4df2d
We were using FindFirstFileEx to get file attributes in order to determine if
the file/directory is accessible by Win32. This is failing for root folders in
ApplicationData locations, even though they are accessible by Win32. The
reason seems to be that FindFirstFileEx on a full path requires that the parent
have permission to enumerate contents, even though we've passed a full
path and have full access to that path (likely a bug in FindFirstFileEx).
Using GetFileAttributesEx is better in most cases since it is faster and does
not require permission to enumerate contents. I've switched to using
GetFileAttributesEx first and only falling back to FindFirstFile when we might
have a reparse point that could be a placeholder file.
Commit migrated from https://github.com/dotnet/corefx/commit/cd0216d3350ed210f9bdbf6c083ce020655a105d