View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003772 | OpenFOAM | Bug | public | 2021-12-28 12:09 | 2021-12-28 15:17 |
Reporter | niklas.wikstrom | Assigned To | henry | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | x86_64 | OS | fedora | OS Version | 35 |
Product Version | dev | ||||
Fixed in Version | dev | ||||
Summary | 0003772: Foam::cp() (POSIX) always returns false for file copy | ||||
Description | When using Foam::cp() to copy a file, the function always returns false. This appears to be a wrong behaviour, since it makes it more difficult to assert success. The error might(!) be that std::ifstream::rdbuf() does not set the eof() flag: srcStream.eof() returns 0 both before and after the << srcStream.rdbuf() | ||||
Steps To Reproduce | Build and run the attached application # ./testFiles someFile copiedFile | ||||
Additional Information | Also tested on the current docker image release. | ||||
Tags | No tags attached. | ||||
|
testFiles.tgz (1,101 bytes) |
|
What do you propose to resolve this issue? |
|
I looked into the options for error handling and there is nothing obvious with is system independent. When we move to C++17 we will replace the current implementation of cp with filesystem::copy_file which provides error handling but in the meantime I think the best we can do is remove the EOF test. |
|
The attached variant is probably naive, but it is at least faster (and it can be "eof checked"). I suppose one can remove the check altoghether, since it is not used in recursive cp (same function) anyway. This is ofcourse a tiny issue, but I wanted to report it, since I stumbled on it for a while. Happy new year! testFiles.C (2,237 bytes) |
|
Resolved by commit 9f6e8e5effac9804af850bbb67bef660713d9c40 |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-12-28 12:09 | niklas.wikstrom | New Issue | |
2021-12-28 12:09 | niklas.wikstrom | File Added: testFiles.tgz | |
2021-12-28 13:18 | henry | Note Added: 0012351 | |
2021-12-28 14:23 | henry | Note Added: 0012352 | |
2021-12-28 14:31 | niklas.wikstrom | File Added: testFiles.C | |
2021-12-28 14:31 | niklas.wikstrom | Note Added: 0012353 | |
2021-12-28 15:17 | henry | Assigned To | => henry |
2021-12-28 15:17 | henry | Status | new => resolved |
2021-12-28 15:17 | henry | Resolution | open => fixed |
2021-12-28 15:17 | henry | Fixed in Version | => dev |
2021-12-28 15:17 | henry | Note Added: 0012354 |