[SERVER-14110] Inconsistent handling of numerical base specifier in startup options Created: 30/May/14  Updated: 11/Jul/16  Resolved: 03/Jun/14

Status: Closed
Project: Core Server
Component/s: Usability
Affects Version/s: 2.6.1, 2.7.1
Fix Version/s: 2.7.2

Type: Bug Priority: Major - P3
Reporter: Shaun Verch Assignee: Shaun Verch
Resolution: Done Votes: 0
Labels: community-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-14131 parseNumberFromString cannot parse fl... Closed
is related to SERVER-13022 AF_UNIX socket file should not force ... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Steps To Reproduce:

$ ./mongod --port 027017
2014-05-30T17:05:38.232-0400 [initandlisten] MongoDB starting : pid=12624 port=27017 dbpath=/data/db 64-bit host=sv.local
2014-05-30T17:05:38.233-0400 [initandlisten] _DEBUG build (which is slower)
2014-05-30T17:05:38.233-0400 [initandlisten] db version v2.6.2-pre-
2014-05-30T17:05:38.233-0400 [initandlisten] git version: ad9df9f23b3ff4c831ff642817bd2befb8bf4609
2014-05-30T17:05:38.233-0400 [initandlisten] build info: Darwin sv.local 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2014-05-30T17:05:38.233-0400 [initandlisten] allocator: tcmalloc
2014-05-30T17:05:38.233-0400 [initandlisten] options: { net: { port: 27017 } }
 
...
 
$ cat config.ini
port=027017
$ ./mongod -f config.ini
2014-05-30T17:05:49.180-0400 [initandlisten] MongoDB starting : pid=12642 port=27017 dbpath=/data/db 64-bit host=sv.local
2014-05-30T17:05:49.181-0400 [initandlisten] _DEBUG build (which is slower)
2014-05-30T17:05:49.181-0400 [initandlisten] db version v2.6.2-pre-
2014-05-30T17:05:49.181-0400 [initandlisten] git version: ad9df9f23b3ff4c831ff642817bd2befb8bf4609
2014-05-30T17:05:49.181-0400 [initandlisten] build info: Darwin sv.local 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2014-05-30T17:05:49.181-0400 [initandlisten] allocator: tcmalloc
2014-05-30T17:05:49.181-0400 [initandlisten] options: { config: "config.ini", net: { port: 27017 } }
 
...
 
$ cat config.yaml
net:
    port:
        027017
$ ./mongod -f config.yaml
2014-05-30T17:06:09.153-0400 [initandlisten] MongoDB starting : pid=12673 port=11791 dbpath=/data/db 64-bit host=sv.local
2014-05-30T17:06:09.154-0400 [initandlisten] _DEBUG build (which is slower)
2014-05-30T17:06:09.154-0400 [initandlisten] db version v2.6.2-pre-
2014-05-30T17:06:09.154-0400 [initandlisten] git version: ad9df9f23b3ff4c831ff642817bd2befb8bf4609
2014-05-30T17:06:09.154-0400 [initandlisten] build info: Darwin sv.local 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2014-05-30T17:06:09.154-0400 [initandlisten] allocator: tcmalloc
2014-05-30T17:06:09.154-0400 [initandlisten] options: { config: "config.yaml", net: { port: 11791 } }
 
...

Sprint: Server 2.7.2
Participants:

 Description   

In a YAML config, a leading "0" causes the number to be interpreted as an octal number, but for the INI config and the command line this leading zero is just ignored.



 Comments   
Comment by Githook User [ 03/Jun/14 ]

Author:

{u'name': u'Shaun Verch', u'email': u'shaun.verch@mongodb.com'}

Message: SERVER-14110 Take responsibility for numerical conversions away from boost program options
Branch: master
https://github.com/mongodb/mongo/commit/4add46aa8dd05a5c6d8af2c798eef6e9b5e4164b

Comment by Shaun Verch [ 31/May/14 ]

Marking as minor backwards compatibility change since fixing this will change the behavior of both the command line and the old config file in cases where the number is prefixed with a leading zero.

Generated at Thu Feb 08 03:33:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.