Problem/Motivation

Pop quiz, hot shot: what's the difference between rsync --exclude=src and rsync --exclude=./src?

Pretty significant, actually: the first one will exclude any directory named src, in the whole tree. The second one will only exclude a top-level directory (relative to the directory where rsync was called) named src.

Right now, CollectPathsToExcludeEvent::addPathsRelativeToProjectRoot() uses the first form. In certain situations -- specifically, GitPod developments of Project Browser, where its top-level src directory is cloned into the project root -- that results in rsync getting called with --exclude=src, which causes the stage to have NO src directories in it at all. 💩

Proposed resolution

Composer Stager fixed this upstream in 2.0.0-alpha2, so let's update to that.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Oh, this will also need an upstream follow-up to ensure that Composer Stager's PHP file syncer also treats its exclusions the same way rsync does. Consistency is crucial here.

phenaproxima’s picture

Assigned: Unassigned » tedbow
Status: Active » Needs review
tedbow’s picture

Assigned: tedbow » Unassigned
omkar.podey’s picture

Assigned: Unassigned » omkar.podey
omkar.podey’s picture

i just reverted my change, seems like i'm missing something, wouldn't leaving the slashes in the prefix make relative paths appear to be absolute?

omkar.podey’s picture

Assigned: omkar.podey » Unassigned
omkar.podey’s picture

Issue summary: View changes
FileSize
75.79 KB

the excluded paths lists looks like, some of them now have paths staring from ./ but i don't think they are being actually excluded because of the failing tests.

omkar.podey’s picture

Maybe I shouldn't have added the ./ to the file names and only to the directories.

omkar.podey’s picture

is this going in the right direction ? or am i missing something?

Wim Leers’s picture

Assigned: Unassigned » phenaproxima
Status: Needs review » Needs work
Issue tags: +Needs issue summary update

The issue summary only talks about the rsync file syncer, not the php one.

How does this affect that? AFAICT it shouldn't affect that at all, because we're not collecting a list of patterns to exclude, but a list of paths to exclude. This becomes clearer by reading \Drupal\package_manager\PathExcluder\GitExcluder::excludeGitDirectories(), which if we were excluding patterns wouldn't have to first find all paths to exclude: it could then just exclude .git and be done.

Isn't this just a bug in Composer Stager? It's either a bug in:

  1. \PhpTuf\ComposerStager\Infrastructure\Service\FileSyncer\RsyncFileSyncer? AFAICT that's just misinterpreting the PathListInterface $exclusions it receives.
  2. or in \PhpTuf\ComposerStager\Infrastructure\Value\PathList\PathList::assertValidInput()
tedbow’s picture

Agree with #12 we need an issue in Composer-Stager. Depending on how quickly a fix can be implemented there we should wait for that or not

phenaproxima’s picture

Title: CollectPathsToExcludeEvent needs to exclude paths relative to the project root prefixed with './' so they are not ambiguous to rsync » [PP-upstream] CollectPathsToExcludeEvent needs to exclude paths relative to the project root prefixed with './' so they are not ambiguous to rsync
Status: Needs work » Postponed

Opened https://github.com/php-tuf/composer-stager/issues/183 against Composer Stager.

Assuming this gets fixed upstream (and I think it is likely that it will be), we should probably just close out this issue once we have updated to a new release that contains the bugfix. But for now, postponing on that.

tedbow’s picture

Issue tags: +Pittsburgh2023
phenaproxima’s picture

Title: [PP-upstream] CollectPathsToExcludeEvent needs to exclude paths relative to the project root prefixed with './' so they are not ambiguous to rsync » Update Composer Stager to 2.0.0-alpha2 to resolve a bug in the rsync file syncer
Issue summary: View changes
Status: Postponed » Active
phenaproxima’s picture

Assigned: phenaproxima » tedbow
Status: Active » Needs review
tedbow’s picture

Status: Needs review » Reviewed & tested by the community

Looks good

  • phenaproxima committed c85daa53 on 3.0.x
    Issue #3365151 by phenaproxima, omkar.podey: Update Composer Stager to 2...
phenaproxima’s picture

Status: Reviewed & tested by the community » Fixed
Wim Leers’s picture

Issue summary: View changes
Wim Leers’s picture

Assigned: tedbow » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.