mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.42k stars 1.56k forks source link

regression: subprojects update fails in GStreamer CI #11646

Open xclaesse opened 1 year ago

xclaesse commented 1 year ago

GStreamer CI fails with Meson RC2: https://gitlab.freedesktop.org/xclaesse/gstreamer/-/jobs/39234752

To reproduce:

Note that omitting . solves the problem, it was added in f6d13c69e521c6d94eb695c05d4f8f4091bd0172.

Some details:

I think what happens is shutil.copytree() changes symlinks and git stash (at least version in docker: 2.25.4) is buggy and cannot stash that kind of diff.

xclaesse commented 1 year ago

CC @eli-schwartz @tp-m

eli-schwartz commented 1 year ago

Git will synthesize the dot automatically on newer versions of git. That's the bug that the linked commit solves.

Gstreamer CI failed with the error message that that commit describes, before the change -- that's where I discovered it. So I'm skeptical that omitting the dot should solve anything. It should just fail even earlier.

xclaesse commented 1 year ago

So I'm skeptical that omitting the dot should solve anything. It should just fail even earlier.

I mean it solves this specific issue when I run manually git stash push --all in that docker /subprojects/gst-plugins-rs of that docker image.

eli-schwartz commented 1 year ago

Note: your reproducer is broken because it doesn't mimic what meson actually does, you need the negation pathspec :!/.meson-subproject-wrap-hash.txt as it's totally critical to the underlying logic. The git commands aren't mix-and-match.

This is probably why your manual run didn't totally error out when you removed the dot.

xclaesse commented 1 year ago

Possibly, I did not find how to properly bash quote that argument when running manually.

git stash --push all ":!/.meson-subproject-wrap-hash.txt"
bash: !/.meson: event not found
eli-schwartz commented 1 year ago

Simply single-quote it instead.

Or add set +o histexpand to your bashrc and never again worry about ! breaking everything due to weird bash features no one actually wants. :P

xclaesse commented 1 year ago

Thanks, good to know.

I think this change in GStreamer should fix the issue: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4326. I'm not sure there is a way to work around this in Meson, we are already dogging git issues...

eli-schwartz commented 1 year ago

FWIW I still cannot even duplicate this issue locally.

$ rm ./audio/spotify/LICENSE-MPL-2.0
$ cp LICENSE-MPL-2.0 ./audio/spotify/LICENSE-MPL-2.0
$ file ./audio/spotify/LICENSE-MPL-2.0
./audio/spotify/LICENSE-MPL-2.0: ASCII text

$ cd ../../
$ ~/git/meson/meson.py subprojects update --reset
executing: /usr/bin/git remote get-url origin
executing: /usr/bin/git remote set-url origin https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/
executing: /usr/bin/git rev-parse --abbrev-ref HEAD
executing: /usr/bin/git fetch --refmap '+refs/heads/*:refs/remotes/origin/*' --refmap '+refs/tags/*:refs/tags/*' origin HEAD
executing: /usr/bin/git status --porcelain ':!/.meson-subproject-wrap-hash.txt'
executing: /usr/bin/git stash push --all ':!/.meson-subproject-wrap-hash.txt' .
executing: /usr/bin/git checkout --ignore-other-worktrees HEAD --
executing: /usr/bin/git status --porcelain ':!/.meson-subproject-wrap-hash.txt'
executing: /usr/bin/git reset --hard FETCH_HEAD
executing: /usr/bin/git submodule update --checkout --recursive
executing: /usr/bin/git show --quiet '--pretty=format:%h%n%d%n%s%n[%an]'
Updating gst-plugins-rs...
Saved working directory and index state WIP on main: 8576af24 transcriberbin: Set start-time-selection=first to cea608mux

  -> 8576af24 (HEAD -> main) transcriberbin: Set start-time-selection=first to cea608mux [Seungha Yang]

$ cd -
$ $ file ./audio/spotify/LICENSE-MPL-2.0
./audio/spotify/LICENSE-MPL-2.0: symbolic link to ../../LICENSE-MPL-2.0