Debian Bug report logs - #900545
dput: Emit the response body as a debug message, when HTTP error response

version graph

Package: dput; Maintainer for dput is Ben Finney <bignose@debian.org>; Source for dput is src:dput (PTS, buildd, popcon).

Reported by: Alexandre Viau <aviau@debian.org>

Date: Fri, 1 Jun 2018 04:48:02 UTC

Severity: wishlist

Tags: patch

Fixed in version dput/1.1.0

Done: Ben Finney <bignose@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Ben Finney <bignose@debian.org>:
Bug#900545; Package dput. (Fri, 01 Jun 2018 04:48:04 GMT) (full text, mbox, link).


Acknowledgement sent to Alexandre Viau <aviau@debian.org>:
New Bug report received and forwarded. Copy sent to Ben Finney <bignose@debian.org>. (Fri, 01 Jun 2018 04:48:04 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Alexandre Viau <aviau@debian.org>
To: submit@bugs.debian.org
Subject: dput: display the body of http errors responses
Date: Fri, 1 Jun 2018 00:45:10 -0400
[Message part 1 (text/plain, inline)]
Package: dput
Severity: wishlist

Hello,

I am building a service that accepts uploads via dput.

My service does a number of checks when it receives uploads.

For example, it only accepts source uploads.

If you upload a .deb, my service returns a 400 error with a message:
 - "Only source uploads are accepted"

Or:
 - "this file was signed with an unrecognized key"

Etc...

I would love it if these messages made it to the user!

Cheers,

-- 
Alexandre Viau
aviau@debian.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#900545; Package dput. (Fri, 01 Jun 2018 06:33:03 GMT) (full text, mbox, link).


Acknowledgement sent to Ben Finney <bignose@debian.org>:
Extra info received and forwarded to list. (Fri, 01 Jun 2018 06:33:03 GMT) (full text, mbox, link).


Message #10 received at 900545@bugs.debian.org (full text, mbox, reply):

From: Ben Finney <bignose@debian.org>
To: Alexandre Viau <aviau@debian.org>, 900545@bugs.debian.org
Subject: Re: Bug#900545: dput: display the body of http errors responses
Date: Fri, 1 Jun 2018 16:29:20 +1000
[Message part 1 (text/plain, inline)]
On 01-Jun-2018, Alexandre Viau wrote:

> I am building a service that accepts uploads via dput.

Thank you for working on this service.

I assume this is a service that emulates the Debian archive queue
server?

> My service does a number of checks when it receives uploads.
> For example, it only accepts source uploads.

This is an interesting idea, and I hope you are (working toward)
proposing it as improvements to the official Debian servers.

> If you upload a .deb, my service returns a 400 error with a message:
>  - "Only source uploads are accepted"
> Or:
>  - "this file was signed with an unrecognized key"
> Etc...

Because the server API is via HTTP, you have the full range of
HTTP status responses, standardised in the protocol. See
<URL:http://en.wikipedia.org/wiki/List_of_HTTP_status_codes>
(more fun at <URL:https://httpstatusdogs.com/510-not-extended>, where
you can see the standard meaning of each code by following the link
from the status code).

> I would love it if these messages made it to the user!

Because DPut is primarily intended as a client to the Debian archive
upload queue, I think it should not have special treatment for other
servers.

If the Debian upload queue is not sending those messages, I think it's
too soon to be making code branches in DPut to handle those. There is
enough poorly-specified behaviour already handled in DPut, we don't
need to add code paths for features that are not yet exhibited by
Debian :-)

Rather, these checks and specific HTTP responses are good to propose
as (one or more) improvements for the official Debian upload queue
server software. I look forward to seeing that progress!

