summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* file: `STRINGS` + `REGEX` store match resultsCristian Le2024-01-091-0/+37
| | | | Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
* Merge topic 'cmFileCopier-error-loss'Brad King2023-12-051-6/+5
|\ | | | | | | | | | | | | | | | | | | a820877d03 errors: avoid constructing a stream before getting the last error 5cf7018af6 cmFileCopier: remember error statuses and get their strings 0639a32d3a cmFileTimes: return status codes from APIs Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9023
| * errors: avoid constructing a stream before getting the last errorBen Boeckel2023-12-021-6/+5
| | | | | | | | | | Constructing a stream may involve operations that change the global error state. Avoid the streams by using `cmStrCat` instead.
* | cmFileCommand: combine string literalsBen Boeckel2023-10-201-7/+9
|/
* Source: Remove redundant FileIsSymlink checksscivision2023-09-181-2/+1
| | | | | | Replace `FileExists || FileIsSymlink` with `PathExists`. The latter does not resolve symlinks, so this is OK for use with broken symlinks, files, and directories.
* file: Clarify CMake only drops RPATHS's it addedRobert Maynard2023-08-151-2/+4
|
* Merge topic 'file-GENERATE-arg-parsing'Brad King2023-08-081-1/+2
|\ | | | | | | | | | | | | | | 88f90a72f1 file(GENERATE): Restore INPUT|CONTENT parse checking Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8694
| * file(GENERATE): Restore INPUT|CONTENT parse checkingEvan Wilde2023-08-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactoring in commit bff468c988 (cmFileCommand: Use cm::optional for keyword argument presence, 2022-06-30, v3.25.0-rc1~512^2) accidentally broke the check that the input argument is either `INPUT` or `CONTENT`. The check is supposed to fail when arguments are passed in the wrong order. For example: file(GENERATE OUTPUT ... TARGET <target> CONTENT <content>) Prior to this fix, the input method would be CONTENT, but because the first parsed keyword is not `CONTENT`, `inputIsContent` would be false. The first parsed keyword isn't INPUT either, so we would not continue into the error condition. CMake would then try to handle this as an input file, when there isn't one, resulting in uninitialized memory usage and segfaults or corruption later on. Fixes: #25169
* | file(REAL_PATH): resolve symlinks before '..' componentsRobert Maynard2023-07-201-3/+53
| | | | | | | | | | | | | | | | Previously REAL_PATH would collapse paths before resolving any symlinks so if `..` crossed a symlink the output from `REAL_PATH` would be wrong. It looked like REAL_PATH did this by mistake since it was a side-effect of ensuring we had an absolute path before resolving symlinks.
* | cmList: Add container conversion to stringMarc Chevrier2023-06-221-7/+8
|/
* file(REAL_PATH): Ensure same behavior as get_filename_component(REALPATH)Marc Chevrier2023-03-201-4/+3
| | | | Fixes: #24605
* file: Avoid using deprecated curl progress callbackBrad King2023-01-271-9/+21
|
* file(MAKE_DIRECTORY): Provide a more descriptive error messageTerence Noone2022-12-081-2/+4
| | | | | | Previously, MAKE_DIRECTORY would print `problem creating directory: {}`, which was very unhelpful for debugging. Extend the message with the OS error string.
* file(COPY_FILE): Add option to retry on Windows if input access failsBrad King2022-11-171-1/+7
| | | | | | | | On Windows, a file may be inaccessible for a short time after it is created. This occurs for various reasons, including indexing, antivirus tools, and NTFS's asynchronous semantics. Add an `INPUT_MAY_BE_RECENT` option to tell CMake that the input file may have been recently created so that we can retry a few times to read it.
* file(ARCHIVE_CREATE): Allow higher compression level for ZstdAmir Masoud Abdol2022-11-161-7/+16
| | | | | | | | This allows the Zstd compression-level to be set between 0-19. I've adjusted some of the tests, and error messages to indicates the selected algorithm, and min/max of its compression-level. Fixes: #24160
* cmGeneratorExpression: Require cmake instanceKyle Edwards2022-11-111-2/+4
|
* file(DOWNLOAD EXPECTED_HASH): better error message when download failedAurelien Regat-Barrel2022-11-091-5/+9
|
* file(DOWNLOAD): Fix LOG with EXPECTED_HASH on download failureAurelien Regat-Barrel2022-10-301-5/+7
| | | | | | | | | When `file(DOWNLOAD <url> EXPECTED_HASH <hash> LOG <logs>)` fails to download the requested file, the hash check will also fail and make the command exit without actually returning the curl logs as requested by the `LOG` argument. Report the log before checking the hash. Issue: #24093
* cmSystemTools: Provide quiet link creation methodsBrad King2022-10-061-4/+16
| | | | Offer variants that let the caller handle error messages.
* Merge topic 'parse-large-int'Brad King2022-09-211-2/+8
|\ | | | | | | | | | | | | | | | | 8fc822e13a file: Avoid strange istringstream crash in cmake.org binaries on Alpine Linux 31f158e4c8 cmStringAlgorithms: Add functions to parse strings to long long integers Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7698
| * file: Avoid strange istringstream crash in cmake.org binaries on Alpine LinuxBrad King2022-09-201-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | Somehow using `istringstream` and `operator >>` to parse an integer crashes on Alpine Linux, at least when compiled with the settings we use for the official `cmake.org` Linux binaries. Since commit fd0c285b12 (file: Fix types of the OFFSET and LIMIT arguments, 2022-01-04, v3.23.0-rc1~133^2), this causes the `file(READ)` command to crash when parsing its `LIMIT` or `OFFSET` argument. Parse the input string with our dedicated helper to avoid the crash. Fixes: #23872
* | file(DOWNLOAD): Fix message for existing file with matching hashMichael Hirsch2022-08-231-1/+1
| | | | | | | | | | | | | | | | | | file(DOWNLOAD STATUS) docs say the return list is of length 2. However, when an already downloaded file hash matches EXPECTED_HASH, the return message had a semicolon that made the return list length 3. Adjust the message to no longer contain the extra semicolon and to more clearly describe the situation.
* | cmFileCommand: Capture list of parsed keywords via bindingBrad King2022-07-251-7/+8
| |
* | cmArgumentParser: Drop unused keywordsMissingValue argument to Parse()Brad King2022-07-251-3/+2
| | | | | | | | | | All clients have been converted to encoding this requirement in their bindings.
* | cmFileCommand: Report keyword errors via argument parser resultsBrad King2022-07-221-97/+67
| |
* | cmFileCommand: Use cm::optional for keyword argument presenceBrad King2022-07-201-32/+18
| |
* | cmArgumentParser: Model maybe-missing string with wrapper typeBrad King2022-07-071-24/+14
| | | | | | | | | | | | Bindings to `std::string` require one value. Some clients have been filtering `keywordsMissingValue` to support keywords that tolerate a missing value. Offer them a type-safe way to achieve this instead.
* | cmArgumentParser: Model maybe-empty and non-empty lists with wrapper typesBrad King2022-07-071-44/+28
| | | | | | | | | | | | | | | | Previously bindings to `std::vector<std::string>` required at least one value. Some clients have been filtering `keywordsMissingValue` to support keywords followed by empty lists. Instead, require clients to specify whether a keyword's list can be empty as part of the binding type.
* | Merge topic 'file-TIMESTAMP-relative-path'Brad King2022-07-071-1/+5
|\ \ | | | | | | | | | | | | | | | | | | | | | 733801b57f file(TIMESTAMP): Interpret relative paths w.r.t. the source tree Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7440
| * | file(TIMESTAMP): Interpret relative paths w.r.t. the source treeTheBrokenRail2022-07-061-1/+5
| | | | | | | | | | | | Fixes: #23610
* | | cmFileCommand: Use cm::optional for keyword argument presenceBrad King2022-07-051-83/+61
| | |
* | | cmArgumentParser: Require callers to consider unparsed argumentsBrad King2022-07-051-2/+4
| | |
* | | cmArgumentParser: Avoid allocating copies of keyword stringsBrad King2022-07-051-39/+39
|/ /
* | file(ARCHIVE*): Simplify acceptance of empty list argumentsBrad King2022-06-291-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In `cmArgumentParser`, a keyword bound to a `std::vector<std::string>` value is reported in the list of keywords with missing values if the keyword appears followed by an empty list. For cases where we want to tolerate empty lists, clients need to filter out such keywords themselves before producing an error message. This may be improved in the future, but that is out of scope here. In commit c7e1198a23 (file: Add ARCHIVE_{CREATE|EXTRACT} subcommands, 2020-03-13, v3.18.0-rc1~530^2), a pattern for filtering out keywords that accept empty lists was copied from commit c998c8d560 (file(GET_RUNTIME_DEPENDENCIES): Tolerate empty list arguments, 2020-01-22, v3.17.0-rc1~111^2~1) incorrectly in two ways: * Keywords were included in the filter that do not accept empty lists. * Keywords were not in sorted order, breaking the filter operation. Those two bugs mostly canceled each other out, and the resulting behavior was to correctly report keywords with missing values. However, the `MTIME` keyword was accidentally accepted with no value by pretending the keyword was not given at all. Simplify the logic by removing keywords from the filters that should not be there. Leave `MTIME` in the filter for compatibility.
* | cmSystemTools: Fix 'ErrorOccurred' spellingFeRD (Frank Dana)2022-06-131-39/+39
| | | | | | | | | | | | | | | | Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to 's_ErrorOccurred' and 's_FatalErrorOccurred', respectively. Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and 'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
* | Merge topic 'curl-debug-callback'Brad King2022-05-241-2/+2
|\ \ | | | | | | | | | | | | | | | | | | e243b379ca cmFileCommand: Fix signature of CURLOPT_DEBUGFUNCTION callback Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7288
| * | cmFileCommand: Fix signature of CURLOPT_DEBUGFUNCTION callbackBrad King2022-05-231-2/+2
| | | | | | | | | | | | Curl documents that the callback should return type `int`.
* | | cmFileCommand: remove an unnecessary castBen Boeckel2022-05-241-1/+1
| | | | | | | | | | | | `cmCryptoHash::New` already returns a `unique_ptr`.
* | | clang-tidy: fix `performance-unnecessary-copy-initialization` lintsBen Boeckel2022-05-241-1/+1
|/ /
* | cmake -E tar: Add --touch optionKasper Laudrup2022-03-231-3/+8
| | | | | | | | | | | | | | | | Similar to GNU tar add a --touch option to the tar extract command to skip extracting the timestamps from the files in the archive effectively touching them as if they were just created. Issue: #22746
* | file(DOWNLOAD): Add options to download a rangem.klimenko2022-02-151-0/+31
|/
* file: Fix types of the OFFSET and LIMIT argumentsAlexey Edelev2022-01-131-14/+9
| | | | | | | | | | OFFSET argument cannot handle offsets bigger than INT_MAX because of the atoi function, which is used to convert the argument string to integer. Same applies for the LIMIT argument. Use the steam based reading and 64-bit types to convert and store arguments to avoid invalid values stored in the corresponding variables. Fixes: #23076
* Merge topic 'file-READ_ELF-capture-error'Brad King2022-01-121-3/+8
|\ | | | | | | | | | | | | | | 41bebbe50a file: Restore error capture in undocumented READ_ELF mode Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !6853
| * file: Restore error capture in undocumented READ_ELF modeBrad King2022-01-111-3/+8
| | | | | | | | | | | | | | | | | | Revise the error message added by commit 115ff6a347 (cmELF: Include the ELF parsing code unconditionally, 2021-06-17, v3.22.0-rc1~557^2) to honor the `CAPTURE_ERROR` option. This is needed by the call site in `BundleUtilities` to suppress errors on non-ELF files. Fixes: #23074
* | cmFileCommand: Update for new signature of GetLineFromStreamBrad King2022-01-111-6/+4
| |
* | Source: Replace most calls to sprintf with snprintfSean McBride2021-10-251-3/+4
|/
* cmFileCommand: improve error messageSeth R Johnson2021-10-121-3/+6
| | | | | Print full list of unresolved dependencies and a phrase that indicates what about the file is unresolved.
* Source: Fix clang -Wimplicit-fallthrough warningsSean McBride2021-09-281-1/+2
|
* Rename cmProp in cmValueMarc Chevrier2021-09-211-5/+5
|
* cmCurlSetCAInfo: use std::string as argumentMarc Chevrier2021-09-191-2/+2
|