Skip to content

[HOTFIX] Transform paths to binary as expected - #47

Merged
ziopio merged 2 commits into
masterfrom
ziopio/hotfix
Jul 31, 2026
Merged

[HOTFIX] Transform paths to binary as expected#47
ziopio merged 2 commits into
masterfrom
ziopio/hotfix

Conversation

@ziopio

@ziopio ziopio commented Jul 31, 2026

Copy link
Copy Markdown
Member

The whole codebase expects to handle binaries, propagate paths as lists can cause bugs

This fixes a bug, this function expects paths as binaries otherwise it silently fails at matching template extension.

check_template(File, Target) ->
    case filename:extension(File) of
        <<".mustache">> ->
            {{template, File}, filename:rootname(Target, <<".mustache">>)};
        _Else ->
            {File, Target}
    end.

A non match means no loader config -> NO BOOTABLE SD CARD

Tested with a grisp2 deployment

ziopio added 2 commits July 31, 2026 09:44
The whole codebase expects to handle binaries, propagate paths as lists can cause bugs
@ziopio
ziopio requested a review from maehjam July 31, 2026 07:47
@ziopio ziopio changed the title Transform paths to binary as expected [HOTFIX] Transform paths to binary as expected Jul 31, 2026

@maehjam maehjam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good small hot fix.

Maybe we should discuss the fact that we expect binaries for filenames in the whole code base and consider a refactoring towards lists for filenames or handling both cases everywhere. Also this bug points to missing test coverage. (Just checked we don't have tests in the repo at all 👀 )

@maehjam

maehjam commented Jul 31, 2026

Copy link
Copy Markdown
Member

Looks a bit like something dialyzer would find. I tried and couldn't see a warning directly related to it, but there are a bunch of dialyzer warnings for this repo. That would be easier to include in the development pipeline and we should include it first before working on testing via common tests.

@ziopio

ziopio commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

Yes I did not want to include a refactoring here.
This is quite sneaky to prevent.
We could write a common test module to simulate grisp_tools operations as rebar3_grisp does, but without a real deployment we cannot really catch a bug like this.

What we could do is sanitize all handlings of binaries that are more strict then the return type of filename functions.
So we either manage both strings and bins, or we call iolist_to_binary to ensure that we either crash or operate correctly.

@ziopio
ziopio merged commit 86b4ed0 into master Jul 31, 2026
9 checks passed
@ziopio
ziopio deleted the ziopio/hotfix branch July 31, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants