darcs

Issue 1275 roundup: Python backtraces return HTTP 200

Title roundup: Python backtraces return HTTP 200
Priority bug Status resolved
Milestone Resolved in
Superseder Nosy List Serware, darcs-devel, dmitry.kurochkin, kowey, thorkilnaur, twb
Assigned To
Topics BugTracker

Created on 2008-12-22.01:01:04 by twb, last changed 2009-10-23.23:28:00 by admin.

Messages
msg6859 (view) Author: twb Date: 2008-12-22.01:00:59
[Just skip to the last paragraph for the actual error.]

I have a script to modify roundup bugs by sending email formatted in
the way Roundup's mail gateway expects.  It performs basic input
validation before sending the email, because waiting for roundup to
reply with an error message (via email) is tedious.

For example, it validates status and priority changes:

  $ ru status 1203 wontfix
  Unrecognized status `wontfix'.
  Valid choices are: unread deferred chatting need-info in-progress testing
  resolved-in-unstable resolved wont-fix resolved-in-stable duplicate
  presumed-dead need-volunteer

I want to add validation of ticket numbers, so for example

  $ ru status 9999 wont-fix
  Unrecognized bug `9999'.
  Valid choices are 1 through 1287, inclusive.

The approach I take for status values is to HTTP GET the whole table,
but this is undesirable for the issue list because there are literally
thousands of issues, so it will burden the network unnecessarily.

  $ curl -sL 'http://bugs.darcs.net/issue?@action=export_csv&@columns=id' | wc -c
  6529
  $ curl -sL 'http://bugs.darcs.net/status?@action=export_csv&@columns=name' | wc -c
  172

I thought that a better way to do this was to just check the HTTP
status of doing a HTTP HEAD request on the appropriate URL:

  $ curl -sLI http://bugs.darcs.net/issue1 |
    head -1 | grep -q '200 OK'; echo $?
  0

But this always succeeds -- even when the server crashes!

  $ curl -sLI http://bugs.darcs.net/issue9999 |
    head -1 | grep -q '200 OK'; echo $?
  0

  $ w3m -dump http://bugs.darcs.net/issue9999 | head -1
  Mod_python error: "PythonHandler roundup.cgi.apache"

If this returned a more appropriate code (e.g. 500, internal server
error), I could use HEAD in this way.  Instead, I will have to GET a
full page, and parse it.

http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
msg6976 (view) Author: thorkilnaur Date: 2009-01-05.13:56:07
Hello Trent,

I am probably just slow, but I do not understand this fully: One question I have 
is: Whose bug is it? Is it in Roundup, Python, or somewhere else?

In any case, I'll leave the issue in "chatting" for now, for clarification, the 
priority (optimistically, perhaps) as "wishlist".

Thanks and best regards
Thorkil
msg6993 (view) Author: twb Date: 2009-01-06.00:20:46
On Mon, Jan 05, 2009 at 01:56:13PM -0000, Thorkil Naur wrote:
> Whose bug is it? Is it in Roundup, Python, or somewhere else?

I'm assuming roundup is integrated into apache somehow.  If mod_python
is used, I blame that.  If mod_proxy is used, I blame roundup's built-
in web server.  These are just guesses.

It may be that this is a known bug that has been fixed since Debian
4.0 was released; I haven't checked.
msg8330 (view) Author: kowey Date: 2009-08-22.00:05:16
Since our Lenny upgrade and move to the corresponding roundup version (and with
us copying over the generic_404 page which we may consider customising to
taste), I now get:

% curl -sLI http://bugs.darcs.net/issue9999
HTTP/1.1 404 Not Found

I presume this means this is fixed?
msg8371 (view) Author: twb Date: 2009-08-23.06:56:01
On Sat, Aug 22, 2009 at 12:05:19AM +0000, Eric Kow wrote:
> % curl -sLI http://bugs.darcs.net/issue9999
> HTTP/1.1 404 Not Found
>
> I presume this means this is fixed?

Correct; this bug is now gone.  And ru 0.1.3 relies on it:

--- ru     2009-08-23 16:52:28.211286627 +1000
+++ ru     2009-08-23 16:52:28.651287107 +1000
@@ -131,12 +131,9 @@ valid () {                      # TYPE V
                 echo >&2 "Invalid $1 \`$2'.  I expected a natural number."
                 exit 1
             fi
-            # FIXME: this is too slow on e.g. bugs.python.org.
-            xs=$(get_column $1 id)
-            if ! fgrep -xq "$2" <<<"$xs"
+            if ! curl -fsI -o/dev/null "$RU_BASE/issue$2"
             then
-                printf >&2 "Invalid $1 \`$2'.  "
-                echo   >&2 "The last $1 is $(tail -1 <<<"$xs")."
+                echo >&2 "Invalid $1 \`$2'.  "
                 exit 1
             fi
             ;;
History
Date User Action Args
2008-12-22 01:01:04twbcreate
2009-01-05 13:56:13thorkilnaursetpriority: wishlist
nosy: + Serware
topic: + BugTracker
status: unread -> unknown
messages: + msg6976
2009-01-06 00:20:49twbsetnosy: + serware
messages: + msg6993
2009-08-22 00:05:19koweysetpriority: wishlist -> bug
status: unknown -> resolved
messages: + msg8330
nosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin, serware, Serware
2009-08-23 06:56:04twbsetnosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin, serware, Serware
messages: + msg8371
2009-08-25 17:36:35adminsetnosy: + darcs-devel, - simon
2009-08-27 14:30:00adminsetnosy: kowey, darcs-devel, twb, thorkilnaur, dmitry.kurochkin, serware, Serware
2009-10-23 22:45:37adminsetnosy: - Serware
2009-10-23 23:28:00adminsetnosy: + Serware, - serware