• Bug#1108378: git-debpush: should warn for superfluous quilt mode option

    From Sean Whitton@21:1/5 to Ian Jackson on Mon Jul 14 11:00:01 2025
    Hello,

    On Tue 01 Jul 2025 at 02:46pm +01, Ian Jackson wrote:

    But implementing this may be nontrivial. quilt mode archaeology is
    complex, and currently it is allowed to crash whenever it can't figure
    things out. I think this proposal involves distinguishing "something
    is unexpected about the git structure which means that we cannot
    determine the quilt mode automatically" from "something is seriously
    wrong and we should crash even if the user specified --quilt".

    Hmm, I think you must have misread my suggestion.
    I just mean that this code:


    # If the user didn't supply a quilt mode, look for it in a previous
    # tag made by this script
    if [ "x$quilt_mode" = x ] && [ "$format" = "3.0 (quilt)" ]; then
    set +o pipefail # perl will SIGPIPE git-cat-file(1) here
    if [ "x$last_debian_tag" != x ]; then
    quilt_mode=$(git cat-file -p $(git rev-parse "$last_debian_tag") \
    | perl -wne'/^\[dgit.*--quilt=([a-z+]+).*\]$/
    or next;
    print "$1\n"; exit')
    fi
    set -o pipefail
    fi


    should be run even if the user *did* supply a quilt mode, and if they
    are different it's a failed check.

    --
    Sean Whitton

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

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

    iQJNBAEBCgA3FiEEm5FwB64DDjbk/CSLaVt65L8GYkAFAmh0xEYZHHNwd2hpdHRv bkBzcHdoaXR0b24ubmFtZQAKCRBpW3rkvwZiQM86EAClN4Czri6/Fgi2q6PTxaUq kar308Il0KZUTA1cxhnAOmuvbnGmtIW7xZ5gGDk8S6Ei8cZFTgSd1P3iYaCKh0Xq HxRVdWFKWl5XC4KnPwWclohJU0qduaynzswku6H4yviJzehjrnWbNQBf8o9qpRgY pjD8gadpaxkpd2XRa4P1zV6TGnpr8JJiAbMXfmB1FCL4LBL28pJd6K/ehr6aPjCN rRNSfcUywrWVAYdD9IDWVRF/kf4upm2NyFIg3dUCv6vPoj2LD7gtgeLZziMLxD4Y 0/aTyJOIizH6HTUhF8zjdyozq7PBISENcUb8JPm6Wg91iZulIq/Q5e3bABfBqlGz UF4wt2Ae0wOXMhUqWGvb/hmZ1E6+ry0DbvHCyZ96pOsgxQBQcytA4R1VqzRlYk4t Gr7vPfKuBjoQSecCah2+YMieW9+Qe+q2LhN73ZS5Ar4IB5htGdaNr/4+I/w2iKfo f0eZ72CzWBNxgggSC2hONv4aClPHqV1e4Qc/lEpypKbOjpLTor3eRXwIOl/PYxS/ FNPKXeAu3FLJdBtwNwUuZ+oDhC4nRmF1iweiD2dMZahvK5xHK2yNgh0VoXKFKs/p +6AMKitjQY/Y6PX5lsS/fp0n5gq6oqSTRLS0pWHbvabD6SKtgSF10j2No7u4V500 yrQLAyVbyBMqdKo8UN7jjQ==6g6W
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Us
  • From Sean Whitton@21:1/5 to Sean Whitton on Mon Jul 14 11:00:01 2025
    Hello,

    On Mon 14 Jul 2025 at 09:48am +01, Sean Whitton wrote:

    should be run even if the user *did* supply a quilt mode, and if they
    are different it's a failed check.

    if they are the _same_ we print a warning*

    --
    Sean Whitton

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

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

    iQJNBAEBCgA3FiEEm5FwB64DDjbk/CSLaVt65L8GYkAFAmh0xG0ZHHNwd2hpdHRv bkBzcHdoaXR0b24ubmFtZQAKCRBpW3rkvwZiQH7PEACCP6l0naFEqpF74/jl3ww9 qp9wFmfd6XLUUm72WJcm1qIeia5SZdVZcgVKPQFklLwxQdZ/Bkq7vgq8ucBxTgF5 cufC+yjt5RDeDvuMwgv0odSGfv3hGG+6F0Jt6nZx/Q+O4LfibMeNERVtjCx0KvjZ +zexkBwvv9NyX3VffcFsT8CD6GkuKDTjQHWvvcVtKmF1pogO9MMBndG7vTugEMbX bxpA28NyeoVZKWSmXUNLpq4S0ldCXN+TAbd8AAsuqF4ZjVcUnyIr62IEVEj1d5wb dZZjNFYDGTx0NpU5CTLCmBSsWigfQi6WCnYzQOQYNNsNxvFQW+YayTvqdez0HMPL /tkbE4jE4YWgbDNlzohxm2GJdNGEtKHjmMnn5AwspTAw+iAYMqfdtmtfIhwHbPOs +VW1uSxv2ZeBqVdbOktmDsmRNbP3ea9dcvyDPBd/lVguACt/6Jw01EmL3Gr4/i6u lcKl2nEFCvMLyGJCDgOMAnkSsp+8JrS9C4OQ/+bT/a8yq5Lfb3HdkQn5st0ezpx3 L4iCkem36XGBrpZgArDgL70nrJAOag6uQqfPfmQ8ypJnQ9ILbgFbnNLQwI84uO9L NHQqUDH+IuqZ6N5ETqStGP+01mQDuWV2CboY+wJPxWuI2jIFNAo9ULeRRZ7wvYYi UHHe8ZVMO8KK0OfZyic7bg==GXsx
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Us
  • From Ian Jackson@21:1/5 to Sean Whitton on Mon Jul 14 11:10:01 2025
    Sean Whitton writes ("Re: Bug#1108378: git-debpush: should warn for superfluous quilt mode option on command line"):
    On Tue 01 Jul 2025 at 02:46pm +01, Ian Jackson wrote:
    But implementing this may be nontrivial. quilt mode archaeology is complex, and currently it is allowed to crash whenever it can't figure things out. I think this proposal involves distinguishing "something
    is unexpected about the git structure which means that we cannot
    determine the quilt mode automatically" from "something is seriously
    wrong and we should crash even if the user specified --quilt".

    Hmm, I think you must have misread my suggestion.

    I don't think so. I think I'm just being Dr Error Handling again...

    I just mean that this code:

    # If the user didn't supply a quilt mode, look for it in a previous
    # tag made by this script
    if [ "x$quilt_mode" = x ] && [ "$format" = "3.0 (quilt)" ]; then
    set +o pipefail # perl will SIGPIPE git-cat-file(1) here
    if [ "x$last_debian_tag" != x ]; then
    quilt_mode=$(git cat-file -p $(git rev-parse "$last_debian_tag") \
    | perl -wne'/^\[dgit.*--quilt=([a-z+]+).*\]$/
    or next;
    print "$1\n"; exit')
    fi
    set -o pipefail
    fi

    should be run even if the user *did* supply a quilt mode, and if they
    are different it's a failed check.

    This code can fail due to (for example) the tag named by
    last_debian_tag not existing, or having weird syntax.

    In that case, if the user supplied --quilt=, that's silently fine: we
    failed to check the user's work, but the anomaly is presumably why the
    user is passing that option.

    To put it in type threory terms in Rust syntax.

    Before:
    fn determine_quilt_mode_automatically(...)
    -> Result<QuiltMode, FatalError>

    After:
    fn determine_quilt_mode_automatically(...)
    -> Rdsult<Result<QuiltMode, CouldNotDetermineQuiltMode>, FatalError>

    This means that every program call needs to be considered for whether
    failure of this program (or perhpas, *this kind* of failure of this
    program) is "expected" (-> CouldNotDetermineQuiltMode, might be
    silently ignored) or "unexpedcted" (-> FatalError, always crash).

    That is doable but it's not trivial.

    Ian.

    --
    Ian Jackson <[email protected]> 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 Ian Jackson@21:1/5 to Sean Whitton on Mon Jul 14 12:00:01 2025
    Sean Whitton writes ("Bug#1108378: git-debpush: should warn for superfluous quilt mode option on command line"):
    Your point is that if they do supply one, then we need to distinguish
    between different possible failures to find one from the history,
    between those that should still be fatal errors and those which should
    be ignored because the --quilt option the user has passed is pseudo-overriding them?

    Yes.

    But, some nuance:

    I'm not sure "pseudo-overriding" is the right framing. When the user
    passes --quilt we're only doing all this work *only* to detect user
    mistake (so that we can fail a check, or print a warning).

    Detecting user mistakes is a best effort activity for git-debpush.

    So being unable to determine whether this kind of mistake has been
    made is not an error in itself. But, while we're doing that, if we
    discover that everything is totally broken, we *should* bomb out.

    Ian.

    --
    Ian Jackson <[email protected]> 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 Mon Jul 14 11:30:01 2025
    Hello,

    On Mon 14 Jul 2025 at 10:00am +01, Ian Jackson wrote:

    I don't think so. I think I'm just being Dr Error Handling again...

    Heh.

    This code can fail due to (for example) the tag named by
    last_debian_tag not existing, or having weird syntax.

    In that case, if the user supplied --quilt=, that's silently fine: we
    failed to check the user's work, but the anomaly is presumably why the
    user is passing that option.

    To put it in type threory terms in Rust syntax.

    Before:
    fn determine_quilt_mode_automatically(...)
    -> Result<QuiltMode, FatalError>

    After:
    fn determine_quilt_mode_automatically(...)
    -> Rdsult<Result<QuiltMode, CouldNotDetermineQuiltMode>, FatalError>

    This means that every program call needs to be considered for whether
    failure of this program (or perhpas, *this kind* of failure of this
    program) is "expected" (-> CouldNotDetermineQuiltMode, might be
    silently ignored) or "unexpedcted" (-> FatalError, always crash).

    That is doable but it's not trivial.

    If the user doesn't supply a quilt mode option then it's always a fatal
    error if we can't find one from the history.

    Your point is that if they do supply one, then we need to distinguish
    between different possible failures to find one from the history,
    between those that should still be fatal errors and those which should
    be ignored because the --quilt option the user has passed is
    pseudo-overriding them?

    --
    Sean Whitton

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

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

    iQJNBAEBCgA3FiEEm5FwB64DDjbk/CSLaVt65L8GYkAFAmh0zVsZHHNwd2hpdHRv bkBzcHdoaXR0b24ubmFtZQAKCRBpW3rkvwZiQCt1EACTx4Om6aFKF3bCezebY4lZ toBPXSuwd4jXjNuMOzhET2sULKuT3qJFcDQAqKcG8VSqG8CgNNSIGCXcuITF/+uq UPmtR7t/h54ijc7OU7yrrjRSsRoH9chZF5UK3hPYQaIMLrRyCrJzvJnF8C1efF7l IYsBw6EPNx7hKRiNkaHF1Pq54NmLCuniRYJ63rJt3T8YhuliRt2xvODSoUcI6bH2 hAnsLzA9qrxFBhEXqnhAFCKwe4pAcfTEbCPGqSBVde/tgTC7zaZ6MHGqL313uj7I Yf9xxX/QQiUkVOwK23FB0UCO6zdvS+VWo4zDDNaxGZ5YRIRTQthQq1sclgMzeoWv 4DFj6KuH5xtT+CbbETJy2TusBfhvs+XpNFNjSOBHmI8gXJ3Y5/BUNAZFBcMSbWO3 FQvJdcnQ0uI+e0QUuM8VfqtIXFYZGEGVchJW9waGatnQzpD+lEOb6zvK8Z/7qwh0 FdDnqMMuUbSoPKqmGa03GQygXSTKOTNzxD+UmfXcRjY7F/tn1F0oA6El0FPt+Efh /hHImnn7iIbgqAtrE+g9AKkUveGi+FGFwmFq/roaNtK2RnHQ5Ke4KyWYZnp8P1Hn iHAl3kT6Wv+VyXvM8TVcisdA8cpkewzCjSQCnGmipjL6/0AophCTpRR06IPsUb+L Ru6rTldTwS5UESAvuWBPNA==Xj2V
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Us
  • From Sean Whitton@21:1/5 to Ian Jackson on Tue Jul 15 11:20:02 2025
    Hello,

    On Mon 14 Jul 2025 at 10:54am +01, Ian Jackson wrote:

    Sean Whitton writes ("Bug#1108378: git-debpush: should warn for superfluous quilt mode option on command line"):
    Your point is that if they do supply one, then we need to distinguish
    between different possible failures to find one from the history,
    between those that should still be fatal errors and those which should
    be ignored because the --quilt option the user has passed is
    pseudo-overriding them?

    Yes.

    But, some nuance:

    I'm not sure "pseudo-overriding" is the right framing. When the user
    passes --quilt we're only doing all this work *only* to detect user
    mistake (so that we can fail a check, or print a warning).

    Detecting user mistakes is a best effort activity for git-debpush.

    So being unable to determine whether this kind of mistake has been
    made is not an error in itself. But, while we're doing that, if we
    discover that everything is totally broken, we *should* bomb out.

    Right.

    --
    Sean Whitton

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

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

    iQJNBAEBCgA3FiEEm5FwB64DDjbk/CSLaVt65L8GYkAFAmh2GvEZHHNwd2hpdHRv bkBzcHdoaXR0b24ubmFtZQAKCRBpW3rkvwZiQCOlEACmaDjv8uSlCw+saywVVaV2 uHxNw/LXgNUj9eaiXZM2zr+Fe4N72WkGj2FcFhI9F8GiJl9+kIZdjM7wv7a9Lopc T8bN/cN6XzHkcN39VqqFllloqakNj5Sfp51RkM4meSOaI5nCwuokORRQuFb2c14C Mo7jnlpMqbecanF/Q9nqH2K57UUsGQ79G30tDtFwhwsJH0TPcnvDjAR/qSN51UkS ZB5RBWjizmt2PK5AO2wERa2rfLF3Q2ApBCEKXjvztP9ZjlguMCvwazvcltxger1t QlYlDX4j5wDqA9AwygxQ/+A9xUYMcaXu0v2X5A5AoSMonA9qXLzQDvp8dR51Qjva G78ZqIPkZ1V9gohh0q9X1n/Rmtm1+T0jibzbbuqB96HGcucnIt1one87eBoGgMev 6NWRIBkUX5RPetCTte9LRo7cpPMbg7+F3A85SOVv5r4Rrbb9hW/59zIPVcJSmhyr I5yxrEKC++FUe/V8/K/YzUIODUVbIsfqhREFpYwX9l4SqMxx2rA0sUCZPE+H8kor BIlgfCddwpjEkhxfV76wFjnZEKvIsVZD78WfsfpYfD610fR4pb0C96Z0fSdxS8vh 57Ej4TEqkQNFQcXYNm+i3Kgknac4K2lisDMwrTfliu5eX8sYRlb0zhT1nz8EBPui 9PxlM3IfIcXquEGosR+g4A==Oyeu
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Us
  • From Sean Whitton@21:1/5 to All on Sat Aug 2 21:00:01 2025
    Hello,

    I think that we might want to do more than just print a warning to
    stderr, because that might not help users enough to learn how
    git-debpush works or to change their habits.

    This seems especially significant in light of how this program normally
    does not output errors or warnings without either pausing for
    confirmation or giving up completely. Anything in its printed output
    that does not involve pausing or stopping is therefore too easily missed
    or ignored.

    I can think of a few options:

    1. say that the quilt mode option was superfluous, then print
    [acknowledge] (or similar), and require the user to press return
    before continuing
    2. make it work just like a failed check. The user has to type y and
    then return to continue. Sounds a bit strange in the abstract but
    might be the most useful in practice.
    3. just exit, requiring the user to run the command again without the
    superfluous quilt option.

    For all three, --batch would switch to just a printed warning.

    --
    Sean Whitton

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ian Jackson@21:1/5 to Sean Whitton on Sat Aug 2 21:30:01 2025
    Sean Whitton writes ("Re: Bug#1108378: git-debpush: should warn for superfluous quilt mode option on command line"):
    I think that we might want to do more than just print a warning to
    stderr, because that might not help users enough to learn how
    git-debpush works or to change their habits.

    Yes. I don't know if that's enough.

    1. say that the quilt mode option was superfluous, then print
    [acknowledge] (or similar), and require the user to press return
    before continuing

    This is quite similar to:

    2. make it work just like a failed check. The user has to type y and
    then return to continue. Sounds a bit strange in the abstract but
    might be the most useful in practice.

    I think this is my preference.

    I think it would be better not to introduce new ways to grumble.

    Reasonable options are:

    a. Refuse
    b. Failed check (prompt)
    c. Grumble on stderr but do it anyway
    d. Silently do it anyway

    Currently we don't have any (b). I'm fine if we don't add them now,
    but of course programs we call (eg git) might well do (b) so we can't
    avoid them entirely.

    3. just exit, requiring the user to run the command again without the
    superfluous quilt option.

    Urgh, I don't like this, UX.

    For all three, --batch would switch to just a printed warning.

    I think --batch turns failed checks into errors? That seems right
    here. If you're writing script and know you're passing a
    possibly-superfluous quilt mode, you're writing a script which
    unconditionally overrides git-debpush's determination, so you ought to
    pass a specific --force-failed-check option (I forget how those are
    spelled...)

    Ian.

    --
    Ian Jackson <[email protected]> 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 Ian Jackson@21:1/5 to Ian Jackson on Sat Aug 2 21:40:01 2025
    Ian Jackson writes ("Bug#1108378: git-debpush: should warn for superfluous quilt mode option on command line"):
    Reasonable options are:

    a. Refuse
    b. Failed check (prompt)
    c. Grumble on stderr but do it anyway
    d. Silently do it anyway

    Currently we don't have any (b). I'm fine if we don't add them now,
    but of course programs we call (eg git) might well do (b) so we can't
    avoid them entirely.

    I mean (c).

    Ian.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sean Whitton@21:1/5 to Ian Jackson on Sun Aug 3 00:40:01 2025
    Hello,

    On Sat 02 Aug 2025 at 08:22pm +01, Ian Jackson wrote:

    Sean Whitton writes ("Re: Bug#1108378: git-debpush: should warn for superfluous quilt mode option on command line"):
    2. make it work just like a failed check. The user has to type y and
    then return to continue. Sounds a bit strange in the abstract but
    might be the most useful in practice.

    I think this is my preference.

    I think it would be better not to introduce new ways to grumble.

    Right, that is what I was thinking. Thanks for the review.

    3. just exit, requiring the user to run the command again without the
    superfluous quilt option.

    Urgh, I don't like this, UX.

    Me neither.

    For all three, --batch would switch to just a printed warning.

    I think --batch turns failed checks into errors? That seems right
    here. If you're writing script and know you're passing a possibly-superfluous quilt mode, you're writing a script which unconditionally overrides git-debpush's determination, so you ought to
    pass a specific --force-failed-check option (I forget how those are spelled...)

    Ah, yes, that's right.

    --
    Sean Whitton

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

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

    iQJNBAEBCgA3FiEEm5FwB64DDjbk/CSLaVt65L8GYkAFAmiOkywZHHNwd2hpdHRv bkBzcHdoaXR0b24ubmFtZQAKCRBpW3rkvwZiQH+6D/4g/XSEcAcC0BcXWLDXxytV XkgCf0WcgaVXIFOpyqeybGTmBDe/DsJ44O5EHw5PrqDK608+uqCw+ofycRQ4AyFk sVqNGK7tW4AfqLpUduW+m/TLQf+qXX2cTx/W1gNDf1+rBtUqpQr3tShcq0UPfGW7 a/IoGxIrC4K90Gk8h3vn7nxcerLXQ2CsfoXAGuY7Z5CmqCKMRHcHg8Seg2jEjBd/ iELZi2yCA3CLPm1aOFZWpCpBpEwqv5c8/W4O5XeJzT/SlMNpHldH0IGkgVM8iXBA JA2l6prO44mfCiKfwLWNqgg2KR+cBVGQFmxcjcdvHaO21tqPekpXfjhFOPoqD+zO X5zj61/HQc/ALd1Amjek9RQdJFZuxdEm3d2hCqvgodwLG2eWuuqx/VhMhYFGGG5l QzfNp/9Crr+cxJ8/zkvGnCCru+2omWYxUaxWZ1hpllWoQlCV+tFQ36p/m2FW4MVH uShLssabKoHfBgrtXyVFy2z3QdTzr/7uMg5O1DoOPmZI4iAScPK/eicAy6iDXzpN hpd/NBnN/bdo3R77mT7fUM+d9Ysi0dowHpkHvR6mPmzPj/lD77K7/uQb047y3LTP OGWco9xgdJWKR8plnApyepf2x5ic66SoKwJHgrF5zhcpQVt+vsLbkINWxEngytKS 8FqA9tvqeQokhZfn7bBZPQ==eUsG
    -----END PGP SIGNATURE-----

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