• Bug#1107226: [PATCH fyi 2/2] git-debpush: Check for presence of git sub

    From Ian Jackson@21:1/5 to Sean Whitton on Fri Jun 6 19:00:01 2025
    Control: clone -1 -2
    Control: reassign -2 dgit
    Control: retitle -2 dgit: want to detect and reject submodule git data
    Control: reopen -2
    Control: severity -2 minor

    Sean Whitton writes ("[PATCH fyi 2/2] git-debpush: Check for presence of git submodules"):
    +# ---- Submodules
    +
    +# Per gitmodules(7) "FORMS", .gitmodules is always present at the
    +# top-level of the tree if there are submodules.
    +[ -n "$(git ls-tree --full-tree "$branch" -- .gitmodules)" ] \
    + && fail_check submodule \
    + "git submodule(s) detected; these are not supported"

    This made me suspicious because what a submodule *really* is is a
    dangling commit reference instead of a tree reference in the git
    objects. .gitmodules is just some metadata used by the
    `git submodule` command.

    But after doing some experiments, I think this test is good in
    git-debpush. But thinking about this makes me want dgit to be more
    picky.

    I don't think this is urgent since the anomalous states seem to be
    rejected by most git submodule tooling so probably don't exist in the
    wild very much, but you could perhaps make them by manually deleting .gitmodules.

    Ian.

    Using 3cbfc9ed2d0e32f1d0556b2541087d1bb79f4a19
    from https://github.com/mozilla/cubeb

    zealot:cubeb> git checkout upstream/main
    Previous HEAD position was b29e340 Update changelog for 0.0~git20240524.dabff20+ds-1 release
    HEAD is now at 832fcf3 wasapi: Fix formatting.
    zealot:cubeb> cat .gitmodules
    [submodule "googletest"]
    path = googletest
    url = https://github.com/google/googletest
    [submodule "cmake/sanitizers-cmake"]
    path = cmake/sanitizers-cmake
    url = https://github.com/arsenm/sanitizers-cmake
    [submodule "src/cubeb-coreaudio-rs"]
    path = src/cubeb-coreaudio-rs
    url = https://github.com/mozilla/cubeb-coreaudio-rs
    branch = trailblazer
    [submodule "src/cubeb-pulse-rs"]
    path = src/cubeb-pulse-rs
    url = https://github.com/mozilla/cubeb-pulse-rs
    branch = dev
    zealot:cubeb> git submodule status
    -aab6948fa863bc1cbe5d0850bc46b9ef02ed4c1a cmake/sanitizers-cmake -40412d85124f7c6f3d88454583c4633e5e10fc8c googletest -8f39e9fc3ad4868e6ff7188c52575087a1a02777 src/cubeb-coreaudio-rs -6bac666467e4a37cf057f0e17e8c9e8a024b060b src/cubeb-pulse-rs
    zealot:cubeb> git-rm -f .gitmodules
    rm '.gitmodules'
    zealot:cubeb> git commit -m 'rm .gitmodules'
    [detached HEAD 6954ccd] rm .gitmodules
    1 file changed, 14 deletions(-)
    delete mode 100644 .gitmodules
    zealot:cubeb> git submodule status
    fatal: no submodule mapping found in .gitmodules for path 'cmake/sanitizers-cmake'
    zealot:cubeb> ll googletest/
    total 8
    drwxrwsr-x 2 ian ian 4096 Jun 6 17:39 ./
    drwxrwsr-x 12 ian ian 4096 Jun 6 17:40 ../
    zealot:cubeb> git log googletest/
    zealot:cubeb> git-ls-tree googletest/
    fatal: Not a valid object name googletest/
    zealot:cubeb> git-ls-tree googletest
    fatal: Not a valid object name googletest
    zealot:cubeb> git-ls-tree HEAD:googletest
    fatal: not a tree object
    zealot:cubeb> ls
    AUTHORS CMakeLists.txt cubeb.supp googletest/ INSTALL.md README.md src/ test/
    cmake/ Config.cmake.in docs/ include/ LICENSE scan-build-install.sh* subprojects/ tools/
    zealot:cubeb> git-ls-tree HEAD:docs
    100644 blob 8ec863be8ea00ebdc3818535f09193442033059e Doxyfile.in zealot:cubeb> git-ls-tree HEAD:googletest
    fatal: not a tree object
    zealot:cubeb> git-ls-tree HEAD:
    100644 blob b8b0df0bf257a507ac981593af45ce5bf4dc8585 .clang-format
    040000 tree 94006555eb06dbd4ea8c5fc570a784da8f1e0f59 .github
    100644 blob e524d792f4cbf97b0d78d50636ebbd6b3192b88a .gitignore
    100644 blob f0f9595227f27af11dd640dd86c3ce18dad50478 AUTHORS
    100644 blob 633653d7444639518baf71de4472ac4f18ebc66c CMakeLists.txt
    100644 blob be464aa4923e214ddcc73c2d41695fbc6b5c91e6 Config.cmake.in
    100644 blob 4f83a652001802630e2febfaebca08bed13097b3 INSTALL.md
    100644 blob fffc9dc4053647ff5895bd3a2e43c8c8f9d14c50 LICENSE
    100644 blob e4e1658824394ab6b885af71f565a9625e5c340c README.md
    040000 tree bcbcbe97f08d1f410a40a25490d4f33feb07cea7 cmake
    100644 blob 0012ea51e6543a169018104cd795fe74a3f131bb cubeb.supp
    040000 tree 2b9892f6a668f7899be9c27950b376baf66152ac docs
    160000 commit 40412d85124f7c6f3d88454583c4633e5e10fc8c googletest
    040000 tree 09c5f19e330a6041ae4534bc51c8f276b7e0b67b include
    100755 blob 3e1b4969e7f459674d2d7c045c74e988a1e2040e scan-build-install.sh 040000 tree 6b2c118ffe666921072071aa94b35f407fdeb0e8 src
    040000 tree 758603bae5c9c8eeeab0ab9655483c2fb5dc0712 subprojects
    040000 tree 66d44b4e2b9aafd8ebaab51094f211b9872a31ec test
    040000 tree cabedf4c07fc654ecb70b8e886e1fec468acc9f3 tools
    zealot:cubeb> git submodule foreach echo
    fatal: No url found for submodule path 'cmake/sanitizers-cmake' in .gitmodules zealot:cubeb> git submodule status
    zealot:cubeb>

    --
    Ian Jackson <ijackson@chiark.greenend.org.uk> These opinions are my own.

    Pronouns: they/he. If I emailed you from @fyvzl.net or @evade.org.uk,
    that is a private address which bypasses my fierce spamfilter.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sean Whitton@21:1/5 to Ian Jackson on Fri Jun 6 19:30:01 2025
    Hello,

    On Fri 06 Jun 2025 at 05:49pm +01, Ian Jackson wrote:

    This made me suspicious because what a submodule *really* is is a
    dangling commit reference instead of a tree reference in the git
    objects. .gitmodules is just some metadata used by the
    `git submodule` command.

    But after doing some experiments, I think this test is good in
    git-debpush.

    Yes, I went through a few iterations before settling on looking for .gitmodules.

    But thinking about this makes me want dgit to be more picky.

    I don't think this is urgent since the anomalous states seem to be
    rejected by most git submodule tooling so probably don't exist in the
    wild very much, but you could perhaps make them by manually deleting .gitmodules.

    Sounds reasonable.

    --
    Sean Whitton

    --=-=-Content-Type: application/pgp-signature; name="signature.asc"

    -----BEGIN PGP SIGNATURE-----

    iQJNBAEBCgA3FiEEm5FwB64DDjbk/CSLaVt65L8GYkAFAmhDIEEZHHNwd2hpdHRv bkBzcHdoaXR0b24ubmFtZQAKCRBpW3rkvwZiQD9BD/4zBbfElS65TR0brnZjX8my L3yltu7oZoW6WtueWQY3wISA6yYByQM2gsw/2qOSfjBF00eA40j1jw9KnXkBWhiG nj+oonminvHBU9OiwlLCYrQnkfIyMoDOqFA5hC8ec8gyD5CVACbI9xcO4fSYSXSk EjnWYEzubkNjDLAn2YQwjXrJi0JrXXjJQ5pHIcM8r7+qKDtGeBRxqcOUveRXXD8S eIWponHti4VE9tj79pJ+CTXQxtUUvMkBrFVJAczmmaYL4IWVBRBQ8AWmNG3rSBkU Xn4ZkOftHtB/CB3rn+rXfFtfS0z1dbh2mXBwXy+OCzCO8dEASKaxUhReCYRZKxP1 Ptft62YlQbb85AL4E2dowDPrMcwnXNlY6m/7Mm5UbnRO6eeokotKjIqZJ4lsO8I6 dwmrVapSXzEBCwKffHvv0xeqvRHGQ9uZ2puEu6aQZP70EEM6YtSqIUgNo1zJuIG3 e5SjAFXKaJ/b7/w/DFzp8teBzS7GCHeBAW2vWsqxoU6zciure4zk2jAorVGcke9p UCAJfpSB1MuRrhwWpqwlhYdcuWITdorAKqVz+NZ6MNXbbENxoM76gj7Fe+p2R1YZ HbMmgvSi5Qf3vbf1FErxyVQX5dZfacme4sh2xlbMx55/HMM5o/PhnsbaF5jPTNtR 7ZuJ2jy9pgq01g7jRSTcSQ=¬Tn
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usen