a possible way to croak() in spyc

This commit is contained in:
psyc://psyced.org/~lynX 2009-12-28 04:19:44 +01:00
parent 7bc16a510f
commit 00713a840e
3 changed files with 41 additions and 27 deletions

View File

@ -4,6 +4,12 @@ vim:nosmarttab:syntax=diff
| Essentially: whenever you fix something, move that line to the end of file. | Essentially: whenever you fix something, move that line to the end of file.
| - marks bugs & fixes, + marks new features, ? marks issues, * marks big stuff | - marks bugs & fixes, + marks new features, ? marks issues, * marks big stuff
________________________________________________________________________ ________________________________________________________________________
== SERIOUS!!! ==========================================================
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- large submissions into scratchpad can crash the driver
- configure script fails on libidn now being in glibc
________________________________________________________________________
== NEXT RELEASE ======================================================== == NEXT RELEASE ========================================================
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- interserver xmpp /me expects no leading newline, but pidgin recently - interserver xmpp /me expects no leading newline, but pidgin recently
@ -1079,6 +1085,9 @@ cel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error><
________________________________________________________________________ ________________________________________________________________________
== RELEASE INSTALLER =================================================== == RELEASE INSTALLER ===================================================
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
+ the psyced script could check if psyced.ini has been changed recently
and autorun psyconf? or maybe just spit out a warning..
- _charset_console can still lead to unexpected convert_charset errors when - _charset_console can still lead to unexpected convert_charset errors when
outputting random data. convert_charset must be non-fatal here! outputting random data. convert_charset must be non-fatal here!

View File

@ -25,7 +25,7 @@ volatile string netloc;
// this is completely anti-psyc. it should take mcs as arguments // this is completely anti-psyc. it should take mcs as arguments
// and look up the actual message from textdb.. FIXME // and look up the actual message from textdb.. FIXME
#define CIRCUITERROR(reason) { debug_message("SPYC CIRCUIT: " reason "\n"); \ #define CIRCUITERROR(reason) { \
croak("_error_circuit", "circuit error: " \ croak("_error_circuit", "circuit error: " \
reason); \ reason); \
return 0; \ return 0; \
@ -55,9 +55,12 @@ void feed(string data) {
// yes, this is a funny implementation of croak // yes, this is a funny implementation of croak
// it does not use msg(). Yes, that is intended // it does not use msg(). Yes, that is intended
varargs mixed croak(string mc, string data, vamapping vars, vamixed source) { varargs mixed croak(string mc, string data, vamapping vars, vamixed source) {
PT(("croak(%O) in %O (%O)\n", mc, ME, query_ip_name()))
unless (data) data = T(mc, "");
binary_message(sprintf("\n%s\n%s\n|\n", mc, data)); binary_message(sprintf("\n%s\n%s\n|\n", mc, data));
remove_interactive(ME); // right behaviour for all croaks!?
destruct(ME); remove_interactive(ME);
// destruct(ME);
return 0; return 0;
} }

View File

@ -15,21 +15,21 @@ int may_parse_more;
array(mixed) tvars; array(mixed) tvars;
mapping hvars; mapping hvars;
// this is completely anti-psyc. it should take mcs as arguments // being faded out in favor of regular croak()
// and look up the actual message from textdb.. FIXME #define PARSEERROR(reason) { \
#define PARSEERROR(reason) { debug_message("PSYC PARSE ERROR: " reason "\n"); \ croak("_error_syntax_broken", \
croak("_error_syntax_broken", "Failed parsing: " \ "Failed parsing: " reason); \
reason); \ return 0; }
return 0; \
}
#define DELIM S_GLYPH_PACKET_DELIMITER "\n" #define DELIM S_GLYPH_PACKET_DELIMITER "\n"
#define C_LINEFEED '\n' #define C_LINEFEED '\n'
#define MVAR_GLYPH 0 #define MVAR_GLYPH 0
#define MVAR_STATE 1 #define MVAR_STATE 1
#define MVAR_VALUE 2 #define MVAR_VALUE 2
#ifndef PSYC_UDP
# define QUIT remove_interactive(ME); return 0;
#endif
step(); // prototype step(); // prototype
@ -76,9 +76,7 @@ void feed(string data) {
// overload this as needed // overload this as needed
varargs mixed croak(string mc, string data, vamapping vars, vamixed source) { varargs mixed croak(string mc, string data, vamapping vars) { return 0; }
return 0;
}
// called when a complete packet has arrived // called when a complete packet has arrived
@ -101,16 +99,18 @@ mapping process_header(mixed varops) {
case C_GLYPH_MODIFIER_DIMINISH: case C_GLYPH_MODIFIER_DIMINISH:
case C_GLYPH_MODIFIER_QUERY: case C_GLYPH_MODIFIER_QUERY:
case C_GLYPH_MODIFIER_ASSIGN: case C_GLYPH_MODIFIER_ASSIGN:
PARSEERROR("header modifier with glyph other than ':', this is not implemented") croak("_failure_unavailable_state");
break; QUIT
default: default:
PARSEERROR("header modifier with unknown glyph") croak("_failure_unknown_glyph");
break; QUIT
} }
// FIXME: not every legal varname is a mmp varname // FIXME: not every legal varname is a routing varname
// look at shared_memory("routing") // look at shared_memory("routing")
if (!legal_keyword(vname) || abbrev("_INTERNAL", vname)) { if (!legal_keyword(vname) || abbrev("_INTERNAL", vname)) {
PARSEERROR("illegal varname in header") croak("_error_illegal_protocol_variable", 0,
([ "_variable_name": vname ]));
return 0;
} }
} }
return vars; return vars;
@ -158,7 +158,8 @@ void parse_header() {
buffer = buffer[1..]; buffer = buffer[1..];
break; break;
default: default:
PARSEERROR("noglyph") croak("_error_syntax_expected_routing");
QUIT
} }
fit = sscanf(buffer, "%.1s%t", vname); fit = sscanf(buffer, "%.1s%t", vname);
if (fit != 1) { if (fit != 1) {
@ -222,6 +223,7 @@ void parse_psyc() {
PARSEERROR("negative binary length") PARSEERROR("negative binary length")
} }
if (strlen(body_buffer) < len) { if (strlen(body_buffer) < len) {
// ouch, this is a problem here
PARSEERROR("not enough to read binary arg, may not happen") PARSEERROR("not enough to read binary arg, may not happen")
} }
vvalue = body_buffer[..len-1]; vvalue = body_buffer[..len-1];
@ -290,9 +292,9 @@ void parse_content() {
} }
fit = sscanf(body_buffer, "%.1s\n%.0s", method, body_buffer); fit = sscanf(body_buffer, "%.1s\n%.0s", method, body_buffer);
if (fit != 2 || !legal_keyword(method)) { if (fit != 2 || !legal_keyword(method)) {
croak("_error_illegal_method", croak("_error_illegal_method");
"That's not a valid method name."); // "That's not a valid method name.");
return; // NOTREACHED return;
} }
// mhmm... why does body_buffer still contain the newline? // mhmm... why does body_buffer still contain the newline?
@ -359,8 +361,8 @@ void step() {
first_response(); first_response();
step(); step();
} else { } else {
croak("_error_syntax_initialization", croak("_error_syntax_initialization");
"The new protocol begins with a pipe and a line feed."); // "The new protocol begins with a pipe and a line feed.");
} }
break; break;
default: // uhm... if we ever get here this is the programmers fault default: // uhm... if we ever get here this is the programmers fault