Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[defect]: some type-incorrect unlang code can trigger an assertion when executed #5247

Open
jejones3141 opened this issue Dec 20, 2023 · 3 comments
Labels
defect category: a defect or misbehaviour

Comments

@jejones3141
Copy link
Contributor

jejones3141 commented Dec 20, 2023

What type of defect/bug is this?

Crash or memory corruption (segv, abort, etc...)

How can the issue be reproduced?

  1. Replace the contents of src/tests/modules/redis/cluster_reset.inc with those of the attached file
    cluster_reset.txt
    (renamed so github would accept it). Then

MODULE_TEST_DIR=src/tests/modules/redis/ MODULE_TEST_UNLANG=src/tests/modules/redis/cluster_key.unlang build/make/jlibtool --silent --timeout=300 --mode=execute ./build/bin/local/unit_test_module -D share/dictionary -d src/tests/modules/ -i "build/tests/modules/redis/cluster_key.attrs" -f "build/tests/modules/redis/cluster_key.attrs" -r "build/tests/modules/redis/cluster_key" -xx

The redis cluster key test will fail while trying to execute

if ((%redis(-@%redis.node('b','1'),'GET','b') == "%{control.Tmp-String-0}") && \
     (%redis(-@%redis.node('c','1'),'GET','c') == "%{control.Tmp-String-1}") && \
     (%redis(-@%redis.node('d','1'),'GET','d') == "%{control.Tmp-String-2}")) {
	break
}

The full output is in
debug_log.txt. Selected output appears in the "relevant log output" section below.

Log output from the FreeRADIUS daemon

This issue shows up when running a test, rather than in the operation of the FreeRADIUS daemon.

Relevant log output from client utilities

Debug : (0)            if ((%redis(-@%redis.node('b','1'),'GET','b') == "%{control.Tmp-String-0}") &&                       (%redis(-@%redis.node('c','1'),'GET','c') == "%{control.Tmp-String-1}") &&                        (%redis(-@%redis.node('d','1'),'GET','d') == "%{control.Tmp-String-2}"))  {
Debug : (0)              | &&
Debug : (0)                | ==
Debug : (0)              | %logical_and()
Debug : (0)                    | %redis(-@%redis.node('b','1'),'GET','b')
Debug : (0)                      | %{%redis(-@%redis.node('b','1'),'GET','b')}
Debug : (0)                      | redis
Debug : (0)                            Key "b" -> slot 3300
Debug : (0)                          | %redis.node({b}{1})
Debug : (0)                          | --> 127.0.0.1:30004
Debug : (0)                        0 of 0 connections in use.  You  may need to increase "spare"
Debug : (0)                        Opening additional connection (0), 1 of 12 pending slots used
Debug : rlm_redis (redis) - [6] Connecting to node 127.0.0.1:30004
Debug : (0)                        Reserved connection (0)
Debug : (0)                        Executing command: GET
Debug : (0)                        With arguments
Debug : (0)                          [1] b
Debug : (0)                      | %redis({-@, 127.0.0.1:30004}{GET}{b})
Debug : (0)                      | --> NULL
Debug : (0)                    | cast
Debug : (0)                        | %{control.Tmp-String-0}
Debug : (0)                          | %{%{control.Tmp-String-0}}
Debug : (0)                          | control.Tmp-String-0
Debug : (0)                            | %{control.Tmp-String-0}
Debug : (0)                            | --> 1-ipsKGrCH
Debug : (0)                    | %cast({string}{1-ipsKGrCH})
Debug : (0)                    | --> 1-ipsKGrCH
ASSERT FAILED src/lib/util/calc.c[2697]: dst->type == FR_TYPE_BOOL
CAUGHT SIGNAL: Aborted

Backtrace from LLDB or GDB

No response

@jejones3141 jejones3141 added the defect category: a defect or misbehaviour label Dec 20, 2023
@alandekok
Copy link
Member

can you reformat the log so that it's readable? Put the text into a block in between triple quotes, and it should work

a
b

@jejones3141
Copy link
Contributor Author

Done.

@alandekok
Copy link
Member

Is the bug fixed? If not, it should remain open.

@jejones3141 jejones3141 reopened this Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect category: a defect or misbehaviour
Projects
None yet
Development

No branches or pull requests

2 participants