Add check for 0-byte files to cpreq - #7
Conversation
|
I found a couple of bugs that require fixing:
|
|
Along these lines.... we do need to make sure cpreq can be replaced with cp in our scripts. cpreq isn't on other systems so people will alias cpreq to cp, and it still needs to just work like a normal cp command would. Can you verify that as you go through this work? |
Yes, the tests I included so far aim to demonstrate and verify that |
* Add special handling for `cp -t` * Fix bug for single-option cases, which previously did not work * Add tests for single, multiple, and `-t` options
Testing cpreq against WCOSS packagesDescriptionTargeted packages/jobs
Testing process
export PATH=${HOME<model>}/ush/cpreq:${PATH}
echo "cpreq is $( which cpreq )"
Performed tests to "alias"
cpreq() {
/usr/bin/cp "$@"
}
export -f cpreq
declare -f cpreq
ResultsThe following output files are available on Dogwood. epoch.v1.0.7 ecmwf_mos.v1.2.3
With
SummaryThe proposed version of |
|
Follow-up on discussion from @CarlosMDiaz-NCO regarding the comment from @StevenEarle-NCO above. We could start an aliases "library" for developers to make it easier for them to use some utilities during development. For example, cpreq() {
filtered_args=("${@//\-z/}")
cmd="cp ${filtered_args[*]}"
$cmd
}
export -f cpreqwhich could be sourced in a developer's |
|
This version of I still do not have solid evidence that this would work without issues in operations. Specifically, it isn't clear which packages might expect to copy empty files. I have started searching for which packages use I am open to suggestions that would help discover which packages expect to copy potentially empty files. I think it would be wise to figure this out before moving this change into production. |
|
Given the potential impact this could have on operations and uncertainty around which packages or jobs it could affect, I have an idea to propose. We could roll out this version of Thoughts? |
Summary
This PR adds a check for 0-byte files in
cpreqand an option to skip the 0-byte check. By defaultcpreqwill now raise an error when one or more of its arguments are size 0.Notes
cpreqthat covers many use cases and b) patched versions oferr_exitanderr_chkdesigned specifically for use in tests.testsdirectory is not allowed under the current implementation standards. I believe it should be included here to demonstrate that the current solution works and to make testing easier in the future. See [New Standard]: Add directory tests/ for unit tests nws-hpc-standards#17 for further discussion.Todo
Complete
tests/test_cpreq.shteardownfunction intest/test_cpreq.sh-tand-Toptions forcpcpcasescpreqwithcpagainst packages on WCOSS