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

Edit command is stuck in infinite loop because of recursive symbolic links #5685

Closed
roanutil opened this issue Dec 15, 2023 · 1 comment · Fixed by #5813
Closed

Edit command is stuck in infinite loop because of recursive symbolic links #5685

roanutil opened this issue Dec 15, 2023 · 1 comment · Fixed by #5813
Labels
type:bug Something isn't working

Comments

@roanutil
Copy link
Contributor

What happened?

Run tuist edit in a project where purchases-ios package is cloned. It may be cloned into ./Tuist/.build/... or ./Tuist/Dependencies/....

For some reason, this package contains symbolic links back to its root directory. For example: purchases-root. When Tuist runs the edit command, it eventually goes down a call stack like this:

  • EditCommand.run
  • EditService.run
  • ProjectEditor.edit
  • ManifestFilesLocator.locateProjectManifests
  • ManifestFilesLocator.fetchTuistManifestsFilePaths
  • FileHandler.glob
  • AbsolutePath.glob
  • Glob.init
  • Glob.expandGlobStar
  • FileManager.subdirectoriesResolvingSymbolicLinks

This is where it gets in trouble. There is no guard against an infinite search because a symbolic link leads to a location above itself.

How do we reproduce it?

  • Add purchases-ios package as a dependency to a tuist workspace
  • Run tuist fetch
  • Run tuist edit

Error log

the tuist edit command will hang because it's in a loop

macOS version

14.2

Tuist version

3.35.4

Xcode version

15.1.0

@roanutil roanutil added the type:bug Something isn't working label Dec 15, 2023
@haifengkao
Copy link
Contributor

haifengkao commented Jan 19, 2024

same here. it's quite silly

relativeSubpath

Tuist/.build/checkouts/purchases-ios/Tests/InstallationTests/CarthageInstallation/purchases-root/Tests/InstallationTests/CarthageInstallation/purchases-root/Tests/InstallationTests/CarthageInstallation/purchases-root/Tests/InstallationTests/CarthageInstallation/purchases-root/Tests/InstallationTests/CarthageInstallation/purchases-root/Tests/InstallationTests/CarthageInstallation/purchases-root/Tests/InstallationTests/CarthageInstallation/purchases-root/Tests/InstallationTests/CarthageInstallation/purchases-root/ci_scripts/Tests/InstallationTests/CarthageInstallation/purchases-root/ci_scripts/Tests/InstallationTests/CarthageInstallation/purchases-root/ci_scripts/Tests/InstallationTests/CarthageInstallation/purchases-root

haifengkao added a commit to haifengkao/tuist that referenced this issue Jan 19, 2024
pepicrft added a commit that referenced this issue Feb 23, 2024
* store the visited paths to avoid infinite loop

close #5685

* fix linting

---------

Co-authored-by: Daniele Formichelli <df@bendingspoons.com>
Co-authored-by: Pedro <pedro@pepicrft.me>
Co-authored-by: Pedro Piñera Buendía <663605+pepicrft@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants