Skip to content

MockFileSystem.FileStream.New Doesn't Set UnixFileMode #914

@rfvgyhn

Description

@rfvgyhn

mockFs.File.GetUnixFileMode(filePath) is UnixFileMode.OtherRead, GroupRead, UserWrite, UserRead instead of UnixFileMode.UserRead given the following:

IFileSystem fs = ...
var options = new FileStreamOptions
{
    Access = FileAccess.Write,
    Mode = FileMode.CreateNew,
    UnixCreateMode = UnixFileMode.UserRead
};
await using var stream = fs.FileStream.New(filePath, options);

It looks like New should pass it along.

#if FEATURE_FILESYSTEM_STREAM_OPTIONS
/// <inheritdoc cref="IFileStreamFactory.New(string, FileStreamOptions)" />
public FileSystemStream New(string path, FileStreamOptions options)
{
using IDisposable registration = _fileSystem.StatisticsRegistration
.FileStream.RegisterMethod(nameof(New),
path, options);
return New(path,
options.Mode,
options.Access,
options.Share,
options.BufferSize,
options.Options);
}
#endif

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions