Skip to content

Conversation

@TeoMahnic
Copy link
Collaborator

No description provided.

@xoriath
Copy link

xoriath commented Dec 9, 2025

Checking...

Found an unrelated issue with looking up .flms in the pack... want me to open another PR for that or just put a commit on top of this? (it's 2 lines for normalizing .. in the path inside the pack file...

@xoriath
Copy link

xoriath commented Dec 9, 2025

Looks good to me

0012301 D Running task notify [sequencer]
Connected to PIC32CK2051SG01144 [Halted]: 020057703RYN000336
pyocd> status
Core 0 (Cortex-M33):  Halted [Secure]
Core 1 (Cortex-M0+):  Running
pyocd> core
Core 0 (Cortex-M33) is selected
pyocd> core 1
Selected core 1 (Cortex-M0+) (AHB-AP#1)
pyocd> halt
0025596 D halting core 1 [cortex_m]
Successfully halted device
pyocd> status
Core 0 (Cortex-M33):  Halted [Secure]
Core 1 (Cortex-M0+):  Halted
pyocd>

@xoriath
Copy link

xoriath commented Dec 9, 2025

The bug I just hit is that we have a backwards walk in the pdsc;

            <algorithm name="PIC32CK-SG00/../keil/Flash/PIC32CK_SG_BFM.FLM"

which the ZipInfo.read does not resolve; so adding a resolve step fixes that;

diff --git i/pyocd/target/pack/cmsis_pack.py w/pyocd/target/pack/cmsis_pack.py
index 59700b5d..9d7dc28f 100644
--- i/pyocd/target/pack/cmsis_pack.py
+++ w/pyocd/target/pack/cmsis_pack.py
@@ -25,6 +25,7 @@ import logging
 import io
 import errno
 from pathlib import Path
+import posixpath
 from typing import (Any, Callable, Dict, List, IO, Optional, Tuple, TypeVar, Set, Union)
 
 from .flash_algo import PackFlashAlgo
@@ -193,12 +194,12 @@ class CmsisPack:
         """@brief Return file-like object for a file within the pack.
 
         @param self
-        @param filename Relative path within the pack. May use forward or back slashes.
+        @param filename Relative path within the pack. May use forward or back slashes and '..'.
         @return A BytesIO object is returned that contains all of the data from the file
             in the pack. This is done to isolate the returned file from how the pack was
             opened (due to particularities of the ZipFile implementation).
         """
-        filename = filename.replace('\\', '/')
+        filename = posixpath.normpath(filename.replace('\\', '/'))
 
         # Some vendors place their pdsc in some subdirectories of the pack archive,
         # use relative directory to the pdsc file while reading other files.

Created bug #1866 with fix #1867

@TeoMahnic
Copy link
Collaborator Author

Looks good to me

@xoriath thank you for confirming.

Created bug #1866 with fix #1867

I will review them, thank you. These items will be addressed outside this PR.

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.

3 participants