Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
4.0.0
-
None
-
Linux
-
Fully Compatible
-
ALL
-
v4.0
-
Sharding 2019-05-20, Sharding 2019-06-03
Description
Discovered on SERVER-40953, introduced on SERVER-34006, partial (incomplete) fixes on SERVER-39604, SERVER-38935, SERVER-37435, reduced diagnostics on SERVER-40693, SERVER-36809, SERVER-36600, SERVER-38633, SERVER-31081 and probably others.
The cause is that #if !(__ANDROID_API__ <= 22) evaluates to false when __ANDROID_API__ isn't defined. This causes errnoWithDescription() to erroneously call the GNU strerror_r() from the code which handles the XSI strerror_r() variant. Since the GNU function always returns a non-NULL char * pointer, but XSI uses 0 for success and non-zero for failure, errnoWithDescription() always ends up returning kUnknownMsg.
Linux:
$ HOME=/root /omni/4.0.0/bin/mongo --nodb
|
MongoDB shell version v4.0.0
|
Welcome to the MongoDB shell.
|
For interactive help, type "help".
|
For more comprehensive documentation, see
|
http://docs.mongodb.org/
|
Questions? Try the support group
|
http://groups.google.com/group/mongodb-user
|
2019-05-06T16:31:28.707+1000 I STORAGE [main] In File::open(), ::open for '/root/.mongorc.js' failed with Unknown error
|
2019-05-06T16:31:28.707+1000 E - [main] Error loading history file: FileOpenFailed: Unable to fopen() file /root/.dbshell: Unknown error
|
>
|
bye
|
2019-05-06T16:31:29.845+1000 E - [main] Error saving history file: FileOpenFailed: Unable to open() file /root/.dbshell: Unknown error
|
$ HOME=/root /omni/3.6.12/bin/mongo --nodb
|
MongoDB shell version v3.6.12
|
Welcome to the MongoDB shell.
|
For interactive help, type "help".
|
For more comprehensive documentation, see
|
http://docs.mongodb.org/
|
Questions? Try the support group
|
http://groups.google.com/group/mongodb-user
|
2019-05-06T17:32:44.895+1000 I STORAGE [main] In File::open(), ::open for '/root/.mongorc.js' failed with Permission denied
|
2019-05-06T17:32:44.896+1000 E - [main] Error loading history file: FileOpenFailed: Unable to fopen() file /root/.dbshell: Permission denied
|
>
|
bye
|
2019-05-06T17:32:46.054+1000 E - [main] Error saving history file: FileOpenFailed: Unable to open() file /root/.dbshell: Permission denied
|
$
|
MacOS:
$ HOME=/ mongo --nodb
|
MongoDB shell version v4.0.6
|
Welcome to the MongoDB shell.
|
For interactive help, type "help".
|
For more comprehensive documentation, see
|
http://docs.mongodb.org/
|
Questions? Try the support group
|
http://groups.google.com/group/mongodb-user
|
2019-05-06T15:23:51.115+1000 I STORAGE [main] In File::open(), ::open for '//.mongorc.js' failed with Permission denied
|
>
|
bye
|
2019-05-06T15:24:13.495+1000 E - [main] Error saving history file: FileOpenFailed: Unable to open() file //.dbshell: Permission denied
|
$
|
Windows:
C:\>mongo --nodb
|
MongoDB shell version v4.0.4
|
Welcome to the MongoDB shell.
|
For interactive help, type "help".
|
For more comprehensive documentation, see
|
http://docs.mongodb.org/
|
Questions? Try the support group
|
http://groups.google.com/group/mongodb-user
|
2019-05-06T15:35:05.212+1000 I STORAGE [main] In File::open(), CreateFileW for 'C:\\.mongorc.js' failed with A required privilege is not held by the client.
|
> exit
|
bye
|
2019-05-06T15:40:48.635+1000 E - [main] Error saving history file: FileOpenFailed: Unable to fopen() file C:\/.dbshell: A required privilege is not held by the client.
|
|
|
C:\>
|
$ cat test-cpp-comparison.cpp
|
#include <iostream>
|
|
|
int main(int argc, char *argv[]) {
|
#if FOOBARBAZ >= 10
|
std::cerr << "unsafe: greater than or equal to 10" << std::endl;
|
#elif !(FOOBARBAZ >= 10)
|
std::cerr << "unsafe: less than 10" << std::endl;
|
#else
|
std::cerr << "unsafe: neither" << std::endl;
|
#endif
|
#if defined(FOOBARBAZ) && FOOBARBAZ >= 10
|
std::cerr << "safe: greater than or equal to 10" << std::endl;
|
#elif defined(FOOBARBAZ) && !(FOOBARBAZ >= 10)
|
std::cerr << "safe: less than 10" << std::endl;
|
#else
|
std::cerr << "safe: neither" << std::endl;
|
#endif
|
return 0;
|
}
|
$ g++ -o test-cpp-comparison test-cpp-comparison.cpp
|
$ ./test-cpp-comparison
|
unsafe: less than 10
|
safe: neither
|
$
|
Attachments
Issue Links
- is duplicated by
-
SERVER-40693 Mongo shell should surface errors from open() syscall
-
- Closed
-