-- 
 \        “Humanity has advanced, when it has advanced, not because it |
  `\     has been sober, responsible, and cautious, but because it has |
_o__)            been playful, rebellious, and immature.” —Tom Robbins |
Ben Finney <ben@benfinney.id.au>
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Ben Finney <bignose@debian.org>:
Bug#900545; Package dput. (Fri, 01 Jun 2018 15:54:03 GMT) (full text, mbox, link).


Acknowledgement sent to Alexandre Viau <aviau@debian.org>:
Extra info received and forwarded to list. Copy sent to Ben Finney <bignose@debian.org>. (Fri, 01 Jun 2018 15:54:03 GMT) (full text, mbox, link).


Message #15 received at 900545@bugs.debian.org (full text, mbox, reply):

From: Alexandre Viau <aviau@debian.org>
To: Ben Finney <bignose@debian.org>, 900545@bugs.debian.org
Subject: Re: Bug#900545: dput: display the body of http errors responses
Date: Fri, 1 Jun 2018 11:51:31 -0400
[Message part 1 (text/plain, inline)]
On 2018-06-01 02:29 AM, Ben Finney wrote:
>
> I assume this is a service that emulates the Debian archive queue
> server?

Yes, kind of. I am building autodeb as part of Google Summer of Code:
 - https://auto.debian.net/

> If the Debian upload queue is not sending those messages, I think it's
> too soon to be making code branches in DPut to handle those. There is
> enough poorly-specified behaviour already handled in DPut, we don't
> need to add code paths for features that are not yet exhibited by
> Debian :-)

The Debian queues do not even accept http uploads but this feature is
still present in dput.

Other services like mentors.debian.net accept http uploads.

> Rather, these checks and specific HTTP responses are good to propose
> as (one or more) improvements for the official Debian upload queue
> server software.

There are more chances of this happening if we introduce it gradually in
other services used by the community and if our tools support it.

Would you also be against supporting this if it was specified in a
command-line flag?

-- 
Alexandre Viau
aviau@debian.org


[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Ben Finney <bignose@debian.org>:
Bug#900545; Package dput. (Fri, 01 Jun 2018 16:09:05 GMT) (full text, mbox, link).


Acknowledgement sent to Alexandre Viau <aviau@debian.org>:
Extra info received and forwarded to list. Copy sent to Ben Finney <bignose@debian.org>. (Fri, 01 Jun 2018 16:09:05 GMT) (full text, mbox, link).


Message #20 received at 900545@bugs.debian.org (full text, mbox, reply):

From: Alexandre Viau <aviau@debian.org>
To: Ben Finney <bignose@debian.org>, 900545@bugs.debian.org
Subject: Re: Bug#900545: dput: display the body of http errors responses
Date: Fri, 1 Jun 2018 12:06:51 -0400
[Message part 1 (text/plain, inline)]
This could be as simple as this:

---
 dput/methods/http.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dput/methods/http.py b/dput/methods/http.py
index 5bd0fe7..40acdc1 100644
--- a/dput/methods/http.py
+++ b/dput/methods/http.py
@@ -160,6 +160,11 @@ def upload(
             else:
                 sys.stdout.write(
                         "Upload failed: %d %s\n" % (res.status,
res.reason))
+            error_message = res.read()
+            if error_message != "":
+                sys.stdout.write(
+                    "http error message: %s\n" % error_message
+                )
             sys.exit(1)
         # must be done, but we're not interested
         res.read()
-- 
2.17.0


We can also only display the message in debug mode if you want.

-- 
Alexandre Viau
aviau@debian.org

[signature.asc (application/pgp-signature, attachment)]

Added tag(s) patch. Request was from Alexandre Viau <aviau@debian.org> to control@bugs.debian.org. (Fri, 01 Jun 2018 16:09:10 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#900545; Package dput. (Sat, 02 Jun 2018 02:54:02 GMT) (full text, mbox, link).


Acknowledgement sent to Ben Finney <bignose@debian.org>:
Extra info received and forwarded to list. (Sat, 02 Jun 2018 02:54:02 GMT) (full text, mbox, link).


Message #27 received at 900545@bugs.debian.org (full text, mbox, reply):

From: Ben Finney <bignose@debian.org>
To: Alexandre Viau <aviau@debian.org>, 900545@bugs.debian.org
Subject: Re: Bug#900545: dput: display the body of http errors responses
Date: Sat, 2 Jun 2018 12:50:14 +1000
[Message part 1 (text/plain, inline)]
On 01-Jun-2018, Alexandre Viau wrote:

> I am building autodeb as part of Google Summer of Code:
>  - https://auto.debian.net/

Oh, that's great!

> The Debian queues do not even accept http uploads but this feature
> is still present in dput.
> Other services like mentors.debian.net accept http uploads.

You're right. and I was thinking of the mentors.debian.net service.


On 01-Jun-2018, Alexandre Viau wrote:
> This could be as simple as this [emit the message when an HTTP
> request gets a failure response]:

That's a lot simpler than I thought. Thank you for the code, I see now
what you are asking for; it's a reasonable improvement that would not
add much complexity.

-- 
 \          “Better not take a dog on the space shuttle, because if he |
  `\   sticks his head out when you're coming home his face might burn |
