Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: On windows path gets resolved with error because all / get replaced with \ even in closing tokens #676

Open
jtdLab opened this issue Dec 23, 2022 · 22 comments · May be fixed by #759
Open
Assignees
Labels
bug Something isn't working customer:🦄 investigating Investigating a reported issue

Comments

@jtdLab
Copy link

jtdLab commented Dec 23, 2022

Description

/ that are part of the closing tokens aka {{/foo}} get converted to a \ on windows when used in path.

Steps To Reproduce

  1. Brick with __brick__/{{#foo}}boom/baam/booz{{/foo}}/README.md
  2. Generate README.md

Expected Behavior
README.md should be generated at location boom\baam\booz\ if foo is true

But instead the /from {{/foo}} gets convertet to a \ and leads to an error
OS Error: The system cannot find the path specified

@jtdLab jtdLab added the bug Something isn't working label Dec 23, 2022
@jtdLab jtdLab changed the title fix: On windows path gets resolved with error becaus all / get replaced with \ even in closing tokens fix: On windows path gets resolved with error because all / get replaced with \ even in closing tokens Dec 23, 2022
@felangel
Copy link
Owner

Hi @jtdLab 👋
Thanks for opening an issue!

What is the value of the foo variable in this case? Can you please provide a link to a minimal reproduction sample? Thanks!

@felangel felangel added question Further information is requested waiting for response Waiting for additional information labels Dec 23, 2022
@felangel felangel self-assigned this Dec 23, 2022
@jtdLab
Copy link
Author

jtdLab commented Dec 23, 2022

Checkout the repo:

https://github.com/jtdLab/mason_windows_failure

Hint: the repo contains a github action run which illustrates the problem (mason generation fails on windows and completes on linux.)

Hope that helps

@jtdLab
Copy link
Author

jtdLab commented Dec 29, 2022

@felangel

@stcojo
Copy link

stcojo commented Jan 4, 2023

@felangel facing the same problem on Windows 10.

FileSystemException: Directory listing failed, path = 'C:/Users/Stefan/AppData/Local/Mason/Cache/git/mason_bricks_aHR0cHM6Ly9naXRodWIuY29tL2thY2l1bGEvbWFzb25fYnJpY2tz_b7a40356a469ad04579114864c70650cd4f12a50/app\__brick__\{{ projectName.lowerCase() }}\lib\features\common\data\local\{{#useHive}}locvbWFzb25fYnJpY2tz_b7a40356a469ad04579114864c70650cd4f12a50/app\__brical_store.dart{{\*' (OS Error: The system cannot find the path specified. ied. , errno = 3)

@felangel
Copy link
Owner

felangel commented Jan 4, 2023

@jtdLab @stcojo sorry for the delay (I was not able to get to this during the holiday break). I'm planning to take a closer look later today and hopefully get a fix for this very soon. Sorry for the inconvenience!

@felangel felangel added investigating Investigating a reported issue and removed question Further information is requested waiting for response Waiting for additional information labels Jan 4, 2023
@felangel
Copy link
Owner

@jtdLab can you re-test using the master branch of mason and regenerate the bundle?

@jtdLab jtdLab closed this as completed Jan 31, 2023
@jtdLab jtdLab reopened this Feb 15, 2023
@jtdLab
Copy link
Author

jtdLab commented Feb 15, 2023

@felangel im sry but looks like the error seems to be still around after regenerating the bundle.

@jtdLab
Copy link
Author

jtdLab commented Feb 15, 2023

@felangel I think the error is caused by the Maximum Path Length Limitation in the Windows API

@jtdLab jtdLab linked a pull request Feb 15, 2023 that will close this issue
7 tasks
@felangel
Copy link
Owner

@jtdLab apologies for the delay. I finally tried to reproduce the issue on a windows machine and was not able to reproduce using the latest version of mason. Can you please re-test using the latest version and let me know if this is still an issue for you? Thanks!

@felangel felangel added waiting for response Waiting for additional information and removed investigating Investigating a reported issue labels Feb 28, 2023
@jtdLab
Copy link
Author

jtdLab commented Feb 28, 2023

@felangel i simplified the example at https://github.com/jtdLab/mason_windows_failure the action run illustrates the problem.

@stcojo
Copy link

stcojo commented Mar 18, 2023

@felangel Problem still persists after updating to Updated to 0.1.0-dev.50

@jtdLab
Copy link
Author

jtdLab commented Mar 24, 2023

@felangel any updates on this?

@felangel
Copy link
Owner

@jtdLab apologies for the delay! I need to get my hands on a windows machine (should hopefully be able to pick one up this weekend).

@jtdLab
Copy link
Author

jtdLab commented May 19, 2023

@felangel I think the error is caused by the Maximum Path Length Limitation in the Windows API

@felangel This might help.

@predatorx7
Copy link

I'm facing a similar issue on Windows 10. I'm using mason's version 0.1.0-dev.50.

Output of `mason add generate -g`
PS > mason add generate -g
PathNotFoundException: Directory listing failed, path = 'C:\Users\BroadBand\AppData\Local\Mason\Cache\hosted\registry.brickhub.dev\generate_0.1.3\__brick__\{{#has_tests}}test\widgets\{{#is_schematic_widget}}{{name.snakeCase()}}\{{#needs_theme_for_widget}}{{name.snakeCase()}}_theme_test.dart{{\needs_theme_for_widget}}{{\*' (OS Error: The system cannot find the path specified.
, errno = 3)
Output of `flutter doctor -v`
[✓] Flutter (Channel stable, 3.10.1, on Microsoft Windows [Version 10.0.19045.2965], locale en-IN)
    • Flutter version 3.10.1 on channel stable at C:\sdks\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d3d8effc68 (7 days ago), 2023-05-16 17:59:05 -0700
    • Engine revision b4fb11214d
    • Dart version 3.0.1
    • DevTools version 2.23.1

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at C:\Users\BroadBand\AppData\Local\Android\Sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.6.0)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.6.33712.159
    • Windows 10 SDK version 10.0.22000.0

[✓] Android Studio (version 2022.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)

[✓] VS Code (version 1.78.2)
    • VS Code at C:\Users\BroadBand\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.64.0

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.2965]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 113.0.5672.127
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 113.0.1774.50

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

