Acknowledged

Bug: Include barrel by path with a .barrel file present causes weird behaviour

Have jungle file that includes a barrel:

project.manifest = manifest.xml
FOO = "../barrels/FOO"
# similar results
FOO = ["../barrels/FOO/monkey.jungle"]
base.FOO.annotations = whatever
base.barrelpath = $(base.barrelpath):$(FOO)

This works nice and fine.

Now, if for whatever reason you have build a barrel in the barrel can be found IN the path, eg ../barrels/FOO/bin/FOO.barrel and you later add a function to the barrel without making the barrel file) and want to use that function the project that has the above mentioned barrel include it breaks. You'll get messages like Undefined symbol "foo" detected. It appears the barrel is than looked up via the barrel file and not via the path, which is not what you expect given the monkey.jungle file you have. Especially if you specify a monkey.jungle file.

  • I believe I have discovered the problem. This is working as you would expect on windows, but when I try it on Ubuntu it does not. I think it is failing to rebuild the barrel at compile time on only Linux so any changes to the barrel are not being updated when you attempt to run the app or its tests. Deleting the bin folder bin folder would then force it to build the barrel and find any new changes. 

    At any rate there is definitely enough here to reproduce what you are seeing so I'll pass this along to the dev team. 

  • the function notexists(msg) in source/Test/More.mc is the function that got added after the barrel build was done.

  • My barrel annotion is actually OPN so there isn't a name clash. I can tar two projects that exhibit this problem, sure.

    https://drive.google.com/drive/folders/1dLiFKe12C6pMjuV0zPvzW5zfmy5Wyu_N?usp=sharing

    ```
    ERROR: fenix6xpro: /home/ciq/src/source/t/typechecking.mc:27: Undefined symbol ':notexists' detected.
    make: *** [/etc/garmin-connectiq/Makefile.ciq:32: bin/fenix6xpro-TheBuggyApp-3.2.6.test.prg] Error 105`

    ```

    If you remove the bin dir from OPN-MonkeyC you don't get the error

    ```

    _ciq@d9231fe54002:~/src$ make test
    mkdir -p bin
    monkeyc -w -l 1 \
    -o bin/fenix6xpro-TheBuggyApp-3.2.6.test.prg \
    -d fenix6xpro \
    -c 3.2.6 \
    -y /home/ciq/.Garmin/ConnectIQ/developer.der \
    -f /home/ciq/src/monkey.jungle \
    -t

    ERROR: fenix6xpro: /home/ciq/src/source/t/typechecking.mc:27: Undefined symbol ':notexists' detected.
    make: *** [/etc/garmin-connectiq/Makefile.ciq:32: bin/fenix6xpro-TheBuggyApp-3.2.6.test.prg] Error 105
    _ciq@d9231fe54002:~/src$ rm -rf ../barrels/OPN/bin/*
    _ciq@d9231fe54002:~/src$ make test
    mkdir -p bin
    monkeyc -w -l 1 \
    -o bin/fenix6xpro-TheBuggyApp-3.2.6.test.prg \
    -d fenix6xpro \
    -c 3.2.6 \
    -y /home/ciq/.Garmin/ConnectIQ/developer.der \
    -f /home/ciq/src/monkey.jungle \
    -t
    WARNING: The launcher icon (30x30) isn't compatible with the specified launcher icon size of the device 'fenix6xpro' (40x40). Image will be scaled to the target size.
    export DISPLAY_OLD=:0
    DISPLAY=:1 Xvfb ":1" -screen 0 1280x1024x24 &
    pkill simulator || true
    DISPLAY=:1 simulator 1>/dev/null & sleep 1
    18:32:32: Debug: Adding duplicate image handler for 'JPEG file'
    18:32:32: Debug: SetLayout
    monkeydo ./bin/fenix6xpro-TheBuggyApp-3.2.6.test.prg fenix6xpro -t
    ------------------------------------------------------------------------------
    Executing test TestTypechecking.testTypechecker...
    I do not exist in the barrel
    # Works for me
    PASS
    ------------------------------------------------------------------------------
    Executing test OPN.testTime...
    PASS
    ------------------------------------------------------------------------------
    Executing test OPN.testDuration...
    PASS
    ------------------------------------------------------------------------------
    Executing test OPN.testWeight...
    PASS
    ------------------------------------------------------------------------------
    Executing test OPN.testTestMore...
    PASS
    ------------------------------------------------------------------------------
    Executing test OPN.testUUID...
    # 17c2b4c3a8c24cc38375576cc2b8c2acc285c3861f473579
    # 25677f47-c38b-42a6-9d40-c3a252c3aac2
    # ????????
    C???????? ????"????????????
    PASS
    ------------------------------------------------------------------------------
    Executing test OPN.testGetCoordinates...
    PASS
    ------------------------------------------------------------------------------
    Executing test OPN.testGetCoordinatesOfBox...
    PASS
    ------------------------------------------------------------------------------
    Executing test OPN.testTemp...
    PASS
    ------------------------------------------------------------------------------
    Executing test OPN.testDistance...
    PASS

    ==============================================================================
    RESULTS
    Test: Status:
    TestTypechecking.testTypechecker PASS
    OPN.testTime PASS
    OPN.testDuration PASS
    OPN.testWeight PASS
    OPN.testTestMore PASS
    OPN.testUUID PASS
    OPN.testGetCoordinates PASS
    OPN.testGetCoordinatesOfBox PASS
    OPN.testTemp PASS
    OPN.testDistance PASS
    Ran 10 tests

    PASSED (passed=10, failed=0, errors=0)
    pkill simulator
    pkill Xvfb

    ```

  • We've been looking at this for awhile now and are not able to reproduce this issue. Does the problem go away if you don't have the function named the same thing as your barrel annotations? 

    Would you be able to zip up a project and barrel that demonstrates this issue and share it?

  • fwiw, I'm on linux, so maybe it works differently on another OS.