Skip to content

Conversation

@amgross
Copy link
Contributor

@amgross amgross commented Jan 28, 2026

I think as we have this context option it is important to add test to ensure it is never be broken (totally at least).
To be honest, I am not on windows so I didn't checked it is working (my AI claim there are multiple problems in UserContextWinDisk, let see if he right)

@amgross
Copy link
Contributor Author

amgross commented Jan 28, 2026

@BrianPugh this PR shouldn't be merged, seems like the new test was skipped also on windows.
This probably mean that we got import error on win32file (hence not HAS_WIN32FILE is true).
This probably mean that need to pip install win32file.
Important point: does it mean that also in our pypl release for windows the package was created without win32file? would it cause issues?

@amgross
Copy link
Contributor Author

amgross commented Jan 28, 2026

@BrianPugh so there were bugs in UserContextWinDisk that prevented it to work.
One option is to merge my PR which fixing it and adding test. Other option (which I think is better) is to totally remove this class, as it wasn't in use till now (as it had bugs) it just shouldn't be supported as it seems like not interesting enough for the effort of writing it good (yes, even if there will be someone one day that will miss it, most won't need it).

@BrianPugh
Copy link
Collaborator

Other option (which I think is better) is to totally remove this class, as it wasn't in use till now

I'm a bit conflicted; if it was indeed broken and noone has reported it, then it certainly doesn't seem well used. However, I also know that a lot of embedded people end up doing development on Windows machine (for one reason or another). Also, @jrast might be a windows-user, which might be why this class exists in the first place, so I wouldn't want to remove functionality that they specifically developed. It's also entirely possible that people who depend on this feature are pinned to a quite-old version of littlefs-python in a "if it ain't broken, don't update it" mindset. Maybe it works in certain environments?

I'm leaning towards merging in your fix (and make sure that the test always runs if the os is win32, not if win32file exists). But I definitely understand your argument for removing it. What do you think?

@jrast
Copy link
Owner

jrast commented Jan 28, 2026

The UserContextWinDisk was added by @Jiajun-Huang back in 2023 (a286289). So mabe some input from his / her side?

Honestly, I'm not using littlefs-python myself since a longer time (based on the projects we work on). However, a huge thank you to all of you, mostly @BrianPugh for keeping the package up to date!

@amgross
Copy link
Contributor Author

amgross commented Jan 29, 2026

Hi @BrianPugh , I think I understand the confusing part here (if the code is really broken, why it was inserted):
In the PR where it was added (#67), the example usage/test there was mounting and reading merelly. Hence I assume that this feature was never tested/used for changing win file (my fixes are around the writing parts).

Hence removing it totally is really not the correct solution, options are to merge my changes (and really support win32file writes, is it really needed or just adding complexity and corner cases?) or to prevent write operations into filesystem that uses the windows context (I think I can provide such PR).

Copy link
Collaborator

@BrianPugh BrianPugh left a comment

Choose a reason for hiding this comment

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

The fix looks simple enough, let's go ahead with this PR with just 1 slight change. Thanks for doing this!



@pytest.mark.skipif(
not HAS_WIN32FILE or sys.platform != "win32",
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's remove the HAS_WIN32FILE check and just have this only be conditional on if the sys.platform is win32. I don't think we need to import win32file at all within this test and it should all "just work" on all platforms.

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