_o__)                                                up.” —Jack Handey |
Ben Finney <bignose@debian.org>
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Ben Finney <bignose@debian.org>:
Bug#900545; Package dput. (Mon, 04 Jun 2018 23:18:02 GMT) (full text, mbox, link).


Acknowledgement sent to Alexandre Viau <aviau@debian.org>:
Extra info received and forwarded to list. Copy sent to Ben Finney <bignose@debian.org>. (Mon, 04 Jun 2018 23:18:02 GMT) (full text, mbox, link).


Message #32 received at 900545@bugs.debian.org (full text, mbox, reply):

From: Alexandre Viau <aviau@debian.org>
To: Ben Finney <bignose@debian.org>, 900545@bugs.debian.org
Subject: Re: Bug#900545: dput: display the body of http errors responses
Date: Mon, 4 Jun 2018 19:15:26 -0400
[Message part 1 (text/plain, inline)]
On 2018-06-01 10:50 PM, Ben Finney wrote:
> That's a lot simpler than I thought. Thank you for the code, I see now
> what you are asking for; it's a reasonable improvement that would not
> add much complexity.

Great :)

I would like to mention that it was merged in dput-ng:
 -
https://salsa.debian.org/debian/dput-ng/commit/810d6b3e3ccf0751cf529e1557bf74213e0dc41d

Cheers,

-- 
Alexandre Viau
aviau@debian.org