@felangel
Copy link
Owner

I just got a windows machine yesterday so I will finally look at this more closely later today. Sorry for the inconvenience!

@felangel felangel removed the waiting for response Waiting for additional information label May 24, 2023
@yahu1031
Copy link

yahu1031 commented Jun 3, 2023

@felangel Doesn't path package resolve this issue?

alestiago pushed a commit to alestiago/mason that referenced this issue Jun 9, 2023
* initial commit

* adding missing tests

* docs

* Update bricks/dart_frog_prod_server/hooks/pre_gen.dart

* Apply suggestions from code review

Co-authored-by: Scarlett Eliza <[email protected]>

* fix: docs format

---------

Co-authored-by: Scarlett Eliza <[email protected]>
@stcojo
Copy link

stcojo commented Jun 18, 2023

Any updates on this @felangel ? thanks

@mrverdant13
Copy link
Contributor

I was facing the same issue

The odd thing was that the paths were not congruent
image

After debugging the mason_cli locally, I found that the root cause is related to the cache.
In my case, this bug seemed to be triggered when I moved the brick directory to another nested location.
Since I was working on a globally added local brick, I just run mason remove -g <my_brick> and I didn't struggle with the issue again. I guess the same applies to mason cache clear.

@tomarra
Copy link
Collaborator

tomarra commented Jan 29, 2024

Alright I think we have a related ticket on very_good_flutter_plugin that can quickly reproduce the issue. For all the details take a look at VeryGoodOpenSource/very_good_flutter_plugin#144

Steps to Reproduce

  1. dart pub global activate very_good_cli
  2. dart pub global activate mason_cli
  3. mason add -g very_good_flutter_plugin

Pretty quickly you get the same error message

PathNotFoundException: Directory listing failed, path = 'C:/Users/Tom Arra/AppData/Local/Mason/Cache/hosted/registry.brickhub.dev/very_good_flutter_plugin_0.6.0\__brick__\{{project_name.snakeCase()}}\{{project_name.snakeCase()}}\example\{{#android}}android{{\android}}\app\src\main\kotlin\com\example\{{project_name.snakeCase()}}\*' (OS Error: The system cannot find the path specified.

@felangel
Copy link
Owner

Alright I think we have a related ticket on very_good_flutter_plugin that can quickly reproduce the issue. For all the details take a look at VeryGoodOpenSource/very_good_flutter_plugin#144

Steps to Reproduce

  1. dart pub global activate very_good_cli
  2. dart pub global activate mason_cli
  3. mason add -g very_good_flutter_plugin

Pretty quickly you get the same error message

PathNotFoundException: Directory listing failed, path = 'C:/Users/Tom Arra/AppData/Local/Mason/Cache/hosted/registry.brickhub.dev/very_good_flutter_plugin_0.6.0\__brick__\{{project_name.snakeCase()}}\{{project_name.snakeCase()}}\example\{{#android}}android{{\android}}\app\src\main\kotlin\com\example\{{project_name.snakeCase()}}\*' (OS Error: The system cannot find the path specified.

Awesome I’ll have a look asap, thanks!

@felangel felangel added the investigating Investigating a reported issue label Jan 30, 2024
@nouman-hanif
Copy link

any progress on this? I am facing this issue on Windows 11. This is keeping us from using mason to install new bricks from github

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working customer:🦄 investigating Investigating a reported issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants