couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxepal <>
Subject [GitHub] couchdb-config pull request: 2708 stronger testing for config set
Date Thu, 04 Jun 2015 15:59:32 GMT
Github user kxepal commented on a diff in the pull request:
    --- Diff: src/config.erl ---
    @@ -177,9 +182,19 @@ delete(Section, Key, Reason) ->
     delete(Sec, Key, Persist, Reason) when is_binary(Sec) and is_binary(Key) ->
         delete(binary_to_list(Sec), binary_to_list(Key), Persist, Reason);
    -delete(Section, Key, Persist, Reason) when is_list(Section), is_list(Key) ->
    +delete(Section, Key, Persist, Reason) when is_boolean(Persist) ->
    +    assert_string(Section),
    +    assert_string(Key),
    +    if Reason == nil -> ok; true -> assert_string(Reason) end,
         gen_server:call(?MODULE, {delete, Section, Key, Persist, Reason}).
    +assert_string(Term) ->
    +    case io_lib:printable_list(Term) of
    --- End diff --
    Technically speaking, this is BC. Personally, I have to rename all my admins after this
PR or tweak CouchDB start options.
    Few more fun facts about this constraint:
    $ curl -X PUT http://localhost:15986/_config/test/тест -d '"failed"'
    $ curl -X PUT http://localhost:15986/_config/test/баз -d '"yes"'
    $ curl -X PUT http://localhost:15986/_config/test/баз -d '"passed?"'
    The `баз` comes to the assert function as `"баз"` or `[1073,1072,1079]`  while `тест`
comes as  `[209,130,208,181,209,129,209,130]`.
    More fun:
    $ curl -X PUT http://localhost:15986/_config/дома/водка -d '"медвед"'
    Printable range on node:
    $ dev/remsh 
    Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
    Eshell V6.4  (abort with ^G)
    (node1@> io:printable_range().
    So I think this assertion not only breaks compatibility, but also doesn't works well and
may cause confusion.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message