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

Pantry.Repo.archiveSubmodules does not respect variable expansion on PowerShell #129

Closed
mpilgrem opened this issue Feb 22, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mpilgrem
Copy link
Member

Motivation and discussion: commercialhaskell/stack#5536

The problem is that $displaypath is expanded prematurely (before it has a value) on PowerShell because https://hackage.haskell.org/package/process-1.6.18.0/src/System/Process/Windows.hsc translateInternal encloses all arguments in double quotes (extract):

    Gnu -> runGitCommand
      [ "submodule"
      , "foreach"
      , "--recursive"
      , "git -c core.autocrlf=false archive --prefix=$displaypath/ -o bar.tar HEAD; "
        <> "tar" <> forceLocal <> " -Af " <> tarball <> " bar.tar"
      ]

The proposed solution is to use (or the closest to it, with BSD tar):

git ls-files --recurse-submodules | tar <force-local> -caf <tarball> --verbatim-files-from -T-
@mpilgrem mpilgrem self-assigned this Feb 23, 2024
@mpilgrem mpilgrem added the bug Something isn't working label Feb 23, 2024
@mpilgrem
Copy link
Member Author

@jship, I have run into a problem with this proposed solution. git archive preserves the attributes of the files in the repository. It knows, for example, that test-inject.sh is marked as executable. git clone followed by tar does not preserve that attribute. That is reflected in the failing unit test on Windows.

@mpilgrem
Copy link
Member Author

@jship, I am going to revert to a solution that detects if variable expansion is occurring and then escapes the command in git submodule foreach if it is.

mpilgrem added a commit that referenced this issue Feb 25, 2024
Fix #129 loadRawPackage works with submodules on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant