pyOCD icon indicating copy to clipboard operation
pyOCD copied to clipboard

Pack with algorithm path that contains '..' fails to load

Open xoriath opened this issue 1 month ago • 0 comments

We (Microchip) have packs that contains paths that are relative and backing up, due to our structure;

<algorithm name="PIC32CK-SG00/../keil/Flash/PIC32CK_SG_BFM.FLM"
                       start="0x8000000"
                       size="0x20000"
                       RAMstart="0x20000000"
                       RAMsize="0x8000"
                       default="1"
                       style="Keil"/>

This fails to load in pyOCD as it tries to directly open PIC32CK-SG00/../keil/Flash/PIC32CK_SG_BFM.FLM with the zipfile module; and the zipfile module only resolves paths that are actually in the zip dictionary.

Fix is simple enough; normalize the path when reading out the loader.

Discovered when testing #1865 for @TeoMahnic

xoriath avatar Dec 09 '25 16:12 xoriath