summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/file_system_manager.hpp
AgeCommit message (Collapse)Author
2025-04-22FileSystemManager: When copying, take into account equivalent files.Maksim Denisov
2025-04-22FileSystemManager: Always copy directories recursivelyMaksim Denisov
2025-04-22FileSystemManager: Always remove directories recursivelyMaksim Denisov
2025-04-10FilesystemManger: reduce debug level for absent filesKlaus Aehlig
At various places in the build tool, we try to read files from various CASes and caches. The absence of a file there is normal; therefore, reduce log level in order to not overload the debug-level log.
2025-03-05FileSystemManager: Let caller decide log level for reading directoryPaul Cristian Sarbu
Do not emit errors when it does not lead to build failures. Callers handle the log level at which failures of this method should be logged.
2025-02-21FileSystemManager: Use IncrementalReaderMaksim Denisov
2024-12-19Fix cause of minor warningsOliver Reiche
2024-11-14file_system: Implement IWYU suggestionsPaul Cristian Sarbu
2024-10-08Name local variables using lower_caseMaksim Denisov
...and private members using lower_case_
2024-10-08Name static constants using kCamelCase.Maksim Denisov
2024-10-07Enable cppcoreguidelines-* checks.Maksim Denisov
2024-10-07Enable readability-* checks.Maksim Denisov
2024-10-07Enable readability-redundant-member-init check.Maksim Denisov
2024-10-07Enable bugprone-implicit-widening-of-multiplication-result check.Maksim Denisov
2024-10-07Enable bugprone-narrowing-conversions checkMaksim Denisov
2024-09-26Fix enum sizes proposed by clang-tidy.Maksim Denisov
Enable performance-enum-size check.
2024-08-29FileSystemManager: Implicit copy should not follow symlinksPaul Cristian Sarbu
The default options of std::filesystem::copy include following symlinks, resulting in file repositories creating wrong trees if containing unresolved symlinks, or failing unexpectedly early if symlink cycles existed. This is fixed by ensuring the copy_symlinks option is always used.
2024-08-27Reformat code to comply with clang-format 18Klaus Aehlig
... while keeping our .clang-format file.
2024-08-07Replace classic C boolean operators with keywordsMaksim Denisov
! => not; && => and, || => or
2024-08-05Add missing cerrno includesPaul Cristian Sarbu
2024-07-05FileSystemManager::CreateFileHardlink: return error code on failureKlaus Aehlig
Instead of returning a plain boolean, return an expected with the same boolean value that in case of an error indicates the error code. In this way, an error-specific handling is possible by consumers. While there, also add proper quoting of the involved file names.
2024-07-05Move functionality from StorageConfig to related classes.Maksim Denisov
2024-04-08Use properly included standard library types by defaultPaul Cristian Sarbu
2024-04-08Consistently guard all POSIX C includesPaul Cristian Sarbu
2024-03-26Add missing system includesPaul Cristian Sarbu
Main culprits: - std::size_t, std::nullptr_t, and NULL require <cstddef> - std::move and std::forward require <utility> - unordered maps and sets require respective includes - std::for_each and std::all_of require <algorithm>
2024-03-15Clean up more includes and targetsPaul Cristian Sarbu
Some of the more specific issues addressed: - missing log_level target/include - header-only libs wrongly marking deps as private - missing/misplaced gsl includes
2023-12-12Filesystem: Fix copy overwrite of symlink with fileOliver Reiche
... and improve log messages in case of failure.
2023-11-20Remove O_SYNC from low-level file-writing flags.Sascha Roloff
The man page for open(2) says the following to the O_SYNC flag: 'O_SYNC provides synchronized I/O file integrity completion, meaning write operations will flush data and all associated metadata to the underlying hardware.' This flag results in a high delay when files are stored in casx, e.g., several seconds for medium-sized files such as 23 MB. Since just does not care about persistency, this strong synchronization mechanism is not required and is deactivated.
2023-11-13bugfix: Also unlink symlinks before installingOliver Reiche
Make sure that all CopyFile, WriteFile, and CreateSymlink functions properly unlink the target file (if it exists and overwrite requested) to avoid interferences of the install command. With this change, the clean up step for install-cas and the within GraphTraverser can new be omitted.
2023-08-08just execute: Fix uncollected upwards symlinksPaul Cristian Sarbu
Upwards symlinks should still be collected from actions, even if only the non-upwards symlinks are supported artifact types. The client side is thus the one responsible with enforcing the non-upwardness condition.
2023-07-11filesystem: Avoid unwanted indirections...Paul Cristian Sarbu
...that std::filesystem::* calls produce. This is because existence and type checks use almost exclusively std::filesystem::status, which follows symbolic links, when being called with path arguments. Instead, one should instead use these methods with the value returned by a call of std::filesystem::symlink_status. This commit also streamlines the FileSystemManager tests, as well as replace bare calls to std::filesystem with their FileSystemManager counterparts (where suitable).
2023-07-10FileSystemManager: Add recursive directory entries reader...Paul Cristian Sarbu
...allowing the skipping of certain subtrees if needed. This is useful, e.g., in simulating what a 'git add' call would do, which ignores all '.git' subdirectories. Also adds a corresponding test for the new method.
2023-06-26Allow non-upwards symlinks with Git APIPaul Cristian Sarbu
2023-06-26Allow non-upwards symlinks with local APIPaul Cristian Sarbu
2023-06-26bazel_msg_factory: Allow non-upwards symlinks in uploaded treesPaul Cristian Sarbu
2023-06-26ReadTree: Add check for non-upwards symlinks...Paul Cristian Sarbu
...as early as possible. This ensures that callers always receive only the tree entries for the supported object types. For the symlinks non-upwardness check we pass a lambda capturing the real backend of the tree entries, such that the symlinks can be read. Updates git_tree tests accordingly.
2023-06-26ObjectType: Add non-upwards symlinks as a known object type...Paul Cristian Sarbu
...but make sure it is still considered a special type. The only non-special entry types remain file, executable, and tree.
2023-06-26filesystem: Add logic for handling (non-upwards) symlinksPaul Cristian Sarbu
2023-06-07file_system: Drop unused template argumentOliver Reiche
... which became obsolete with the new fdless write/copy implementations.
2023-06-07file_system: Avoid malloc in 'fdless' copy/writeOliver Reiche
... to remove the risk of deadlocks on certain combinations of C++ standard library and libc when performing the copy/write in a child process. For 'fdless' copy/write, a child process is used to prevent the parent from getting polluted with open writable file descriptors (which might get inherited by other children that keep them open and can cause EBUSY errors).
2023-05-31FileRoot: Add ignore-special roots logicPaul Cristian Sarbu
2023-04-26imports: Switch to Microsoft GSL implementationOliver Reiche
... with two minor code base changes compared to previous use of gsl-lite: - dag.hpp: ActionNode::Ptr and ArtifactNode::Ptr are not wrapped in gsl::not_null<> anymore, due to lack of support for wrapping std::unique_ptr<>. More specifically, the move constructor is missing, rendering it impossible to use std::vector<>::emplace_back(). - utils/cpp/gsl.hpp: New header file added to implement the macros ExpectsAudit() and EnsureAudit(), asserts running only in debug builds, which were available in gsl-lite but are missing in MS GSL.
2023-01-24FileSystemManager: Do not follow symlinksOliver Reiche
... and ensure that cascades of checks are performed with only a single filesystem stat per method.
2023-01-24FileSystemManager: Pass ReadDirectory error to callerOliver Reiche
2022-12-21FS Manager: Add CopyDirectoryImpl methodPaul Cristian Sarbu
2022-10-12Add copyright and license notice to all source and header filesKlaus Aehlig
Signed-off-by: Goetz Brasche <goetz.brasche@huawei.com>
2022-10-11FileSystemMgr: Suppress unsupported object type warningOliver Reiche
... if the object does not even exist. In that case, a trace message is produced and the caller is responsible for reporting errors.
2022-04-14add u+w permission when installing a fileAlberto Sartori
... to allow for overwriting
2022-04-07FileSystemManager::ReadDirectory does just one system callAlberto Sartori
2022-04-04Hardlinking: when error is expected, log only at debug levelKlaus Aehlig