[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Ben Finney <bignose@debian.org>:
Bug#900545; Package dput. (Tue, 05 Jun 2018 15:54:04 GMT) (full text, mbox, link).


Acknowledgement sent to Alexandre Viau <aviau@debian.org>:
Extra info received and forwarded to list. Copy sent to Ben Finney <bignose@debian.org>. (Tue, 05 Jun 2018 15:54:04 GMT) (full text, mbox, link).


Message #37 received at 900545@bugs.debian.org (full text, mbox, reply):

From: Alexandre Viau <aviau@debian.org>
To: Ben Finney <bignose@debian.org>, 900545@bugs.debian.org
Subject: Re: Bug#900545: dput: display the body of http errors responses
Date: Tue, 5 Jun 2018 11:50:52 -0400
[Message part 1 (text/plain, inline)]
I have updated the code to display multi-lines error messages better.
And attached the patch to this email. (this was also merged in dput-ng).

Please consider applying this patch to dput.

Cheers,

-- 
Alexandre Viau
aviau@debian.org
[0001-methods-http-display-error-messages.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#900545; Package dput. (Sun, 10 Jun 2018 04:45:03 GMT) (full text, mbox, link).


Acknowledgement sent to Ben Finney <bignose@debian.org>:
Extra info received and forwarded to list. (Sun, 10 Jun 2018 04:45:03 GMT) (full text, mbox, link).


Message #42 received at 900545@bugs.debian.org (full text, mbox, reply):

From: Ben Finney <bignose@debian.org>
To: 900545@bugs.debian.org
Subject: Bug#900545: dput: Emit error response body as a debug message
Date: Sun, 10 Jun 2018 14:41:59 +1000
[Message part 1 (text/plain, inline)]
Control: retitle -1 dput: Emit the response body as a debug message, when HTTP error response

Howdy,

I have an implementation of this feature, that is awaiting review at
<URL:https://salsa.debian.org/debian/dput/merge_requests/1>.

-- 
 \      “Natural catastrophes are rare, but they come often enough. We |
  `\   need not force the hand of nature.” —Carl Sagan, _Cosmos_, 1980 |
_o__)                                                                  |
Ben Finney <bignose@debian.org>
[signature.asc (application/pgp-signature, inline)]

Changed Bug title to 'dput: Emit the response body as a debug message, when HTTP error response' from 'dput: display the body of http errors responses'. Request was from Ben Finney <bignose@debian.org> to 900545-submit@bugs.debian.org. (Sun, 10 Jun 2018 04:45:03 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Ben Finney <bignose@debian.org>:
Bug#900545; Package dput. (Sun, 10 Jun 2018 21:06:02 GMT) (full text, mbox, link).


Acknowledgement sent to Alexandre Viau <aviau@debian.org>:
Extra info received and forwarded to list. Copy sent to Ben Finney <bignose@debian.org>. (Sun, 10 Jun 2018 21:06:02 GMT) (full text, mbox, link).


Message #49 received at 900545@bugs.debian.org (full text, mbox, reply):

From: Alexandre Viau <aviau@debian.org>
To: Ben Finney <bignose@debian.org>
Cc: 900545@bugs.debian.org
Subject: Re: Bug#900545: dput: Emit error response body as a debug message
Date: Sun, 10 Jun 2018 17:02:08 -0400
[Message part 1 (text/plain, inline)]
On Sun, 10 Jun 2018 14:41:59 +1000 Ben Finney <bignose@debian.org> wrote:
> I have an implementation of this feature, that is awaiting review at
> <URL:https://salsa.debian.org/debian/dput/merge_requests/1>.

Thank you for your work!

I have tested and reviewed your merge request[1].

1. https://salsa.debian.org/debian/dput/merge_requests/1#note_28311

Cheers,

-- 
Alexandre Viau
aviau@debian.org

[signature.asc (application/pgp-signature, attachment)]

Reply sent to Ben Finney <bignose@debian.org>:
You have taken responsibility. (Wed, 06 Jan 2021 09:54:06 GMT) (full text, mbox, link).


Notification sent to Alexandre Viau <aviau@debian.org>:
Bug acknowledged by developer. (Wed, 06 Jan 2021 09:54:06 GMT) (full text, mbox, link).


Message #54 received at 900545-close@bugs.debian.org (full text, mbox, reply):

From: Debian FTP Masters <ftpmaster@ftp-master.debian.org>
To: 900545-close@bugs.debian.org
Subject: Bug#900545: fixed in dput 1.1.0
Date: Wed, 06 Jan 2021 09:50:14 +0000
Source: dput
Source-Version: 1.1.0
Done: Ben Finney <bignose@debian.org>

We believe that the bug you reported is fixed in the latest version of
dput, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 900545@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Ben Finney <bignose@debian.org> (supplier of updated dput package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Wed, 06 Jan 2021 20:25:16 +1100
Source: dput
Architecture: source
Version: 1.1.0
Distribution: unstable
Urgency: medium
Maintainer: Ben Finney <bignose@debian.org>
Changed-By: Ben Finney <bignose@debian.org>
Closes: 900545 913865 921662 974447
Changes:
 dput (1.1.0) unstable; urgency=medium
 .
   * The “Abinta Kabir” release.
   * Correct processing of config file for ‘dh_bash-completion’.
     Closes: bug#921662. Thanks to Antoine Beaupre for the report.
   * Correct URL to documentation in security warning.
     Closes: bug#913865. Thanks to Dima Kogan for the report.
   * Consistent ‘dput’ command-line parsing regardless of ‘--check-only’.
   * Farewell to transition handling of obsolete ‘gluck_delayed’ host.
     The DELAYED queue has been on ‘ftp.upload.debian.org’ since 2009.
   * Rename default Git branch in official repository, to ‘main’.
   * Remove redundant dependency on ‘debhelper’.
     The ‘debhelper-compat’ dependency brings the correct packages.
   * Declare conformance to “Standards-Version: 4.5.1”.
   * Declare Debhelper compatibility level 13.
   * Specify the package build system does not require root privilege.
   * Replace dependency on HTTPretty with custom Python mock code.
   * Mark as “superficial” those autopkgtest cases with no coverage.
     Closes: bug#974447. Thanks to Sudip Mukherjee for the report.
   * Emit the response body as a debug message, when HTTP error response.
     Closes: bug#900545. Thanks to Alexandre Viau for the report.
   * Update publication years in copyright notices.
Checksums-Sha1:
 9eb40e50dfab56784690c31f12ea1f771ba11a28 1712 dput_1.1.0.dsc
 f6434ff9a832b33e7896769b8281db6378a6224d 104744 dput_1.1.0.tar.xz
 3518a7c903c49d15f65597766e6dcb3989ce4753 7534 dput_1.1.0_amd64.buildinfo
Checksums-Sha256:
 95f8d92402459ec51c7e36f12c9fabf1c156ac144e2d246150b910e61e880ecd 1712 dput_1.1.0.dsc
 1db59608e2895e3066ef7d4d0f60da0180cd6f4238ae6368b74b2ecce9e7207d 104744 dput_1.1.0.tar.xz
 f47450d737430b0818e8fb8274a0b5277ef75fe5695c03c38367b009e51d130c 7534 dput_1.1.0_amd64.buildinfo
Files:
 44e399556823f21626cdf2c7689bad5d 1712 devel optional dput_1.1.0.dsc
 96f1064344ac6fbd3cfc24811dc24c0a 104744 devel optional dput_1.1.0.tar.xz
 20e0334b6815a0fc56546f723d6e97b5 7534 devel optional dput_1.1.0_amd64.buildinfo

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

iQIzBAEBCAAdFiEEdN8hqSSdpNPGgGg3kgn6QYDP/G8FAl/1gzAACgkQkgn6QYDP
/G9L1hAAmi6VePbkFYxXJ7MMJI4pqIzShWSQcr61dBNaYxxehHuXliHTgiX6vAwJ
v94ZqSdoEGS7GTijcihjVzAcZ6mbXXx3pmMma/dN3WTiyfzz3B+k2XioR9Jq1liy
zsrqrq7TKxmORgyNT+JZVqcUt9i594xqXyWZ7lUPGH8u5GaSv8pi4yEbEOJizOms
NUr0uYNRCnkf1VViJ4mfEl3hYI/hTO0yAGmxgbJhOIbLNGDp7nPRUpJp8Ty74ykn
vDZL5aWnc9fal3Q3oZip/wFlh2DymjHGkjlKoTEpo6NOdJ1iF3fukynI0QC654Aj
uxKyg3Nyc5+O0bcN39342ErBPsXNsfsBQn3TnQz9O4FGTd2wM19OZ0CTef69/i8V
A8HA0zomNvZEhOuVGdABMq0BESYHQOqU5VoPW91syUEcdx0oNURGre9nQ1bHL9SG
WBi2WYWg3gY7TI3qHkAZvU0aaTr5EuAtTW9Xge3E0EBVWM5BB8u8dNNzICZIObVP
j9Voz1E//Vhp3O3CHPm2odc0LvwTW7SNoJyu71Ve0u0Uo6NxH7JXT/+QogWXTgbc
BFs59QX+CtufYOGUDUgekvz4Aw1iFX/IKs85iAB0wxHIRII4gAS6OTr8DBvestgz
NMsdjlsd/vHRutijiEiKy9v0+Rsy6K9tM8lA/NfvxOUs8Imd1ZQ=
=WCs9
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Thu, 04 Feb 2021 07:28:08 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Tue Sep 20 18:32:23 2022; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.