Re: CHICKEN meeting in June
Hi, I have updated the wiki page for the event at http://wiki.call-cc.org/event/village-chickens-2023 with some info regarding location and travel. Please contact me if you have any questions or need assistance. See you in June! I've just seen this. Is it too late to sign up? The wiki page says "January (latest)". Who else is currently intending to come? ...and are Significant Others welcome? Many of us are getting on a bit since our last Chicken meetup and it might be nice to be able to do some family stuff as well. Best wishes, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF
Re: [Question] Is Chicken Scheme able to create shared/dynamic libraries (.so's or .dll's)?
Hi, I'm not a Chicken programmer yet but I'm interested very much in this language. I could see that in the installation of Eggs, a .o object file is created. So that, I have a question: Is Chicken Scheme able create shared/dynamic libraries a C/C++ does? Yes: eggs are also built as .so files. They can be dynamically loaded (dlopen) into a Chicken process. If you want to call them from C/C++ code then there is more to do but it is possible. Best wishes, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF
Re: Bintracker: A modern chiptune editor
Hi, I've released the source code for Bintracker, a powerful, hackable "chiptune audio workstation" written in Chicken Scheme. The project is work-in-progress, and is currently in an early alpha stage. Basic features work and the editor is usable, though not necessarily useful ;) I'm publishing the source now in order to receive some feedback from early adopters, and maybe also find some new contributors along the way. More info on the project site: https://bintracker.org The source is available at https://github.com/bintracker/bintracker . Wow! Neat project. I love the GUI. I've had a (very) quick look at the code. It looks like bt-gui and bt-gui-lolevel are the core of the UI engine and there's a binding to tk? Could you talk more about the architecture of the UI? The screenshots look great and I've not seen many UI heavy Chicken programs yet. This could be a winner! Is the UI toolkit reusable? Best wishes, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF
Re: [Chicken-users] [ANN] test-new-egg 1.0.0 released
Hi Mario, test-new-egg is a simple commmand line tool to test new CHICKEN eggs before they are added to the official repository of eggs. For more information, see [1]. The new release adds support for CHICKEN 5. See [2] for the release notes of this version. Note that the same changes apply to test-new-egg for CHICKEN 4 too (see [3]). Great work! By the way, please test your eggs with this tool before submitting them for inclusion in the official repository of eggs. Does this replace, extend or compliment `salmonella --this-egg`? Best wishes, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Gnuplot pipe
Hi Francesco, I put together a simple interface to Gnuplot, basically popen() with a couple of procedures to plot lists. The motivation is mainly to draw exploratory plots from the interpreter. If you think this may be useful as an egg I'm happy to add wiki documentation. Comments welcome. This is great! I installed it and worked through the examples in the README. I've been thinking for a while about how I might easily draw charts with CHICKEN and this seems to be it. I think it would be worthwhile to get it into the coop as an egg. When working through the examples, I got this error after trying `(gp:send "set terminal wxt nopersist")`. I have Debian Jessie's (8.11) gnuplot (4.6.6-2+deb8u1). - gnuplot> set terminal wxt nopersist ^ line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list - Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] [ANN] rest-bind egg ported to CHICKEN 5
Hi Chickens! The rest-bind egg for generating wrappers to REST-like HTTP APIS is now available for CHICKEN 5. https://api.call-cc.org/5/doc/rest-bind You should be able to install version 0.6 with `chicken-install rest-bind`. Thanks to Kooda for the patches! The CHICKEN 4 version remains available. Regards, @ndy @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] [ANN] multipart-form-data egg ported to CHICKEN 5
Hi Chickens! The multipart-form-data egg for reading and decoding HTTP multipart/form-data requests is now available for CHICKEN 5. https://api.call-cc.org/5/doc/multipart-form-data You should be able to install version 0.2 with `chicken-install multipart-form-data`. Thanks to David Ireland for the patches! The CHICKEN 4 version remains available. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] [ANN] New waffle Egg
Hi Chickens! I'm pleased to announce the first release of my waffle egg! waffle is a toolkit for building HTML and other XML based pages through composition of discrete, user definable, widgets. Widgets comprise markup specified in SXML as well as a set of attributes which are rendered into the widget. waffle handles the composition of multiple widgets of the same type containing HTML Form elements. You can install it immediately with `chicken-install waffle` (although I've not yet done a CHICKEN 5 port) and some initial documentation is on the wiki at http://wiki.call-cc.org/eggref/4/waffle As some of you know, I've been sitting on this egg for Some Time. I'd like to thank both Arthur Maciel and Simon Worthington for their generous contributions and encouragement. I've deployed this code in production at Knodium and at https://registers.app/ You can find a talk I did about how we used it at Knodium here https://media.ccc.de/v/c116_lisp_-_2013-08-25_11:15_-_building_knodium_com_with_scheme_-_andy_bennett_-_1281#video The microphone sound starts properly a few minutes in! This first part of the talk shows you the site and webapp we generated with waffle and then I get into some examples and code. As well as the websites, I've also used it for generating both the text and HTML parts for eMails from the same waffle message template and a complementary pair of widget sets. If anyone tries it out for themselves, please do get in touch if anything isn't clear or you need any assitance at all. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Nuremberg Meetup
Hi Christian! Thanks so much for organising the Nuremberg Meetup at the weekend. It was thoroughly enjoyable and great fun to meet everyone again. Thanks also to everyone who attended for making it such a good couple of days. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [SECURITY] spiffy-cgi-handlers and http-client updated to prevent "httpoxy" attack
Hi Peter! Thanks for all your work on this! > A vulnerability called "httpoxy" has been announced, which affects a > lot of software (server _and_ client) which speaks the HTTP protocol, > allowing a man in the middle attack to be made on servers. The > spiffy-cgi-handlers and http-client eggs are also affected. > > In short, the CGI specification defines that all HTTP headers should be > converted to environment variables, after uppercasing them and prefixing > them with "HTTP_". Unfortunately, this allows an attacker to pass a > (nonexistent) "Proxy:" header, which will then be converted to > "HTTP_PROXY", which happens to be an environment variable which most > HTTP client programs and libraries support as a way of telling them to > route all requests through a proxy. See https://httpoxy.org for more > information about this attack. > > The http-client egg is vulnerable to such an attack with the default > value of "determine-proxy" (which is "determine-proxy-from-environment"), > if it is used in a CGI program. This situation only occurs if this > process is invoked by a HTTP server which converts the Proxy header as a > HTTP_PROXY environment variable. The spiffy-cgi-handlers egg will do > that in the default setup. > > If your CGI scripts are not using http-client, they may still be > vulnerable depending on which HTTP client library or application > you are using. > > These bugs have been fixed in http-client 0.10 and > spiffy-cgi-handlers 0.5, so please update at your earliest convenience. > > > If you are unable to update, both eggs provide sufficient hooks to fix > this in user code, without patching the eggs: > > In spiffy-cgi-handlers, you can add ("HTTP_PROXY" . #f) to the > cgi-default-environment parameter: > > (cgi-default-environment >(cons '("HTTP_PROXY" . #f) (cgi-default-environment))) > > This has precedence over the dynamically determined environment list > which converts the "Proxy" header to "HTTP_PROXY". > > In http-client, you can disable or override the determine-proxy parameter > with a custom procedure: > > (use data-structures) > (determine-proxy (constantly #f)) > > The updated versions of spiffy-cgi-handlers and http-client should be > available shortly. > > Kind regards, > Peter Bex > > > > ___ > Chicken-users mailing list > Chicken-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/chicken-users > Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF signature.asc Description: OpenPGP digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Asynchronous I/O Egg Release
Hi, > And of course, reads of files on the file > system never block at all A read from a file can block when the operating system needs to go to disk for the data. This happens when the buffer empties and it cannot be refilled before the next read call. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Variable Capture in message-digest
On 26/04/16 09:40, Peter Bex wrote: > On Tue, Apr 26, 2016 at 09:26:55AM +0100, Andy Bennett wrote: >> Thanks Peter! >> >> That is rather confusing: I thought each module imported its own >> identifiers and had its own namespace. > > It does, but the identifiers which you import are simply aliases > for the same thing, so if you set! one, you set! all of them. > > It may make more sense if you remember that modules disappear when > compiling; the identifiers all get replaced by their canonical name, > so if you (import (rename foo (bar my-weirdly-renamed-bar))) > it rewrites all my-weirdly-renamed-bar to foo#bar. > > Thus, (set! my-weirdly-renamed-bar 42) is equivalent to (set! foo#bar 42) > >> As string->blob is part of "library" I'm not importing it from anywhere >> so how would I "except" it? > > It's in the "chicken" module, so (import (except chicken string->blob)) > should do the trick. Library is just the unit that defines this module's > identifiers. Yeah, this is confusing, and weird. Hopefully we'll fix > this situation with CHICKEN 5, where we'll define the modules more > explicitly, and probably restructure the manual to match. I see. My model was that when you imported a module it did something like (set! bar foo#bar) rather than polluting the top level by conflating bar and foo#bar. Instead, it seems that if a module exports an identifier and uses that identifier internally it is possible for the user of the module to interfere with it. I guess that's entirely reasonable given the "procedures as first class values" thing: I'd totally expect the behaviour that you describe if the identifier referred to any other value than a procedure. Thanks again! Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF signature.asc Description: OpenPGP digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Variable Capture in message-digest
Hi, > It's in the "chicken" module, so (import (except chicken string->blob)) > should do the trick. Library is just the unit that defines this module's > identifiers. Yeah, this is confusing, and weird. Hopefully we'll fix > this situation with CHICKEN 5, where we'll define the modules more > explicitly, and probably restructure the manual to match. It doesn't seem possible to not import string->blob anywhere other than a module: - $ csi -n CHICKEN (c) 2008-2014, The Chicken Team (c) 2000-2007, Felix L. Winkelmann Version 4.9.0rc1 (rev 3cf1967) linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ] compiled 2014-04-17 on hd-t1179cl (Linux) #;1> (import (except chicken string->blob)) ; loading /usr/local/chicken-4.9.0/lib/chicken/7/chicken.import.so ... #;2> string->blob #blob s1507)> #;3> - Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF signature.asc Description: OpenPGP digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Variable Capture in message-digest
Hi, >> Here is my minimal test case: >> >> - >> (use message-digest sha2) >> >> (define (string->blob string) >> (abort "no way")) >> >> (define digest (initialize-message-digest (sha256-primitive))) >> >> (assert (message-digest? digest)) >> >> (message-digest-update-object digest "x") >> (pp (finalize-message-digest digest 'blob)) >> - >> >> This aborts with "no way" during the call to message-digest-update-object. >> >> >> message-digest is expecting to get string->blob from the library >> (http://api.call-cc.org/doc/library/string-%3Eblob ) but I'm reusing >> that name in my program for something else. >> >> Even tho' I define my string->blob after I (use message-digest), it >> seems to affect the binding in the message-digest code. >> >> Is this expected behaviour? > > Yes, in some cases we even do this intentionally: this is basically > performing a set! on an imported identifier, nothing special. > > To avoid this, simply rename, prefix or omit ("except") the string->blob > identifier as you import it. The compiler should give you a warning when > you do this, but it only does that when the code is in a module. Try > compiling the above program with -M, you'll see the warning (and an error > about not importing "extras" to get "pp"). Thanks Peter! That is rather confusing: I thought each module imported its own identifiers and had its own namespace. As string->blob is part of "library" I'm not importing it from anywhere so how would I "except" it? Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF signature.asc Description: OpenPGP digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Variable Capture in message-digest
Hi, I've been using the message-digest egg and have happened upon an unfortunate scenario. Here is my minimal test case: - (use message-digest sha2) (define (string->blob string) (abort "no way")) (define digest (initialize-message-digest (sha256-primitive))) (assert (message-digest? digest)) (message-digest-update-object digest "x") (pp (finalize-message-digest digest 'blob)) - This aborts with "no way" during the call to message-digest-update-object. message-digest is expecting to get string->blob from the library (http://api.call-cc.org/doc/library/string-%3Eblob ) but I'm reusing that name in my program for something else. Even tho' I define my string->blob after I (use message-digest), it seems to affect the binding in the message-digest code. Is this expected behaviour? I'm using CHICKEN 4.9.0rc1 and it happens in both interpreted and complied code. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Numbers weirdness
Hi, >> I'm mostly using log2 to work out if numbers are a power of two and find >> the highest bit that they have set. >> >> Is there a more robust way to do that in CHICKEN when using the numbers >> egg and bignums? > > It's probably better to do something like this: > > (= (arithmetic-shift 1 (sub1 (integer-length x))) x) Thanks for your help with this! I've had some time over the last couple of days to play some more and now it's working much better. > Maybe we should consider including "first-bit-set" or "logcount" from > SRFI-60, what do you think? These would allow us to avoid constructing > potential bignums just to check the lowest bit. I initially decided > against including SRFI-60 because it's such a huge grab-bag of > procedures without much of a design behind it, and the worst part is > that most of them have two names instead of one :( I'm not sure. We seem to have things like integer-length already. logcount sounds like a popcount implementation and I didn't find a use for it in this particular case. I agree that it's a big of a grab-bag. Thanks for your help. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF signature.asc Description: OpenPGP digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Numbers weirdness
Hi, >> Is it just late on a Friday? Am I crazy? > > Floating point numbers are weird enough to drive anyone bat shit: > > #;1> (use numbers) > #;2> (define (log2 n) (/ (log n) (log 2))) > #;3> (log2 (expt 2 251)) > 251.0 > #;4> (flonum-print-precision 100) > 15 > #;5> (log2 (expt 2 251)) > 251.028421709430404007434844970703125 Thanks Peter! I'm mostly using log2 to work out if numbers are a power of two and find the highest bit that they have set. Is there a more robust way to do that in CHICKEN when using the numbers egg and bignums? Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF signature.asc Description: OpenPGP digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Numbers weirdness
Hi, In CHICKEN 4.9.0rc1 and 4.10.0 both with numbers 4.6: - #;1> (use numbers) #;2> (define (log2 n) (/ (log n) (log 2))) #;3> (= (log2 (expt 2 252)) (ceiling (log2 (expt 2 252 #t #;4> (= (log2 (expt 2 251)) (ceiling (log2 (expt 2 251 #f #;5> (log2 (expt 2 251)) 251.0 #;6> (ceiling (log2 (expt 2 251))) 252.0 - Is it just late on a Friday? Am I crazy? Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] CHICKEN hang / crash / memoize egg
On 01/04/16 15:28, Andy Bennett wrote: > Hi Peeps! > > I'm running CHICKEN 4.9.0rc1 and I'm trying out the memoize egg. > > I saw the tail-call-optimized version of the factorial procedure in the > memoize documentation at http://api.call-cc.org/doc/memoize and I've > been trying to modify it so that it memoizes intermediate results such > that, for example, a call to (fact 10) makes a subsequent call to (fact > 9) fast. > > In doing so I've managed to get the interpreter into a loop or crash it > entirely. > > > When pasting this into a csi prompt: > > - > (use numbers) > (use memoize) > > (define (fact** x #!optional (self memo-fact**)) > (if (= x 0) > 1 > (* x (self (- x 1) > > (define memo-fact** (memoize fact**)) > > (define x (time (memo-fact** 35710))) > (define x (time (memo-fact** 35720))) > (define x (time (memo-fact** 35730))) > - > > I get: > > - > $ csi > > CHICKEN > (c) 2008-2014, The Chicken Team > (c) 2000-2007, Felix L. Winkelmann > Version 4.9.0rc1 (rev 3cf1967) > linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ] > compiled 2014-04-17 on hd-t1179cl (Linux) > > ; loading /home/local/andyjpb/.csirc ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/parley.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/chicken.import.so ... > ; loading > /usr/local/chicken-4.9.0/lib/chicken/7/data-structures.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/extras.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/ports.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/posix.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/srfi-1.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/srfi-13.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/srfi-18.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/stty.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/srfi-69.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/foreign.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/foreigners.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/parley.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/stty.so ... > #;1> (use numbers) > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/numbers.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/numbers.so ... > #;2> (use memoize) > #;2> > #;2> (define (fact** x #!optional (self memo-fact**)) > #;2> (if (= x 0) > #;2> 1 > #;2> (* x (self (- x 1) > #;2> > #;2> (define memo-fact** (memoize fact**)) > #;2> > #;2> (define x (time (memo-fact** 35710))) > #;2> (define x (time (memo-fact** 35720))) > #;2> (define x (time (memo-fact** 35730))) > #;2> > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/memoize.import.so ... > ; loading /usr/local/chicken-4.9.0/lib/chicken/7/memoize.so ... > > Note: the following toplevel variables are referenced but unbound: > > memo-fact** (in fact**) > 2.804s CPU time, 1.064s GC time (major), 81305 mutations, 21/1551 GCs > (major/minor) > 0s CPU time, 20 mutations > 0s CPU time, 20 mutations > #;8> > [panic] out of memory - heap full while resizing - execution terminated > > ...more... > parley.scm:610: history817818 > parley.scm:610: history817818 > parley.scm:603: ##sys#dynamic-wind > parley.scm:603: history798799 > parley.scm:603: history798799 > parley.scm:603: history798799 > parley.scm:603: history798799 > parley.scm:610: ##sys#dynamic-wind > parley.scm:610: history817818 > parley.scm:610: history817818 > parley.scm:615: get-next-char! > parley.scm:579: parley-char-ready? > parley.scm:586: append-while-incomplete > parley.scm:560: string-null? > parley.scm:561: repl-prompt > parley.scm:561: g769<-- > - > > Sometimes I'll crash immediately and someytimes I have to press some > keys when the "#;8>" prompt appears. > > > If I run the above script thusly: > > - > $ csi -s memo-demo.scm > - > > I see > > - > $ csi -s ../memo-demo.scm > 2.908s CPU time, 1.164s GC time (major), 75257 mutations, 22/1550 GCs > (major/minor) > 0s CPU time, 20 mutations > - > > ...and it hangs there (on the last time call) indefinitely using all the > CPU. Ctrl-C doesn't terminate it: a call to 'killall csi' does tho'. > > > If you cannot reproduce it then try varying the numbers in the call to > memo-fact**. > > > > Is this a known bug in Chicken 4.9.0rc1 or the
Re: [Chicken-users] CHICKEN hang / crash / memoize egg
Hi, >> I'm running CHICKEN 4.9.0rc1 and I'm trying out the memoize egg. >> >> I saw the tail-call-optimized version of the factorial procedure in the >> memoize documentation at http://api.call-cc.org/doc/memoize and I've >> been trying to modify it so that it memoizes intermediate results such >> that, for example, a call to (fact 10) makes a subsequent call to (fact >> 9) fast. >> >> In doing so I've managed to get the interpreter into a loop or crash it >> entirely. >> > > This looks like a perfectly legitimate crash. The memoize egg doesn’t > impose a limit on memory usage unless you explicitly tell it so. I get the same results with '(define memo-fact** (memoize fact** 3))'. I suspect this is a numbers bug as it still allocates a fair bit of memory. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] CHICKEN hang / crash / memoize egg
Hi Peeps! I'm running CHICKEN 4.9.0rc1 and I'm trying out the memoize egg. I saw the tail-call-optimized version of the factorial procedure in the memoize documentation at http://api.call-cc.org/doc/memoize and I've been trying to modify it so that it memoizes intermediate results such that, for example, a call to (fact 10) makes a subsequent call to (fact 9) fast. In doing so I've managed to get the interpreter into a loop or crash it entirely. When pasting this into a csi prompt: - (use numbers) (use memoize) (define (fact** x #!optional (self memo-fact**)) (if (= x 0) 1 (* x (self (- x 1) (define memo-fact** (memoize fact**)) (define x (time (memo-fact** 35710))) (define x (time (memo-fact** 35720))) (define x (time (memo-fact** 35730))) - I get: - $ csi CHICKEN (c) 2008-2014, The Chicken Team (c) 2000-2007, Felix L. Winkelmann Version 4.9.0rc1 (rev 3cf1967) linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ] compiled 2014-04-17 on hd-t1179cl (Linux) ; loading /home/local/andyjpb/.csirc ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/parley.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/chicken.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/data-structures.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/extras.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/ports.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/posix.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/srfi-1.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/srfi-13.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/srfi-18.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/stty.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/srfi-69.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/foreign.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/foreigners.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/parley.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/stty.so ... #;1> (use numbers) ; loading /usr/local/chicken-4.9.0/lib/chicken/7/numbers.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/numbers.so ... #;2> (use memoize) #;2> #;2> (define (fact** x #!optional (self memo-fact**)) #;2> (if (= x 0) #;2> 1 #;2> (* x (self (- x 1) #;2> #;2> (define memo-fact** (memoize fact**)) #;2> #;2> (define x (time (memo-fact** 35710))) #;2> (define x (time (memo-fact** 35720))) #;2> (define x (time (memo-fact** 35730))) #;2> ; loading /usr/local/chicken-4.9.0/lib/chicken/7/memoize.import.so ... ; loading /usr/local/chicken-4.9.0/lib/chicken/7/memoize.so ... Note: the following toplevel variables are referenced but unbound: memo-fact** (in fact**) 2.804s CPU time, 1.064s GC time (major), 81305 mutations, 21/1551 GCs (major/minor) 0s CPU time, 20 mutations 0s CPU time, 20 mutations #;8> [panic] out of memory - heap full while resizing - execution terminated ...more... parley.scm:610: history817818 parley.scm:610: history817818 parley.scm:603: ##sys#dynamic-wind parley.scm:603: history798799 parley.scm:603: history798799 parley.scm:603: history798799 parley.scm:603: history798799 parley.scm:610: ##sys#dynamic-wind parley.scm:610: history817818 parley.scm:610: history817818 parley.scm:615: get-next-char! parley.scm:579: parley-char-ready? parley.scm:586: append-while-incomplete parley.scm:560: string-null? parley.scm:561: repl-prompt parley.scm:561: g769<-- - Sometimes I'll crash immediately and someytimes I have to press some keys when the "#;8>" prompt appears. If I run the above script thusly: - $ csi -s memo-demo.scm - I see - $ csi -s ../memo-demo.scm 2.908s CPU time, 1.164s GC time (major), 75257 mutations, 22/1550 GCs (major/minor) 0s CPU time, 20 mutations - ...and it hangs there (on the last time call) indefinitely using all the CPU. Ctrl-C doesn't terminate it: a call to 'killall csi' does tho'. If you cannot reproduce it then try varying the numbers in the call to memo-fact**. Is this a known bug in Chicken 4.9.0rc1 or the srfi-69 hash-tables that memoize uses? Thanks for any tips you can offer. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Starting up spiffy for dynamic content
Hi, >> Some preconceptions, yes, but I've used enough frameworks such as >> this to make sure that I keep such preconceptions pretty >> lightweight, so they're merely a guide as a search for how the >> system wants to be used. I thus did find vhost-map quickly, but the >> documentation appeared to be telling me I was in the wrong place. > > It's a wiki, feel free to improve the wording in places where it's > unclear. I've been using Spiffy for too long to see these missing > pieces. I also found the request flow and control flow in spiffy quite tricky to get my head around initially. However, having grokked it, I then went back to the documentation and couldn't really work out any way of improving it. I think a lot of my challenges were around discoverability: spiffy makes heavy use of parameters rather than procedure arguments which makes finding out about the state available rather hard. Once I'd worked out that I could use the vhost-map to override the default behaviour, creating a "sealed app" became much easier. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF signature.asc Description: OpenPGP digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Starting up spiffy for dynamic content
Hi, > Thanks for these clarifications. > > On 8 Mar 2016, at 12:40, Peter Bex wrote: > >> On Tue, Mar 08, 2016 at 12:02:29PM +, Norman Gray wrote: >>> It occurred to me that I could/should use the vhost-map to do this >>> dispatching, using something like >>> >>> (vhost-map `((".*" . ,(lambda (continue) ... and ignore (continue) >>> >>> But (a) that would clearly be a hack >> >> Actually, that's how it was designed to be used. Not a hack at all! This is how we do things in Knodium as well and it works a treat. > Ah! > >>> and (b) it appears that that's designed to be able to re-parameterise >>> a request, rather than handle it itself, >> >> It's intended to be used like that, and you *may* re-parameterise (but >> that's not necessary). The idea is that you can create "components" >> which can be chained together, influencing their sub-components by >> simply parameterising some options and then passing the flow on to >> continue. The last component in the sequence would then actually >> serve the request. > > So you mean including handlers like: > > (define (vhost-handler cont) > (let ((uri (uri-path (request-uri (current-request) > (if (string=? (cadr uri) "wibble") ;; we want to handle URIs like > /wibble/... > (send-response status: 'ok >body: (format "Good: request was ~S > (vhost)" uri) >headers: '((content-type text/html))) > (cont > (vhost-map `((".*" . ,vhost-handler))) > > OK: that's a (very) nice design -- I'll do that. We use the uri-match egg to do our routing rather than decomposing the uri by hand. (http://api.call-cc.org/doc/uri-match ) Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Happy New Haircut!
Hi Chickens! Happy New Year! I hope you're all having a wonderful 2016 already. I hope this slightly off-topic message finds you well and that you don't mind me bothering you with it; after all, my hair has been a talking point at many Chicken meetup and conference! :-) As some of you know, I have lovely long hair and have been growing it for many years. It's finally time to cut it off for charity so I'm going to be donating the hair itself to The Little Princess Trust who will make it into a wig for a child who loses their own hair whilst fighting cancer. I'm also raising money for Cancer Research UK as many of my friends and family have suffered with various different types of cancer over the years. I hope you'll take a minute to have a look at my fund-raising page and maybe make a donation: http://jpb.li/haircut Thanks for all your help and support. Happy New Year and see you (without my hair) soon! Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Play with CHICKEN, Crepes-PHYS is out!
Hi, > It’s a tiny game made in a few weeks using CHICKEN. > A post-mortem blog post should follow in the next few days, along with > the projects’s source-code. I will try to explain the different states > the project went in, and how I built the binaries. That's really neat! I can't wait for the blog post. :-) Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Hello! I'm new and need some pointers please ~
Hi Federico! > Hello there! I'm Federico, a.k.a gosukiwi. > > I'm a wen developer (JS, Ruby, PHP, etc) wanting to learn > Scheme/Lisp/functional programming. My first lisp dialect is CHICKEN. Welcome! > I decided to make a simple project using Scheme so I can get the hang of > it. I didn't use anything "crazy" like macros, just simple constructs. > (Oh btw, any recommended book on Scheme which I follow along using CHICKEN?) > > It would be awesome if you guys could take a look and let me know what > you think? The source code is > here: https://github.com/gosukiwi/chicken-brainfuck > It's an interactive brainfuck interpreter. > > Also, I have one question: What's a good site for CHICKEN Scheme > reference? A simple document with a list of all standard R5RS/CHICKEN > functions would be great. Currently, using the CHICKEN website is so > hard to stuff, and if I Google I get a lot of Racket/MIT Scheme > documentation, but very little for CHICKEN. The R5RS spec itself is actually pretty accessible. "Learn Scheme in Fixnum Days" is also quite good. There are some DuckDuckGo shortcuts (https://duckduckgo.com/ ) !csc and !csw which look up the search term in the Chicken Scheme Chickadee and Wiki respectively. Just type the short code and then your search term in to the search box at http://duckduckgo.com/ . Chickadee (http://api.call-cc.org/ ) allows you to search the APIs for CHICKEN and its Eggs. > For example, for web development we have http://devdocs.io/ which is > awesome for searching documentation. > > Thanks for your time ~ No worries! Welcome to the community. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Homepage design proposal
Hi, Most modifications were done to chicken.css file, so changes are immediately applicable to probably 90% of CHICKEN site (exceptions are api.call-cc.org [10] and bugs.call-cc.org [11]). To make the page "responsive" to narrow screens (i.e. mobiles) we would need to add one line of HTML into pages. This line is already inserted in the .html files on the https://dl.dropboxusercontent.com/u/621606/chicken-web-page/chicken-web-page.tar.gz [12] bundle. It contains many .html files and I recommend opening "CHICKEN Scheme.html" first. The menu on this page has some directly browsable links ("Get started!" link at the bottom can also be clicked). Do you find it useful? Wow! These are really cool! ...and I like how you've extended from the status quo rather than rebuild everything. It makes it very easy to make a decision on and then implement quickly. Nice work! -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ http://www.gonumber.com/andyjpb 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] blob->s8vector/shared: types.db incorrect
Hi, types.db thinks that blob->s8vector/shared returns an u8vector! - $ cat >> /tmp/x.scm (use srfi-4) (s8vector-ref (blob->s8vector/shared #${000a}) 0) $ csc /tmp/x.scm Warning: at toplevel: (/tmp/x.scm:2) in procedure call to `s8vector-ref', expected argument #1 of type `(struct s8vector)', but was given an argument of type `(struct u8vector)' - -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ http://www.gonumber.com/andyjpb 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] New egg: clucker (Twitter API)
Hi, > I'm happy to announce the first release of the "clucker" egg, which > provides access methods to Twitter's public api endpoints. Great work Nick! :-) Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] read-u8vector: types.db inconsistent with documentation
Hi, Thanks Andy, this warning is indeed incorrect. A patch has been posted to fix it. Thanks! :-) -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ http://www.gonumber.com/andyjpb 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] http-client gets stuck in scheduler when reusing connections
Hi, I've been using CHICKEN to speak to HBase via the Stargate REST API. I've managed to build a binding with the rest-bind egg and it works. However, it's very slow but it doesn't saturate CPU or IO bandwidth. I have a benchmark where it requests 124 cells from HBase using the scanner API. This takes about 5 seconds, of which less than 0.2 seconds are actually spend doing anything at all: - #: 124 0.18s CPU time, 0.02s GC time (major), 157977/130286 mutations (total/tracked), 4/273 GCs (major/minor) 0.32user 0.02system 0:05.20elapsed 6%CPU (0avgtext+0avgdata 24096maxresident)k 0inputs+32outputs (0major+3514minor)pagefaults 0swaps - There are some more benchmarks here: http://paste.call-cc.org/paste?id=b46e6a3905ae611f2dcce3c3214e7d20384fa8ed The benchmark is almost the same from compiled code as it is via csi. I've tried attaching the debugger to the process and I always catch it in __poll_nocancel so I suspect that it's getting stuck in the scheduler. If I tell the HTTP request to use HTTP/1.0 rather than HTTP/1.1 then it doesn't uses a new HTTP connection for each request and goes significantly faster (but still only gets up to about 17% CPU rather than 0.4%): - $ time csi -s extractor.scm #: 124 0.112s CPU time, 0.02s GC time (major), 33088/5388 mutations (total/tracked), 5/218 GCs (major/minor) real0m0.790s user0m0.260s sys 0m0.012s - As you can see from the numbers above, it's still wasting a considerable amount of time. I did a benchmark using curl as well in order to rule out the other end of the REST API: Reusing a single connection: - $ time seq 1 124 | sed s#.*#http://localhost:8080/GridSearch/scanner/14351513400672ee69118# |xargs -n 124 curl > /dev/null 2>&1 real0m0.079s user0m0.024s sys 0m0.004s - Using a connection per request: - $ time seq 1 124 | sed s#.*#http://localhost:8080/GridSearch/scanner/14351514443804a6fb774# |xargs -n 1 curl > /dev/null 2>&1 real0m1.472s user0m0.472s sys 0m0.036s - I did a bit more profiling and http-client spends almost all of its time in intarweb's read-response procedure which, in turn, spends all it's time in its own safe-read-line procedure. Swapping safe-read-line for read-line doesn't change anything. My timings show that things get stuck in read-line for 38 or 40ms per call. For 124 calls that's about 4.712 seconds which is most of the 5 seconds run time. I've looked briefly into ports.scm and library.scm in the CHICKEN source but didn't have much luck understanding what was going on. make-input-port's read-char procedure appears to call (read) whilst inside the scope of a lambda called read which has lots of arguments so I'm clearly missing something. Any help about how to improve this situation would be greatfully appreciated. Thanks! :-) -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ http://www.gonumber.com/andyjpb 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] read-u8vector: types.db inconsistent with documentation
Hi, I'm using chicken-4.10rc1. When I use read-u8vector with #f for the LENGTH argument as specified in the docs (http://api.call-cc.org/doc/srfi-4/read-u8vector ) the compiler gives me - Warning: in local unknown procedure, in local unknown procedure, in toplevel procedure `stargate-lolevel#scanner-get-next': (stargate-lolevel.scm:166) in procedure call to `read-u8vector', expected argument #1 of type `fixnum', but was given an argument of type `false' - -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ http://www.gonumber.com/andyjpb 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Inserting Binary Data with sql-de-lite
On Mon, 22 Jun 2015 16:36:52 -0500, Jim Ursetto wrote: Andy, What if you convert the string to a blob before passing it in? Yes! That fixes it. Thanks. My bad: I'd put read-string in to read the data from the port during prototyping and then forgotten about it. Thanks for the tips! -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ http://www.gonumber.com/andyjpb 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Inserting Binary Data with sql-de-lite
Hi, I'm using a parameterized statement to insert binary data into sql-de-lite (0.6.6) on CHICKEN 4.10rc1. When I call sql-de-lite's exec procedure I get: - Error: (##sys#make-c-string) cannot represent string with NUL bytes as C string: "��\x00... ... Call history: sql-de-lite.scm:459: lru-cache#lru-cache-capacity sql-de-lite.scm:188: ##sys#block-set! sql-de-lite.scm:461: lru-cache#lru-cache-set! sql-de-lite.scm:175: ##sys#block-set! sql-de-lite.scm:567: bind-parameter-count sql-de-lite.scm:581: keyword? sql-de-lite.scm:583: bind sql-de-lite.scm:594: %bind-int sql-de-lite.scm:605: bind-parameter-count sqlite3-api.scm:155: ##sys#make-c-string sql-de-lite.scm:584: loop sql-de-lite.scm:581: keyword? sql-de-lite.scm:583: bind sql-de-lite.scm:594: %bind-int sql-de-lite.scm:605: bind-parameter-count sqlite3-api.scm:155: ##sys#make-c-string<-- - What's the recommended way to do or fix this? In the CHICKEN 4.7 days I have taken binary data *out* of SQLite but I've not done it since the NUL-string problems were addressed. The data gets into CHICKEN by reading it from a port using http-client. Thanks for your help. Sorry I'm light on details: I can send more sensible stuff on request. -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ http://www.gonumber.com/andyjpb 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [Chicken-hackers] Any thoughts on performance woes?
Hi, > The difference is, this one is much better code, which doesn't exercise > the garbage collector, so it isn't much use as a GC benchmark. Code involving SSQL would be good for a GC benchmark. I recently reworked the query generation in Knodium to be up-front rather than at access-time and got an ordes of magnitude speed up and an order of magnitude fewer GCs. Here's a snippet from my commit message: - (account 'read "1:3") query generation (each call returns 1 account object) > (time (for-each (lambda x (account 'read "1:3")) (iota 6500))) Original: 5.296s CPU time, 0.492s GC time (major), 3334265 mutations, 86/28886 GCs (major/minor) 5.357s CPU time, 0.48s GC time (major), 3334265 mutations, 84/2 GCs (major/minor) 5.332s CPU time, 0.508s GC time (major), 3334265 mutations, 89/28883 GCs (major/minor) 5.284s CPU time, 0.46s GC time (major), 3334265 mutations, 83/28889 GCs (major/minor) 5.397s CPU time, 0.501s GC time (major), 3334283 mutations, 83/28889 GCs (major/minor) With pre-generated query in read-account: 0.304s CPU time, 0.004s GC time (major), 220077 mutations, 1/656 GCs (major/minor) 0.296s CPU time, 220077 mutations, 0/657 GCs (major/minor) 0.304s CPU time, 220077 mutations, 0/657 GCs (major/minor) 0.296s CPU time, 220077 mutations, 0/657 GCs (major/minor) 0.3s CPU time, 220077 mutations, 0/657 GCs (major/minor) - Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF signature.asc Description: OpenPGP digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Fix date-literals to build & install date-literals.import.so
Hi, NhanH reported in IRC that they could not get the date-literals egg to work: (use date-literals) wasn't able to find the module. After some investigation, Peter pointed out that no import library was being installed. Here's a patch that builds and installs the import as well as increases the version number. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF diff -ruP date-literals/date-literals.setup date-literals.2015-04-08/date-literals.setup --- date-literals/date-literals.setup 2015-04-08 11:24:27.654215900 +0100 +++ date-literals.2015-04-08/date-literals.setup 2015-04-08 11:21:16.370492378 +0100 @@ -1,6 +1,7 @@ (compile -s -O2 -d1 date-literals.scm -j date-literals) +(compile -s date-literals.import.scm -O2 -d0) (install-extension 'date-literals - '("date-literals.so") - '((version 1.1.0) ) ) + '("date-literals.so" "date-literals.import.so") + '((version 1.1.1) ) ) ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] rest-bind request headers support
Hi, Thanks Kooda! I seem to have noticed this too but didn't actually push my changes! Our patches are very similar but mine respects the entire request object if passed by the user. Please can you try it and let me know if it works for you? The repository is at ssh://g...@bitbucket.org/knodium/rest-bind.git If it works then I'll cut a release, if not I'll apply your patch instead and cut a release. Thanks for reporting this and doing the work to find out what was wrong! :-) I hope you're enjoying rest-bind. > I’m trying to use rest-bind for a project and need to be able to add > some headers to the http requests, which rest-bind didn’t permit, even > when passing a request object. > > Here is a simple patch that fixes this issue: > > --- rest-bind.scm.orig2015-03-29 00:26:49.0 +0100 > +++ rest-bind.scm 2015-03-29 00:24:43.0 +0100 > @@ -94,7 +94,9 @@ > (else (uri-reference uri/req > (method (cond ((request? uri/req) (request-method > uri/req)) > (writer 'POST) > -(else 'GET > +(else 'GET))) > + (headers (cond ((request? uri/req) (request-headers > uri/req)) > +(else (headers '()) > (lambda ,proc-args >(let* (,@(if (not (null? uri-args)) > `((uri (update-uri uri path: (append (uri-path > uri) (map ->string (list ,@uri-args) > @@ -109,7 +111,7 @@ > > ,param))) > > params)) > '()) > -(req (make-request uri: uri method: method)) ; poke > the args into query string. > +(req (make-request uri: uri method: method headers: > headers)) ; poke the args into query string. > ) > (receive (reader uri response) > (call-with-input-request req ,(if writer > '(writer body) #f) ,reader) > Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Fwd: Re: headers with nginx + awful
Is this thing on? I seem to be having trouble posting this. Forwarded Message Subject: Re: [Chicken-users] headers with nginx + awful Date: Tue, 24 Mar 2015 22:13:11 + From: Andy Bennett To: Nathaniel Rudavsky-Brody Hi, Given that it's happening with Firefox but not with Curl, I'd look into the connection reuse between nginx and spiffy. Curl always opens a new http connection: Firefox might reuse one that it has around already. Does this happen only on not-the-first-request? Sorry to top post. > I'm having a problem with headers when using nginx's proxy_pass with > awful, and I'm not sure if it's a question of nginx or Chicken, or just > my misunderstanding of headers... > > Everything works fine except when I use (send-static-file) as in: > > (define-page (regexp "/file/.+") > (lambda (url) > (parameterize ((root-path (data-dir))) > (send-static-file (string-drop url 6) > > In this case, Firefox shows me a set of Spiffy headers at the end of the > response body, even though they should be replaced by nginx's headers, > which seem to be fine: > > > ... > > HTTP/1.1 200 OK > Content-Type: text/html > Server: Spiffy/5.3 (Running on Chicken 4.8.0.6) > Content-Length: 6 > Date: Tue, 24 Mar 2015 16:01:46 GMT > > 483702 > > Curl, however, only sees the nginx headers, with nothing extra at the end: > > HTTP/1.1 200 OK > Server: nginx/1.4.6 (Ubuntu) > Date: Tue, 24 Mar 2015 16:24:42 GMT > Content-Type: text/html > Content-Length: 483704 > Connection: keep-alive > Last-Modified: Tue, 24 Mar 2015 16:23:40 GMT > Etag: "483704-1427214220.0" > > > ... > > > My nginx config is just: > > server { > listen7000; > location / { >proxy_pass http://localhost:8080; > > } > } > > Many thanks for any ideas. > > Nathaniel > > > > > > ___ > Chicken-users mailing list > Chicken-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/chicken-users > Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Fwd: Re: headers with nginx + awful
Forwarded Message Subject: Re: [Chicken-users] headers with nginx + awful Date: Tue, 24 Mar 2015 22:13:11 + From: Andy Bennett To: Nathaniel Rudavsky-Brody Hi, Given that it's happening with Firefox but not with Curl, I'd look into the connection reuse between nginx and spiffy. Curl always opens a new http connection: Firefox might reuse one that it has around already. Does this happen only on not-the-first-request? Sorry to top post. > I'm having a problem with headers when using nginx's proxy_pass with > awful, and I'm not sure if it's a question of nginx or Chicken, or just > my misunderstanding of headers... > > Everything works fine except when I use (send-static-file) as in: > > (define-page (regexp "/file/.+") > (lambda (url) > (parameterize ((root-path (data-dir))) > (send-static-file (string-drop url 6) > > In this case, Firefox shows me a set of Spiffy headers at the end of the > response body, even though they should be replaced by nginx's headers, > which seem to be fine: > > > ... > > HTTP/1.1 200 OK > Content-Type: text/html > Server: Spiffy/5.3 (Running on Chicken 4.8.0.6) > Content-Length: 6 > Date: Tue, 24 Mar 2015 16:01:46 GMT > > 483702 > > Curl, however, only sees the nginx headers, with nothing extra at the end: > > HTTP/1.1 200 OK > Server: nginx/1.4.6 (Ubuntu) > Date: Tue, 24 Mar 2015 16:24:42 GMT > Content-Type: text/html > Content-Length: 483704 > Connection: keep-alive > Last-Modified: Tue, 24 Mar 2015 16:23:40 GMT > Etag: "483704-1427214220.0" > > > ... > > > My nginx config is just: > > server { > listen7000; > location / { >proxy_pass http://localhost:8080; > > } > } > > Many thanks for any ideas. > > Nathaniel > > > > > > ___ > Chicken-users mailing list > Chicken-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/chicken-users > Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [Chicken-hackers] mifgration of some files from call/cc.org to code.call-cc.org
Hi, > Should you still use CHICKEN 3 and chicken-setup reports problems (it > probably will), please contact me, and I can provide a patch to > chicken-setup to use the new location. Can you install a redirect rule in the web server / .htaccess? Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] How to bootstrap developing a CHICKEN application?
Hi, > The nice thing about structuring your application as an egg is that you > get some interesting things for free. For example, cross-compilation > support and the availability of egg-related tools (e.g., salmonella). Isn't cross-compilation something you only get if you use the setup-api? Of do Makefiles get CC equivalent envars set? Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] multiple mingw installations on windows
Hi, > On windows, then chicken compiler uses the gcc which is found in > PATH. This causes problems when there are multiple mingw > installations on a machine (or multiple gcc bundled with various > software). > > Is there a way to tell the chicken compiler which gcc to use? I am > looking for an environment variable to do this, something in the > spirit of CHICKEN_PREFIX, or some other configuration, not a chicken > build option like C_COMPILER. I need it when installing chicken as a > binary. Maybe you are looking for the -cc, -cxx and -ld options to csc? - -cc COMPILER select other C compiler than the default -cxx COMPILER select other C++ compiler than the default -ld COMPILER select other linker than the default - Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] [ANN] OAuth Egg v0.2 Released
Hi everyone, I've released v0.2 of the OAuth Egg: http://wiki.call-cc.org/eggref/4/oauth This release brings support for HMAC-SHA1 signing and a few bug fixes when using the 1.0a and RFC 5849 modes. This egg has now been verified with at least the APIs of Dropbox and Twitter. Thanks to Nick Van Horn for reporting some bugs and spurring me into action! For those of you binding HTTP APIs, you might also be interested in the rest-bind egg: http://wiki.call-cc.org/eggref/4/rest-bind ...and you can complement the documentation with my recent talk about the rationale behind it: https://www.youtube.com/watch?v=nzS48beMxwo Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Handling Errors
Hi, > (define (foo lis) (cdr lis)) > > Obviously LIS should neither be an empty list nor a list with only one > element. > What is the recommended way to deal with such constraints? Should I > enforce them by writing conditionals at the beginning of the > function[1]? Or is it conventional to just let the function fail and > catch the error somewhere else (probably in a top-level function)? > > [1] This quickly leads to dirty and not-easy-to-read code. > > What say you seasoned schemers on this? That depends on the scope of the accessor. I often use these kinds of things for quick and dirty data structures for passing seeds for fold around. In that case I use the even more concise '(define foo cdr)'. In the case where other modules are using the API then I might go to more trouble but then you have to think about whether, in the error cases: + To return successfully with a sentinel value. This is valid in some cases, depending on the data semantics. It can be implemented using the conditionals that you mention. + To use assert at the head of the procedure to validate the data structure. This doesn't stop the error but it gives a more debuggable message. + To catch and re-throw the exception. This is fraught with anti-patterns, is a lot of work and you have to do it really carefully. I hardly ever do this. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF signature.asc Description: OpenPGP digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] sxpath does not preserve node order
Hi Sascha, > ((sxpath "//h1[@class='header']//*/text()") >(with-input-from-request > "http://www.imdb.com/title/tt0497465/"; > #f html->sxml)) This isn't a fix for your problem: it's a plug for my egg, rest-bind, which might be useful to you if you're binding a lot of HTTP APIs like this. http://wiki.call-cc.org/eggref/4/rest-bind Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] OpenSSL egg option defaults poll
On 27/11/14 03:00, Florian Zumbiehl wrote: > Hi, > >> ... and now version (4) with the dynamic-wind in the correct place: > > I think the logic is correct now, just two small cosmectic issues: > >> diff -upr v1.6.4/openssl.import.scm v1.6.4-andyjpb-fix-4/openssl.import.scm >> --- v1.6.4/openssl.import.scm2014-11-23 02:37:31.235897645 + >> +++ v1.6.4-andyjpb-fix-4/openssl.import.scm 2014-11-23 02:13:16.085352751 + >> @@ -1,6 +1,6 @@ >> openssl.import.scm - GENERATED BY CHICKEN 4.9.0rc1 -*- Scheme -*- >> >> -(eval '(import scheme chicken foreign ports srfi-18 tcp)) >> +(eval '(import scheme chicken foreign ports srfi-13 srfi-18 tcp)) >> (##sys#register-compiled-module >>'openssl >>(list) > > That probably shouldn't be in the diff? Ooops. Yes. I think I removed it from some and not others. >> + (unbuffered-write >> + (lambda (buffer #!optional (offset 0) (size (##sys#size buffer))) > > unbuffered-write doesn't ever get called with an offset other than 0. True, but I wanted to keep the interface reasonably conventional. I didn't rework the internals of unbuffered-write due to the when clause but if we did then it would be used. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] qt-light egg patch for MacPorts compatibility
Hi, I'm not the maintainer for this egg, but welcome to the community! :-) I hope you enjoy CHICKEN. Thanks for putting the effort in to make the patch. :-) > I'm interested in developing with chicken on my mac and I was happy to find > that MacPorts had packaged chicken. I wanted to use Qt so I installed the > dependencies and installed the qt-light egg. Unfortunately, it didn't > compile. So I made a patch so it did. Here is the patch to the > "chicken-compile-qt-extension.scm" file I made : > > 18a19 >> (and (file-execute-access? "/opt/local/bin/qmake") "/opt/local") > 31a33,34 >> (define macosx (eq? (software-version) 'macosx)) >> (if macosx (define install_name_tool "/usr/bin/install_name_tool")) > 111c114,116 > < (if mingw32 "dll" "so.1.0.0")) > --- >> (cond (mingw32 "dll") >> (macosx "1.0.0.dylib") >> (else "so.1.0.0"))) > 112a118 >> (if macosx (run (,install_name_tool -change "libchicken.dylib" >> ,(make-pathname libpath "libchicken" "dylib") ,output))) > > It made compilation work for me! It would be nice if the patch could be added > to the official egg. Since I'm new to scheme and chicken, I hope I did it the > right thing. If it's not how you do egg compilation scripts, please let me > know so I dig more into it. > > Jérémy > ___ > Chicken-users mailing list > Chicken-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/chicken-users > Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] OpenSSL egg option defaults poll
Hi, ... and now version (4) with the dynamic-wind in the correct place: - $ diff -upr v1.6.4-andyjpb-fix-3 v1.6.4-andyjpb-fix-4 Binary files v1.6.4-andyjpb-fix-3/openssl.import.so and v1.6.4-andyjpb-fix-4/openssl.import.so differ diff -upr v1.6.4-andyjpb-fix-3/openssl.scm v1.6.4-andyjpb-fix-4/openssl.scm --- v1.6.4-andyjpb-fix-3/openssl.scm2014-11-25 15:53:35.035152667 + +++ v1.6.4-andyjpb-fix-4/openssl.scm2014-11-25 16:21:59.105377994 + @@ -481,17 +481,16 @@ EOF (unbuffered-write buffer))) ;; close (lambda () - (dynamic-wind -void -(lambda () - (when (startup #t) -(if outbuf - (begin -(unbuffered-write outbuf 0 outbufsize) -(set! outbufsize 0) -(lambda () - (set! out-open? #f) - (shutdown + (when (startup #t) +(dynamic-wind + void + (lambda () +(when outbuf + (unbuffered-write outbuf 0 outbufsize) + (set! outbufsize 0))) + (lambda () +(set! out-open? #f) +(shutdown) ;; flush (lambda () (when outbuf - Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF diff -upr v1.6.4/openssl.import.scm v1.6.4-andyjpb-fix-4/openssl.import.scm --- v1.6.4/openssl.import.scm 2014-11-23 02:37:31.235897645 + +++ v1.6.4-andyjpb-fix-4/openssl.import.scm 2014-11-23 02:13:16.085352751 + @@ -1,6 +1,6 @@ openssl.import.scm - GENERATED BY CHICKEN 4.9.0rc1 -*- Scheme -*- -(eval '(import scheme chicken foreign ports srfi-18 tcp)) +(eval '(import scheme chicken foreign ports srfi-13 srfi-18 tcp)) (##sys#register-compiled-module 'openssl (list) Binary files v1.6.4/openssl.import.so and v1.6.4-andyjpb-fix-4/openssl.import.so differ diff -upr v1.6.4/openssl.scm v1.6.4-andyjpb-fix-4/openssl.scm --- v1.6.4/openssl.scm 2014-11-23 00:07:52.324097414 + +++ v1.6.4-andyjpb-fix-4/openssl.scm 2014-11-25 16:21:59.105377994 + @@ -45,7 +45,7 @@ ##sys#check-string ##sys#expand-home-path)) -(use srfi-18 tcp) +(use srfi-13 srfi-18 tcp) #> #include @@ -442,43 +442,61 @@ EOF "SSL read timed out"))) buffer (out - (let* ((outbufsize (tcp-buffer-size)) - (outbuf (and outbufsize (fx> outbufsize 0) "")) - (output - (lambda (buffer) - (startup) - (when (> (##sys#size buffer) 0) ; Undefined behaviour for 0 bytes! - (let loop ((offset 0) (size (##sys#size buffer))) + (let* ((outbufmax (tcp-buffer-size)) + (outbuf (and outbufmax (fx> outbufmax 0) (make-string outbufmax))) + (outbufsize 0) + (unbuffered-write + (lambda (buffer #!optional (offset 0) (size (##sys#size buffer))) + (when (> size 0) ; Undefined behaviour for 0 bytes! + (let loop ((offset offset) (size size)) (let ((ret (ssl-call/timeout 'ssl-write (lambda () (ssl-write ssl buffer offset size)) fd (tcp-write-timeout) "SSL write timed out"))) (when (fx< ret size) ; Partial write (loop (fx+ offset ret) (fx- size ret) + + (define (buffered-write data #!optional (start 0)) + (let* ((size (- (##sys#size data) start)) + (to-copy (min (- outbufmax outbufsize) size)) + (left-over (- size to-copy))) + + (string-copy! outbuf outbufsize data start (+ start to-copy)) + (set! outbufsize (+ outbufsize to-copy)) + + (if (= outbufsize outbufmax) + (begin + (unbuffered-write outbuf) + (set! outbufsize 0))) + + (if (> left-over 0) + (buffered-write data (+ start to-copy) + (make-output-port ;; write (lambda (buffer) + (startup) (if outbuf - (begin - (set! outbuf (string-append outbuf buffer)) - (when (fx>= (string-length outbuf) outbufsize) - (output outbuf) - (set! outbuf ""))) - (output buffer))) + (buffered-write buffer) + (unbuffered-write buffer))) ;; close (lambda () (when (startup #t) - (if outbuf - (begin - (output outbuf) - (set! outbuf ""))) - (set! out-open? #f) - (shutdown))) + (dynamic-wind + void + (lambda () + (when outbuf + (unbuffered-write outbuf 0 outbufsize) + (set! outbufsize 0))) + (lambda () + (set! out-open? #f) + (shutdown) ;; flush (lambda () (when outbuf - (output outbuf) - (set! outbuf ""))) + (startup) + (unbuffered-write outbuf 0 outbufsize) + (set! outbufsize 0))) (##sys#setslot in 3 "(ssl)") (##sys#setslot out 3 "(ssl)") ;; first "reserved" slot Only in v1.6.4-andyjpb-fix-4: openssl.scm~ Only in v1.6.4-andyjpb-fix-4: .openssl.scm.swp Binary files v1.6.4/openssl.so and v1.6.4-andyjpb-fix-4/openssl.so
Re: [Chicken-users] OpenSSL egg option defaults poll
On 23/11/14 18:38, Florian Zumbiehl wrote: > Hi, > >> ;; close >> (lambda () >> (when (startup #t) >> (if outbuf >> - (begin >> - (output outbuf) >> - (set! outbuf ""))) >> + (begin >> + (unbuffered-write outbuf 0 outbufsize) >> + (set! outbufsize 0))) >> (set! out-open? #f) >> (shutdown))) > > AFAICS, this makes it impossible to close the file descriptors behind ports > where the remote end has closed the connection while there is still data > queued for transmission. Find a new version of the patch attached. This is version (3) and is against v1.6.4. A diff against versiion (2) is here: - diff -upr v1.6.4-andyjpb-fix-2/openssl.scm v1.6.4-andyjpb-fix-3/openssl.scm --- v1.6.4-andyjpb-fix-2/openssl.scm2014-11-23 13:10:43.801483458 + +++ v1.6.4-andyjpb-fix-3/openssl.scm2014-11-25 15:53:35.035152667 + @@ -481,13 +481,17 @@ EOF (unbuffered-write buffer))) ;; close (lambda () - (when (startup #t) -(if outbuf - (begin -(unbuffered-write outbuf 0 outbufsize) -(set! outbufsize 0))) -(set! out-open? #f) -(shutdown))) + (dynamic-wind +void +(lambda () + (when (startup #t) +(if outbuf + (begin +(unbuffered-write outbuf 0 outbufsize) +(set! outbufsize 0) +(lambda () + (set! out-open? #f) + (shutdown ;; flush (lambda () (when outbuf - Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF diff -upr v1.6.4/openssl.scm v1.6.4-andyjpb-fix-3/openssl.scm --- v1.6.4/openssl.scm 2014-11-23 00:07:52.324097414 + +++ v1.6.4-andyjpb-fix-3/openssl.scm 2014-11-25 15:53:35.035152667 + @@ -45,7 +45,7 @@ ##sys#check-string ##sys#expand-home-path)) -(use srfi-18 tcp) +(use srfi-13 srfi-18 tcp) #> #include @@ -442,43 +442,62 @@ EOF "SSL read timed out"))) buffer (out - (let* ((outbufsize (tcp-buffer-size)) - (outbuf (and outbufsize (fx> outbufsize 0) "")) - (output - (lambda (buffer) - (startup) - (when (> (##sys#size buffer) 0) ; Undefined behaviour for 0 bytes! - (let loop ((offset 0) (size (##sys#size buffer))) + (let* ((outbufmax (tcp-buffer-size)) + (outbuf (and outbufmax (fx> outbufmax 0) (make-string outbufmax))) + (outbufsize 0) + (unbuffered-write + (lambda (buffer #!optional (offset 0) (size (##sys#size buffer))) + (when (> size 0) ; Undefined behaviour for 0 bytes! + (let loop ((offset offset) (size size)) (let ((ret (ssl-call/timeout 'ssl-write (lambda () (ssl-write ssl buffer offset size)) fd (tcp-write-timeout) "SSL write timed out"))) (when (fx< ret size) ; Partial write (loop (fx+ offset ret) (fx- size ret) + + (define (buffered-write data #!optional (start 0)) + (let* ((size (- (##sys#size data) start)) + (to-copy (min (- outbufmax outbufsize) size)) + (left-over (- size to-copy))) + + (string-copy! outbuf outbufsize data start (+ start to-copy)) + (set! outbufsize (+ outbufsize to-copy)) + + (if (= outbufsize outbufmax) + (begin + (unbuffered-write outbuf) + (set! outbufsize 0))) + + (if (> left-over 0) + (buffered-write data (+ start to-copy) + (make-output-port ;; write (lambda (buffer) + (startup) (if outbuf - (begin - (set! outbuf (string-append outbuf buffer)) - (when (fx>= (string-length outbuf) outbufsize) - (output outbuf) - (set! outbuf ""))) - (output buffer))) + (buffered-write buffer) + (unbuffered-write buffer))) ;; close (lambda () - (when (startup #t) - (if outbuf - (begin - (output outbuf) - (set! outbuf ""))) - (set! out-open? #f) - (shutdown))) + (dynamic-wind + void + (lambda () + (when (startup #t) + (if outbuf + (begin + (unbuffered-write outbuf 0 outbufsize) + (set! outbufsize 0) + (lambda () + (set! out-open? #f) + (shutdown ;; flush (lambda () (when outbuf - (output outbuf) - (set! outbuf ""))) + (startup) + (unbuffered-write outbuf 0 outbufsize) + (set! outbufsize 0))) (##sys#setslot in 3 "(ssl)") (##sys#setslot out 3 "(ssl)") ;; first "reserved" slot ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] OpenSSL egg option defaults poll
Hi, >>> I'd be glad if some of you could test this out and tell me what you >>> think about it >> >> Can you give some tips for how to test this from a spiffy applications? >> I usually just pass in ssl-accept instead of tcp-accept. >> [...] > > Hello, > > actually I have very little experience with spiffy, but if it can use > ssl-accept, it must use ssl-listen somewhere and that's the point that > would need to be adapted. > > Judging by Spiffy's documentation in the Wiki you could do something > like this: > > (define ear > (ssl-listen* > hostname: "localhost" port: 44344 > certificate: "my-server-cert.pem" > private-key: "my-server-key.pem")) > (accept-loop ear ssl-accept) > > Beware, this snippet of code is completely untested! I've just tried this. I have openssl 1.0.1e-2+deb7u13 on my localhost With ssl-listen: $ nmap --script ssl-enum-ciphers -sV -p 8080 127.0.0.1 - | ssl-enum-ciphers: | SSLv3 | Ciphers (9) | TLS_RSA_WITH_3DES_EDE_CBC_SHA - strong | TLS_RSA_WITH_AES_128_CBC_SHA - strong | TLS_RSA_WITH_AES_256_CBC_SHA - unknown strength | TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - unknown strength | TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - unknown strength | TLS_RSA_WITH_DES_CBC_SHA - unknown strength | TLS_RSA_WITH_RC4_128_MD5 - unknown strength | TLS_RSA_WITH_RC4_128_SHA - strong | TLS_RSA_WITH_SEED_CBC_SHA - unknown strength | Compressors (1) | NULL | TLSv1.0 | Ciphers (9) | TLS_RSA_WITH_3DES_EDE_CBC_SHA - strong | TLS_RSA_WITH_AES_128_CBC_SHA - strong | TLS_RSA_WITH_AES_256_CBC_SHA - unknown strength | TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - unknown strength | TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - unknown strength | TLS_RSA_WITH_DES_CBC_SHA - unknown strength | TLS_RSA_WITH_RC4_128_MD5 - unknown strength | TLS_RSA_WITH_RC4_128_SHA - strong | TLS_RSA_WITH_SEED_CBC_SHA - unknown strength | Compressors (1) | NULL | TLSv1.1 | Ciphers (9) | TLS_RSA_WITH_3DES_EDE_CBC_SHA - strong | TLS_RSA_WITH_AES_128_CBC_SHA - strong | TLS_RSA_WITH_AES_256_CBC_SHA - unknown strength | TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - unknown strength | TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - unknown strength | TLS_RSA_WITH_DES_CBC_SHA - unknown strength | TLS_RSA_WITH_RC4_128_MD5 - unknown strength | TLS_RSA_WITH_RC4_128_SHA - strong | TLS_RSA_WITH_SEED_CBC_SHA - unknown strength | Compressors (1) | NULL | TLSv1.2 | Ciphers (13) | TLS_RSA_WITH_3DES_EDE_CBC_SHA - strong | TLS_RSA_WITH_AES_128_CBC_SHA - strong | TLS_RSA_WITH_AES_128_CBC_SHA256 - strong | TLS_RSA_WITH_AES_128_GCM_SHA256 - strong | TLS_RSA_WITH_AES_256_CBC_SHA - unknown strength | TLS_RSA_WITH_AES_256_CBC_SHA256 - unknown strength | TLS_RSA_WITH_AES_256_GCM_SHA384 - unknown strength | TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - unknown strength | TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - unknown strength | TLS_RSA_WITH_DES_CBC_SHA - unknown strength | TLS_RSA_WITH_RC4_128_MD5 - unknown strength | TLS_RSA_WITH_RC4_128_SHA - strong | TLS_RSA_WITH_SEED_CBC_SHA - unknown strength | Compressors (1) | NULL |_ Least strength = unknown strength - With ssl-listen*: - | ssl-enum-ciphers: | TLSv1.2 | Ciphers (13) | TLS_RSA_WITH_3DES_EDE_CBC_SHA - strong | TLS_RSA_WITH_AES_128_CBC_SHA - strong | TLS_RSA_WITH_AES_128_CBC_SHA256 - strong | TLS_RSA_WITH_AES_128_GCM_SHA256 - strong | TLS_RSA_WITH_AES_256_CBC_SHA - unknown strength | TLS_RSA_WITH_AES_256_CBC_SHA256 - unknown strength | TLS_RSA_WITH_AES_256_GCM_SHA384 - unknown strength | TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - unknown strength | TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - unknown strength | TLS_RSA_WITH_DES_CBC_SHA - unknown strength | TLS_RSA_WITH_RC4_128_MD5 - unknown strength | TLS_RSA_WITH_RC4_128_SHA - strong | TLS_RSA_WITH_SEED_CBC_SHA - unknown strength | Compressors (1) | NULL |_ Least strength = unknown strength - I'm not sure I entirely trust nmap as other the openssl tool shows that zlib compression is negotiated when using either ssl-listen or ssl-listen* ssl-listen: - New, TLSv1/SSLv3, Cipher is AES256-GCM-SHA384 Server public key is 2048 bit Secure Renegotiation IS supported Compression: zlib compression Expansion: zlib compression SSL-Session: Protocol : TLSv1.2 Cipher: AES256-GCM-SHA384 Session-ID: ADB914DDE44B74FABB090BFAA419BCE65B3969B5C1CA1981007B43E4DFEE21BE Session-ID-ctx: Master-Key: F148213C9B6AA23159CFD29129833A3DBB283B611B6234636B3F5F355FB5BA06C9BB740B4408ADF2B404817BCE24F27C Key-Arg : None PSK identity: None PSK identity hint: None SRP username: None TLS session ticket lifetime hint: 300 (seconds) TLS session ticket: - 48 89 c5 a
Re: [Chicken-users] OpenSSL egg option defaults poll
Hi, >> * substring/shared is the same as substring in CHICKEN, AFAIK. > > That's only called once in the corner cases so it doesn't really matter > if it wastes a copy. It's just there to stop junk in the tail of the > buffer being sent to the user. Attached is new version of my patch which avoids the use of substring/shared. Below is a diff between the code with my previous patch and the code with this new patch. - diff -upr v1.6.4-andyjpb-fix/openssl.scm v1.6.4-andyjpb-fix-2/openssl.scm --- v1.6.4-andyjpb-fix/openssl.scm 2014-11-23 02:31:54.004264327 + +++ v1.6.4-andyjpb-fix-2/openssl.scm2014-11-23 13:10:43.801483458 + @@ -446,9 +446,9 @@ EOF (outbuf (and outbufmax (fx> outbufmax 0) (make-string outbufmax))) (outbufsize 0) (unbuffered-write - (lambda (buffer) - (when (> (##sys#size buffer) 0) ; Undefined behaviour for 0 bytes! - (let loop ((offset 0) (size (##sys#size buffer))) + (lambda (buffer #!optional (offset 0) (size (##sys#size buffer))) + (when (> size 0) ; Undefined behaviour for 0 bytes! + (let loop ((offset offset) (size size)) (let ((ret (ssl-call/timeout 'ssl-write (lambda () (ssl-write ssl buffer offset size)) @@ -484,7 +484,7 @@ EOF (when (startup #t) (if outbuf (begin -(unbuffered-write (substring/shared outbuf 0 outbufsize)) +(unbuffered-write outbuf 0 outbufsize) (set! outbufsize 0))) (set! out-open? #f) (shutdown))) @@ -492,7 +492,7 @@ EOF (lambda () (when outbuf (startup) -(unbuffered-write (substring/shared outbuf 0 outbufsize)) +(unbuffered-write outbuf 0 outbufsize) (set! outbufsize 0))) (##sys#setslot in 3 "(ssl)") (##sys#setslot out 3 "(ssl)") - Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF diff -upr v1.6.4/openssl.scm v1.6.4-andyjpb-fix-2/openssl.scm --- v1.6.4/openssl.scm 2014-11-23 00:07:52.324097414 + +++ v1.6.4-andyjpb-fix-2/openssl.scm 2014-11-23 13:10:43.801483458 + @@ -45,7 +45,7 @@ ##sys#check-string ##sys#expand-home-path)) -(use srfi-18 tcp) +(use srfi-13 srfi-18 tcp) #> #include @@ -442,43 +442,58 @@ EOF "SSL read timed out"))) buffer (out - (let* ((outbufsize (tcp-buffer-size)) - (outbuf (and outbufsize (fx> outbufsize 0) "")) - (output - (lambda (buffer) - (startup) - (when (> (##sys#size buffer) 0) ; Undefined behaviour for 0 bytes! - (let loop ((offset 0) (size (##sys#size buffer))) + (let* ((outbufmax (tcp-buffer-size)) + (outbuf (and outbufmax (fx> outbufmax 0) (make-string outbufmax))) + (outbufsize 0) + (unbuffered-write + (lambda (buffer #!optional (offset 0) (size (##sys#size buffer))) + (when (> size 0) ; Undefined behaviour for 0 bytes! + (let loop ((offset offset) (size size)) (let ((ret (ssl-call/timeout 'ssl-write (lambda () (ssl-write ssl buffer offset size)) fd (tcp-write-timeout) "SSL write timed out"))) (when (fx< ret size) ; Partial write (loop (fx+ offset ret) (fx- size ret) + + (define (buffered-write data #!optional (start 0)) + (let* ((size (- (##sys#size data) start)) + (to-copy (min (- outbufmax outbufsize) size)) + (left-over (- size to-copy))) + + (string-copy! outbuf outbufsize data start (+ start to-copy)) + (set! outbufsize (+ outbufsize to-copy)) + + (if (= outbufsize outbufmax) + (begin + (unbuffered-write outbuf) + (set! outbufsize 0))) + + (if (> left-over 0) + (buffered-write data (+ start to-copy) + (make-output-port ;; write (lambda (buffer) + (startup) (if outbuf - (begin - (set! outbuf (string-append outbuf buffer)) - (when (fx>= (string-length outbuf) outbufsize) - (output outbuf) - (set! outbuf ""))) - (output buffer))) + (buffered-write buffer) + (unbuffered-write buffer))) ;; close (lambda () (when (startup #t) (if outbuf - (begin - (output outbuf) - (set! outbuf ""))) + (begin + (unbuffered-write outbuf 0 outbufsize) + (set! outbufsize 0))) (set! out-open? #f) (shutdown))) ;; flush (lambda () (when outbuf - (output outbuf) - (set! outbuf ""))) + (startup) + (unbuffered-write outbuf 0 outbufsize) + (set! outbufsize 0))) (##sys#setslot in 3 "(ssl)") (##sys#setslot out 3 "(ssl)") ;; first "reserved" slot ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/ma
Re: [Chicken-users] OpenSSL egg option defaults poll
On 23/11/14 10:32, Mario Domenech Goulart wrote: > Hi Andy, > > On Sun, 23 Nov 2014 02:57:09 +0000 Andy Bennett > wrote: > >> + Introduces a dependency on srfi-13 for the string-copy! and >> substring/shared procedures. This is so that we can do buffer >> management with the minimal of excess copying and garbage >> collection. > > Beware that: > > * string-copy! is currently broken for some cases in CHICKEN. Master has > a fix (6b36695d94e0bd977e0d85d48438f621128e1101), but it has net been > released yet. Thanks Mario! I've looked at that patch: it seems to only affect overlapping buffers. I think, in the openssl case, the private buffer is always distinct from the user buffer. Can anyone think of any cases where that wouldn't be the case? > * substring/shared is the same as substring in CHICKEN, AFAIK. That's only called once in the corner cases so it doesn't really matter if it wastes a copy. It's just there to stop junk in the tail of the buffer being sent to the user. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] OpenSSL egg option defaults poll
Hi, > IIRC we were waiting for andyjpb and company to fix the breakage introduced > by the buffering patch so we could pull in current upstream and then push > the patches or something ... Please find attached a patch to v1.6.4 of the openssl egg. This patch: + Ensures that startup is called once, with the correct "called-from-close" flag in each of the write, close and flush procedures. I think "flush" is always called when the port is supposed to be open. + Introduces a dependency on srfi-13 for the string-copy! and substring/shared procedures. This is so that we can do buffer management with the minimal of excess copying and garbage collection. + Reworks the buffered write logic to ensure that we always flush the buffer in full chunks apart from during the close and flush procedures where we just write whatever is left. I've done a minimal amount of testing and it seems to work. It seems to produce files with the same md5sum as the version without the patch so I don't think it corrupts the data. i.e. I think the buffer handling is correct. On my local machine I can't measure a speedup when downloading a static, 178MiB file or a 3.9MiB file generated with SXML / waffle, both via spiffy.. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF diff -upr v1.6.4/openssl.import.scm v1.6.4-andyjpb-fix/openssl.import.scm --- v1.6.4/openssl.import.scm 2014-11-23 02:37:31.235897645 + +++ v1.6.4-andyjpb-fix/openssl.import.scm 2014-11-23 02:13:16.085352751 + @@ -1,6 +1,6 @@ openssl.import.scm - GENERATED BY CHICKEN 4.9.0rc1 -*- Scheme -*- -(eval '(import scheme chicken foreign ports srfi-18 tcp)) +(eval '(import scheme chicken foreign ports srfi-13 srfi-18 tcp)) (##sys#register-compiled-module 'openssl (list) Binary files v1.6.4/openssl.import.so and v1.6.4-andyjpb-fix/openssl.import.so differ diff -upr v1.6.4/openssl.scm v1.6.4-andyjpb-fix/openssl.scm --- v1.6.4/openssl.scm 2014-11-23 00:07:52.324097414 + +++ v1.6.4-andyjpb-fix/openssl.scm 2014-11-23 02:31:54.004264327 + @@ -45,7 +45,7 @@ ##sys#check-string ##sys#expand-home-path)) -(use srfi-18 tcp) +(use srfi-13 srfi-18 tcp) #> #include @@ -442,11 +442,11 @@ EOF "SSL read timed out"))) buffer (out - (let* ((outbufsize (tcp-buffer-size)) - (outbuf (and outbufsize (fx> outbufsize 0) "")) - (output + (let* ((outbufmax (tcp-buffer-size)) + (outbuf (and outbufmax (fx> outbufmax 0) (make-string outbufmax))) + (outbufsize 0) + (unbuffered-write (lambda (buffer) - (startup) (when (> (##sys#size buffer) 0) ; Undefined behaviour for 0 bytes! (let loop ((offset 0) (size (##sys#size buffer))) (let ((ret (ssl-call/timeout @@ -455,30 +455,45 @@ EOF fd (tcp-write-timeout) "SSL write timed out"))) (when (fx< ret size) ; Partial write (loop (fx+ offset ret) (fx- size ret) + + (define (buffered-write data #!optional (start 0)) + (let* ((size (- (##sys#size data) start)) + (to-copy (min (- outbufmax outbufsize) size)) + (left-over (- size to-copy))) + + (string-copy! outbuf outbufsize data start (+ start to-copy)) + (set! outbufsize (+ outbufsize to-copy)) + + (if (= outbufsize outbufmax) + (begin + (unbuffered-write outbuf) + (set! outbufsize 0))) + + (if (> left-over 0) + (buffered-write data (+ start to-copy) + (make-output-port ;; write (lambda (buffer) + (startup) (if outbuf - (begin - (set! outbuf (string-append outbuf buffer)) - (when (fx>= (string-length outbuf) outbufsize) - (output outbuf) - (set! outbuf ""))) - (output buffer))) + (buffered-write buffer) + (unbuffered-write buffer))) ;; close (lambda () (when (startup #t) (if outbuf - (begin - (output outbuf) - (set! outbuf ""))) + (begin + (unbuffered-write (substring/shared outbuf 0 outbufsize)) + (set! outbufsize 0))) (set! out-open? #f) (shutdown))) ;; flush (lambda () (when outbuf - (output outbuf) - (set! outbuf ""))) + (startup) + (unbuffered-write (substring/shared outbuf 0 outbufsize)) + (set! outbufsize 0))) (##sys#setslot in 3 "(ssl)") (##sys#setslot out 3 "(ssl)") ;; first "reserved" slot Only in v1.6.4-andyjpb-fix/: openssl.scm~ Only in v1.6.4-andyjpb-fix/: .openssl.scm.swp Binary files v1.6.4/openssl.so and v1.6.4-andyjpb-fix/openssl.so differ Binary files v1.6.4/openssl-static.o and v1.6.4-andyjpb-fix/openssl-static.o differ ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] OpenSSL egg option defaults poll
Hi, Thanks for this Thomas! > I'd be glad if some of you could test this out and tell me what you > think about it :-) Can you give some tips for how to test this from a spiffy applications? I usually just pass in ssl-accept instead of tcp-accept. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [PATCH 4/4] openssl: disable interrupts
Hi, > Disable scheduling in order to prevent error checking races between threads. > --- > > Well, I still don't have a clue whether disabling interrupts is actually a > bad idea somehow, but I don't see any easy way to rewrite the code to avoid > preemptive context switches that could screw up the error checking code > paths. Does this have any performance implications? Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] OpenSSL egg option defaults poll
Hi, > IIRC we were waiting for andyjpb and company to fix the breakage introduced > by the buffering patch so we could pull in current upstream and then push > the patches or something ... Oops... sorry. I can't find the mail relating to the details of the breakage. Please can someone remind me and I'll look into it. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] OpenSSL egg option defaults poll
Hi, > Despite many valid reasons for keeping the old ones activated, I'd like > to see the old Versions dropped from the default setting. The longer > people keep them around the longer they will stay. Without my "running an actual webserver hat" on, I think I agree. Having said that, even with my "running an actual webserver hat" on, I suspect most of the problems will be on the http-client side. > Also I'd explicitly > turn *on* certificate verification, as painful as this may be. If the > ssl egg silently accepts invalid certificates it creates a false sense > of security to the user. If someone needs all these features they know > that and will turn them back on. I definitely agree with this and certainly in this case, most of the problems will occur on the http-client side rather than the spiffy side. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] OpenSSL egg option defaults poll
Hi, >> [...] >> Having said that, I'm not sure which clients on which operating systems >> are SSL 3.0 only. >> [...] Having read a bit more... I suspect (infer) that IE6 and possibly more things on Windows XP are the client side problems. I also suspect (infer) that the "SSL 3.0 only" (no TLS) problems are with old web *servers* rather than a proliferation of clients other than IE6. > if I understand the situation correctly, almost nobody uses SSLv3 since > it was quickly superseded by the newer TLS variants. But the initial > connection setup is similar between SSLv2 and SSLv3, while for TLS it is > entirely different and usually one uses the SSLv2 variant with > additional information that TLS is supported, if the other endpoint also > supports TLS, the protocol will then be upgraded. You can tell OpenSSL > to support only SSLv2, only SSLv3, only TLS or all three variants > together. But you cannot specifically exclude SSLv3 and still allow > SSLv2 and TLS. Thanks for the extra details. AIUI, SSLv2 and SSLv3 are more different to each other than SSLv3 and TLS1.0 ...but I suspect that's because I'm mostly familiar with the "SSLv2 variant with additional information that TLS is supported". >> [...] >> Have you seen this article by Google about TLS_FALLBACK_SCSV? >> [...] > > Yes. Whether that security measure is supported depends on the version > of the underlying SSL library, I think it is incorporated in OpenSSL > 1.0.1j. I'm unsure whether anything special needs to be done to activate > the feature. I wonder if there's a test site that will connect to a webserver and tell you if it supports that? > Personally, I think the big mess of SSL/TLS protocol versions, extension > features and cipher suites is so hideously complex by now that there > will always be some more hidden vulnerabilities %-] For anything truly > security critical I would try to use an alternative protocol with a less > convoluted design and with stronger default crypto algorithms. I agree. We'd like to run a good-and-proper SSL service but I think we'd rather run a highly compatible service when we have a choice. This trade-off starts to make sense when you take into consideration all the potential vulnerabilities that exist in even the newer versions. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] OpenSSL egg option defaults poll
Hi Thomas! > So I would like to poll for opinions from people on this list concerning > this situation. Do you think the default options in the OpenSSL egg > should be "hardened"? Do you think more options should be introduced? Is > compatibility with the rest of the internet a concern at all? ;-) We run Spiffy with SSL on our live site at https://www.knodium.com/ Our users are typically in educational environments where the provided software is not always of the latest version so we'd like to have as wide support as possible for clients that might visit our site. Having said that, I'm not sure which clients on which operating systems are SSL 3.0 only. In this case we're using OpenSSL on the server side (http-client may differ) and given that we control what we use there, the thing that matters is the population of web browsers that require SSL 3.0 in order to work with HTTPS sites. Have you seen this article by Google about TLS_FALLBACK_SCSV? http://googleonlinesecurity.blogspot.co.uk/2014/10/this-poodle-bites-exploiting-ssl-30.html More info: https://www.openssl.org/~bodo/ssl-poodle.pdf https://tools.ietf.org/html/draft-ietf-tls-downgrade-scsv-00 Again, I'm not sure which clients support that yet, especially amongst the older ones which do support TLS but are still old and therefore might not get updates. This approach doesn't work unless both sides support it. >From the Google article it sounds like it might be worth us implementing TLS_FALLBACK-SCSV and waiting to hear the results of the test in which they disable SSL 3.0. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] looking for name of an egg
Hi, > I remember reading about an egg that, among other things, had a > function that included/loaded a source file depending whether the > code was compiled/interpreted. > I cannot find the name of this egg, does somebody here know it? Was it the system egg or the autoload egg? http://api.call-cc.org/doc/system/ http://api.call-cc.org/doc/autoload Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] [ANN] spiffy-cgi-handlers Egg Version 0.4 Released
Hi, I've released version 0.3 of the spiffy-cgi-handlers egg. spiffy-cgi-handlers adds support to spiffy for CGI and derivatives (currently only FastCGI). 0.3 reworks the FCGI header parsing to fix spurious line break issues. For more information see the Egg's wiki page: http://wiki.call-cc.org/eggref/4/spiffy-cgi-handlers Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] posix-extras: allow to set process title displayed by ps(1)
Hi, Alex has worked on a version that keeps track of the original argv[0] length: - (define (set-proc-title str) (print "setting proc title to " str) (receive (c v) (argc+argv) ((foreign-lambda* void ((c-string str) (c-pointer argv)) "static int orig_len = -1; char *name = ((char**) argv)[0]; if (orig_len == -1) orig_len = strlen(name); strncpy(name,str,orig_len); ") str v))) - Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] posix-extras: allow to set process title displayed by ps(1)
Hi, Alex Charlton & I worked through how to set the process name as displayed by ps(1). This might be a useful addition to the posix-extras egg. - (define (set-proc-title str) (receive (c v) (argc+argv) ((foreign-lambda* void ((c-string str) (c-pointer argv)) "char *name = ((char**) argv)[0]; strncpy(name,str,strlen(name)); ") str v))) - The actual implementation above is the work of Alex. The implementation only allows to set the title to a string less than or equal to the thing it's currently set to. This is fine for a single call at fork() time: it's not possible to get a longer title using this method anyway. If a process wants to use the entirety of the buffer for any call, even if the current value is shorter than the buffer then some extra magic will be needed, such as stashing the original value in a static variable or padding the passed in value with spaces. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Use Chicken 3 egg in 4
Hi, > is it possible to use a Chicken 3 egg like the the SMTP client in > Chicken 4? I can not find the SMTP client in the version 4 eggs. hato might be useful for you: http://code.google.com/r/datenhobel-hato-egg-update/ It's an out-of-tree egg but it works with Chicken 4. You might have to tweak the build system: use "chicken-install" but always use "make clean" between successive invocations of "chicken-install". We use hato-smtp here with several of the other modules commented out from the build and a patch for the path to the "sendmail" binary. I can send you what we have if you can't get it to work. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] [ANN] New multipart-form-data Egg
Hi everyone, I've written an egg that can decode multipart/form-data HTTP requests. I've been using if for about a week on https://www.knodium.com/ . The functionality is not complete yet but I thought I'd put it out there in case it's useful to anyone else. Comments on the API are welcome! http://wiki.call-cc.org/eggref/4/multipart-form-data Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] irregex and callbacks
Hi, > You could use submatch info and check which submatch matched. > This would keep the matching as a single regexp, but you'd then > need a linear scan to see which submatch succeeded. Thanks Alex! I'm trying to avoid the linear scan as there are several tens of thousand entries in the database. How expensive do you think it would be? > (define (irregex-merge-vector vec) > (irregex `(or ,@(map (lambda (x) `(=> alt ,x)) (vector->list vec) > > (define ua-vec ...) > (define all-ua-rx (irregex-merge-vector ua-vec)) > > (define (maybe-match-ua ua) > (cond > ((irregex-match all-ua-rx ua) > => (lambda (m) > (vector-reg ua-vec (irregex-match-numeric-index 'match-ua m > '(alt) > (else > #f))) > > although I believe irregex-match-numeric-index is not exported. > It's worth having a utility for this idiom. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] irregex and callbacks
Hi, I am trying to use the browscap.org database to do HTTP User Agent Classification. This database consists of a (large) number of regexes and data about the browser should the user agent string match that regex. What I want to do is compile all the regexes together and be able to add annotations such that I can match a UA string against this regex and get back an idea of which pattern matched so that I can look up the appropriate data. i.e. I have a data structure keyed by "pattern" and I want to my input to be something that matches that pattern rather than the pattern itself. It seems that for this I need "Callbacks" but I don't really need full callback support: I don't necessarily need to call an actual procedure and I don't need to replace anything: I'm not doing a search/replace, just a match. "All" I really need is to be able to annotate the FSM node that matched with a little bit of data that I can get back. Is this something that would be easy to add to irregex or can anyone suggest any other alternative implementations that I might consider? The PHP library that uses this browscap database (apparently) just does a linear search by trying to match each regex in turn but I'd rather keep that approach as a last resort. Thanks for your help and any tips you can offer. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Parsing Simple Markup
Hi, > Actually due to the possible presence of nested commands, it should > probably be something more generic, since in the last example: > > (bold (smallcap (size 2 "text"))) > > what the procedure 'bold' would be taking in is not a string "text", but > rather an expression...so this is where I guess things would need to be > recursive. The evaluation rules will evaluate things in the "correct" order. So (size 2 "text") will be evaluated first, then (smallcap <>) and then (bold <>). It's deliberately unspecified in which order 2 or "text" will be evaluated in. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Parsing Simple Markup
Hi, > I am a new user to Scheme in general and to Chicken in particular, nice > to meet you all. Welcome! > A few examples of what I am trying to parse: > > 1. Tags that identify structural elements of a document: > [chapter] "Chapter Title" > [heading1] "Heading Title" > [list] > ... > [end] > > [quote] > ... > [end] > > 2. Tags that identify formatting of text: > ;single formatting command with no value > ; formatting command with a value > nce upon a time > ;a command group which has multiple > formatting commands enclosed within <...<. > > A command group can be singular: > > <...< > > or have multiple commands separated by commas: > > <...,...,...,< > > the closing > signalling the end of the command group. This is not entirely dissimilar to Markdown so I'd echo Peter's advice to check out lowdown, the CHICKEN Markdown implementation, and comparse, the parser library lowdown is implemented in. I'll also point you to the eMail address parsing egg: http://api.call-cc.org/doc/email-address which is another example of a parser written with comparse. It's interesting because, unlike lowdown, it implements a parser for just a small number of things: eMail addresses and lists of eMail addresses. comparse is a parser combinator library. This means that you specify parts of your grammar / language and a procedure which can parse that thing is returned. You then combine these parsers to produce other parsers that, for example, can parse "X then Y", "X or Y", "X then Y then Y", etc. It takes a couple of hours to wrap your head around it but it's very powerful. The email-address parser is build up starting from sets of characters and resulting in two procedures: one that parses and eMail address and one that parses a "sequence of eMail address". > The idea is to make typesetting with Groff very simple and intuitive for > any user - not just programmers and hackers. The markup we are working > on is called Typesetting Markup Language (TML). So it would convert > html-like commands and generate a Groff document from it. comparse allows to take your results and give them as arguments to other procedures. In the eMail address egg I use this to populate an internal data type that represents an eMail address. You could use an intermediate data type like this or you could try to write a number of different procedures which immediately output the parsed thing in the required format. > Right now I am trying to do a prototype which generated Groff in the > backend, but the idea is to have a general purpose markup that could > also be used to generate LaTex/Contex, HTML xml etc ...it's probably best to generate an intermediate format then. The lowdown egg generates "SXML" which can easily be rendered down to HTML. SXML is an s-expression representation of the tree structure of XML. See here for an illustration of SXML: http://www.more-magic.net/posts/lispy-dsl-sxml.html > In Perl I am able to do most of this with regular expressions, but I'm > hitting my head against the wall when it comes to multiple formatting > commands within a group <...,...,...< In comparse something like Also to noteI am NOT a programmer of developer - I am a hobbyist and > doing this for fun! It looks like you're on the right tracks. > My idea was that I could read a line of text from a file at a time. My > understanding is that the input would be read into an "s-expression" > (which I understand to basically be a list). Then could "car" the first > item of the list and match it against my "tags" or "formatting commands" > (which would be defined as something like below) > > (define chapter "[chapter]") > (define list:digit "[list:digit]") > (define list:alpha "[list:alpha]") > (define end-list "[end]") > (define close-command-group ">") > (define command-group-begin "<") > (define command-group-end "<") > (define bold "bold") > (define smallcap "smallcap") > (define dropcap "dropcap") Don't worry about reading the input: let comparse do that for you. Other than that, it looks like the rules you have defined there aren't a million miles from the way comparse would let you specify things. The additional complexity is that compares returns a procedure that you apply to the string or port you want to parse whereas, above, you just have some literals bound to names. Using sequence and sequence* you can apply some parsers and then build up your tree structure from the parsed things. You can then later car / cdr down that structure to do things with it. > This is my first attempt at functional programming so I realize I may > not be approaching this in the best way. You're on the right path: keep going. I'd recommend to forget about the regular expressions for now tho'. Good luck! Let us know how you get on. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https:
Re: [Chicken-users] [SECURITY] Fix select() buffer overrun on Android platform
Hi, > [1] See original vulnerability announcement for details: > http://lists.nongnu.org/archive/html/chicken-users/2012-06/msg00031.html Is the "high-load-scheduler" mentioned in that link still available? I can't seem to find any trace of it in chickadee or the wiki. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Reset counters when profiling Chicken programs
Hi, > That would be great. > Another useful function would be to write current profile information > with a function like (profile-write file). In this way, one could > easily determine what happened between two given profile snapshots. This may not be directly useful to you, but I'm interested in something like what Alaric describes here: http://www.snell-pym.org.uk/archives/2012/12/27/logging-profiling-debugging-and-reporting-progress/ I'm thinking of implementing it as an egg, hopefully within the next few months but a couple of other people have shown an interest as well so I would be very happy to collaborate. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] reading file from post request
Hi, I think Andy mentioned on IRC that he was working on a "proper" multipart parser for Knodium. Maybe he can tell us what the status is on that. It's the #2 thing on my list at the moment. Down from #1 last week. Will probably be a climber tho'. We need it rather urgently so I'll be back on it this week or next. It seems that multipart/form-data is slightly easier to parse than general MIME because of certain conventions which ended up being documented in the HTML 5 spec. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] About Chicken Compiler CSC's Option
Hi, Yeah the Makefile is buggy. Please find my WIP patch attached to this email. This looks more comprehensive than my patch. As I just use hato-smtp.scm I get away without building most of it. I use the datenhobel-hato-egg and my approach is to do "make clean" followed by "chicken-install". chicken-install won't install the egg properly unless you "make clean" beforehand so it's worth always doing both steps. Hato also seems to install a version of lru-cache that is incompatible with the sql-de-lite egg so I always "chicken-install lru-cache" after installing hato. For the bits that won't build or I can't be bothered fighting with dependencies for on all platforms (i3db), I just comment them out in hato.setup. My current commented-out list is: ;; (compile-module hato-i3db) ;; (compile-module hato-imap) ;; (compile-module hato-pop) ;; (compile-module hato-nntp) ;; (compile-module hato-http) ;; (compile-module hato-spf) ;; (compile-module hato-token) ;; (compile-module hato-prob) ;; (compile-module hato-filter-env) ;; (compile-module highlight) ;; (compile-module html-summary) ;; (compile-module wiki-utils) ;; (compile-module wiki-parse) ;; (compile-module wiki-write) ;; (compile-executable hato-fetch) ;; (compile-executable hato-httpd) As I use "chicken-install" to build things I don't need to patch the Makefile. If you need any of that stuff then you're probably better off with Christian's patch: I just use hato-smtp.scm to send mail out. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] bug update-uri in uri-common
Hi, So here's a new poll: a) The current behaviour of resetting port to #f if it's the default port for this scheme is ok. b) The port should not be reset, and the uri should be printed with an explicit port, even if it's the default for this scheme. c) The port should not be reset, but the uri should be printed without port if it's the default for this scheme. Once results are in, I'll adjust the behaviour accordingly, and make a new uri-common release. My vote is for (b) with the caveat that the port should not be printed if it is #f. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] bug update-uri in uri-common
On Friday, 16 May 2014 14:28:51 BST, Andy Bennett wrote: Hi, If anyone on this mailinglist has strong opinions either way, please let yourselves be heard: now's the time to speak up. The existing behaviour seems reasonable as it only does it when setting "scheme", not when setting other parts of the URI: - #;3> (update-uri (uri-reference "http://localhost:8080/";) scheme: 'https) #fragment=#f> #;4> (update-uri (uri-reference "http://localhost:8080/";) fragment: "test") #fragment="test"> - Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] bug update-uri in uri-common
Hi, If anyone on this mailinglist has strong opinions either way, please let yourselves be heard: now's the time to speak up. If there was a vote then I'd vote to preserve an explicit port setting but dynamically choose the correct one, based on "scheme", when port is #f. I don't think we (Knodium) rely on the current behaviour. We do use the "domain canonicalisation" examples: http://api.call-cc.org/doc/spiffy#sec:Redirecting_to_another_domain The latter one is reasonably robust in the face of both the current behaviour and KLM's proposed behaviour. The former one is not. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [ANN] New egg: glls
Hi, > I'm pleased to announce glls Wow! Nice. :-) Good work. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] [ANN] rest-bind Egg Version 0.5 Released
Hi, I've released version 0.5 of the rest-bind egg. rest-bind Generates wrappers to REST-like HTTP APIs. 0.5 Provides a bugfix for the ordering of the bound arguments which manifests when binding more than one argument. The manual is up-to-date and in the usual place: http://wiki.call-cc.org/eggref/4/rest-bind Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] html->sxml (html-parser egg) does not decode entities in html attributes, ideas why?
Hi, Empty attributes now seem to decode to the string "()". Fixed. Thanks! :-) That works for me now: - #;4> (html->sxml empty) (*TOP* (div (@ (data "")) "empty")) - During " deserialisation when inside an attribute, we seem to get data from earlier in the stream introduced: I couldn't reproduce this. Could you check with the latest fix? Which CHICKEN are you using? I can reproduce it with 0.5.2 on 4.9.0rc1: - #;5> (html->sxml content) (*TOP* (br) "\r\n" (br) "\r\n" (div (@ (data "(sxml (@ (attr \"\r\nbr\r\nbr12345\"\r\nbr\r\nbr)) body)")) "div body")) - ...but not with 0.5.2 on 4.8.0.4. - #;4> (html->sxml content) (*TOP* (br) "\r\n" (br) "\r\n" (div (@ (data "(sxml (@ (attr "12345")) body)")) "div body")) - With 0.5.3 on 4.9.0rc1 it seems to work: - #;5> (html->sxml content) (*TOP* (br) "\r\n" (br) "\r\n" (div (@ (data "(sxml (@ (attr \"12345\")) body)")) "div body")) - ...but perhaps it's worth chasing this down a bit further? Thanks for all your help with this. :-) Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] html->sxml (html-parser egg) does not decode entities in html attributes, ideas why?
Hi, Thanks for your email. I'm somewhat confused by what you say. Through investigation, it seems html->sxml will decode entities, so long as they aren't within a HTML element attribute. Could you clarify on whether that default applies globally or just to attributes? Yes, sorry, I misread my own code :) The default is to _decode_ entities: #;1> (html->sxml """) (*TOP* "\"") And as you say, it currently doesn't just process attributes: #;2> (html->sxml "") (*TOP* (div (@ (data-foo """ I'll fix this. Thanks for this Alex and sorry for taking so long to come back to you. When Philip first reported this we were running html-parser 0.5.0 on CHICKEN 4.7.0. We're currently upgrading to CHICKEN 4.9.0 and we were trying the latest html-parser, version 0.5.2. Unfortunately we've had a couple of problems: one with empty attributes and another that seems a bit more sinister. html-parser 0.5.0 works on both 4.7.0 and 4.9.0. html-parsers 0.5.1 and 0.5.2 don't work on either 4.7.0 or 4.9.0 so I've isolated the problem to changes introduced in 0.5.1. Empty attributes now seem to decode to the string "()". During " deserialisation when inside an attribute, we seem to get data from earlier in the stream introduced: (define empty "empty") (define content "\r\n\r\n"12345")) body)\">div body") 0.5.0 - #;> (html->sxml empty) (*TOP* (div (@ (data "")) "empty")) #;> (html->sxml content) (*TOP* (br) "\r\n" (br) "\r\n" (div (@ (data "(sxml (@ (attr "12345")) body)")) "div body")) 0.5.1 - #;> (html->sxml empty) (*TOP* (div (@ (data "()")) "empty")) #;> (html->sxml content) (*TOP* (br) "\r\n" (br) "\r\n" (div (@ (data "(sxml (@ (attr \"\r\nbr\r\nbr12345\"\r\nbr\r\nbr)) body)")) "div body")) The data in attr seems to be taken from data elsewhere: #;> (html->sxml "\r\n\r\n"12345")) body)\">div body") (*TOP* (first "\r\n" (br) "\r\n" (second) (div (@ (data "(sxml (@ (attr \"second\r\nbr\r\n12345\"second\r\nbr\r\n)) body)")) "div body"))) Thanks for all your help maintaining this and, once again, sorry it took so long for us to put your newer versions into our code. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] [ANN] spiffy-cgi-handlers Egg Version 0.2 Released
Hi, I've released version 0.2 of the spiffy-cgi-handlers egg. spiffy-cgi-handlers adds support to spiffy for CGI and derivatives (currently only FastCGI). 0.2 adds support to fcgi-handler (the module that provides FastCGI support) for the non-blocking sockets produced by the socket egg in version 0.2.3 and later. 0.2 also includes the query string, as well as the path, in fcgi-handler's REQUEST_URI. For more information see the Egg's wiki page: http://wiki.call-cc.org/eggref/4/spiffy-cgi-handlers Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] [ANN] rest-bind Egg Version 0.4 Released
Hi, I've released version 0.4 of the rest-bind egg. rest-bind Generates wrappers to REST-like HTTP APIs. 0.4 makes the support for APIs that have constant path-fragments after the arguments generally available. This has been sitting in trunk since last July and no one seems to have had any problems with it. For more information on the new functionality see Example 3: http://wiki.call-cc.org/eggref/4/rest-bind#examples Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] CHICKEN 4.9.0rc1 is available
Hi, > The Knodium codebase also seems to build and run. > A few cursory tests suggest that it's OK but I'll stick with it for a > while and let you know how it goes. https://www.knodium.com/ is now running with binaries built from CHICKEN 4.9.0rc1 Performance seems similar to that of the 4.7.0 binaries which we were using previously. In order to get this deployed we had to fix some things in the spiffy-cgi-handlers egg relating to changes in versions of the socket egg newer than 0.2.2. We had been using 0.2.2 previously but the new egg install fetched in 0.2.5 which creates sockets with non-blocking file descriptors. FastCGI expects a regular, blocking, file descriptor. I guess this is something to be aware of in all cases where a file descriptor is passed from a CHICKEN process to another (i.e. via fork/exec). We also had to fix the dropbox egg where it calls alist-ref. Some time after CHICKEN 4.7.0 it became mandatory to pass a well formed alist to alist-ref but we were relying on it returning the default value. I've tagged and released new versions of both of these eggs and will be sending out an announcement for the spiffy-cgi-handlers egg when I'm sure it's reached all the egg mirrors. As I've (still) not written documentation for the dropbox egg I won't officially announce it but people are welcome to try it and I'll do my best to help them with it. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [PATCH] Re: 4.9.0rc1: Error: (assv) bad argument type: null
Hi, > + (assert-error (alist-ref 'foo 'bar cmp)) > + (assert-error (alist-ref 'foo '(bar) cmp))) What's a good predicate to use to check whether what will be passed to alist-ref will not throw an exception? The 2nd assert-error rules out a simple list? or an O(1) algorithm. (Tho' list? is already O(n)). Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [Chicken-hackers] 4.9.0rc1: Error: (assv) bad argument type: null
Hi, > The error on 4.9.0rc1 is likely due to 0a52536, which made `assoc`, > `member` et al. signal errors when their second arguments aren't lists > instead of just returning #f (or the sentinel value). This is new > behavior since 4.7.0, and IIRC there were a couple of places in CHICKEN > itself that required updating after this change too, since they were > also relying on these cases returning #f. > > Anyway, when passed `eqv?` as a comparator *before* importing numbers, > `alist-ref` uses CHICKEN's built-in `assq` for the search, including > this new behavior. *After* importing numbers, however, you're really > passing the numbers extension's version of `eqv?`, which `alist-ref` > doesn't take as a signal to use the built-in `assq` and instead falls > back to a search function that matches the pre-0a52536 (i.e. 4.7.0) > behavior and returns #f/the sentinel value. Thanks for the detailed reply Evan! :-) Of course, my code is wrong but it was the inconsistent behaviour with and without numbers that I was worried about. I shall change my code to be correct. This should mean that I will be able to use 4.9.0rc1 to build working binaries for Knodium that I will deploy at https://www.knodium.com/ Are the CHICKEN web services currently built with 4.9.0rc1? > @ -hackers: I think `alist-ref`'s fallback search function should match > the behavior of core's versions. Objections? I agree. Thanks for the patch Peter. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] 4.9.0rc1: Error: (assv) bad argument type: null
Hi, I have some code thus: - (define p (lambda (m state) (printf "m: ~S\nstate: ~S\n\n" m state) (let ((k (car m)) (v (cdr m))) (case k ((team) (append `((team/name . ,(alist-ref 'name v eqv? 'sentinel))) state)) (else (cons `(,k . ,v) state)) (pp (p '(team . null) '())) - On 4.7.0 I see this: - $ csi -ns x.scm m: (team . null) state: () ((team/name . sentinel)) - On 4.9.0rc1 I see this: - $ csi -ns x.scm m: (team . null) state: () Error: (assv) bad argument type: null Call history: (pp (p (quote (team . null)) (quote ( (p (quote (team . null)) (quote ())) (quote (team . null)) (##core#quote (team . null)) (quote ()) (##core#quote ()) (pp (p (quote (team . null)) (quote ( (p (quote (team . null)) (quote ())) [p] (printf "m: ~S\nstate: ~S\n\n" m state) [p] (car m) [p] (cdr m) [p] (eqv?8 tmp5 (quote team)) [p] (append (quasiquote ((team/name unquote (alist-ref (quote name) v eqv? (quote sentinel) state) [p] (##sys#list (##sys#cons (##core#quote team/name) (alist-ref (quote name) v eqv? (quote sentinel [p] (##sys#cons (##core#quote team/name) (alist-ref (quote name) v eqv? (quote sentinel))) [p] (alist-ref (quote name) v eqv? (quote sentinel)) <-- - However, if I add "(use numbers)" at the top of my script: - (use numbers) (define p (lambda (m state) (printf "m: ~S\nstate: ~S\n\n" m state) (let ((k (car m)) (v (cdr m))) (case k ((team) (append `((team/name . ,(alist-ref 'name v eqv? 'sentinel))) state)) (else (cons `(,k . ,v) state)) (pp (p '(team . null) '())) - ...it works on 4.9.0rc1: - $ csi -ns x.scm m: (team . null) state: () ((team/name . sentinel)) - More information about the purpose of the code: The example is code derived from my development version of the dropbox egg. The code tries to munge the hierarchical JSON returned from the dropbox API. There's usually another branch of the case statement thus: ((quota_info) (append `((quota_info/normal . ,(alist-ref 'normal v)) (quota_info/shared . ,(alist-ref 'shared v)) (quota_info/quota . ,(alist-ref 'quota v))) state)) ...which shows the intention more clearly. We are taking nested alists and flattening them out, with keys delimited by a "/" character. Sometimes the data returned by the API is 'null rather than a list. This is the common case for the "team" key. I haven't tried CHICKEN 4.8. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] CHICKEN 4.9.0rc1 is available
Hi, Please, give it a test and report back to the mailing list your findings. Here's a suggested test procedure: $ make PLATFORM= PREFIX= install check $ /bin/chicken-install pastiche I'm happy to report that this works for me. If you can, please let us know the following information about the environment you tested the RC tarball on: Operating system: (e.g., FreeBSD 10.0, Debian 7, Windows XP mingw-msys) Linux Debian 7.0ish. Hardware platform: (e.g., x86, x86-64, PPC) amd64 on an i5 C Compiler: (e.g., GCC 4.8.1, clang 3.0-6.2) gcc (Debian 4.7.2-5) 4.7.2 Installation works?: yes or no yes Tests work?: yes or no yes Installation of eggs works?: yes or no yes The Knodium codebase also seems to build and run. A few cursory tests suggest that it's OK but I'll stick with it for a while and let you know how it goes. Thanks for all the hard work peeps! It's looking like a really good release. :-) Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Tools to make a graphviz dot map of a scheme program?
Hi, > I made a hack to try this out and although very interesting the output > (i) is crude. The script itself (ii) is an awful mess. > > Somehow though it seems to me there could be some useful insight to be > gained from something visual like this and I imagine it has been done > before. Any pointers to nice ways to visualize scheme code would be > appreciated. I poked around in Google land but didn't find quite what I > was looking for. Have you seen Scratch? It strikes me that it'd be "easy" to do a scheme implementation. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Wiki design
Hi, >> I hope you like it. If you don't, please let me know how I could do a >> better job! Thanks in advance! > > I have to say, I like it! Thanks for the suggestion! What do the > others think? Yes! This looks great! Thanks Arthur! The only thing I notice is that the show/edit/history links on the right hand side are still in their "old" styling. Everything else looks spiffy: https://wiki.call-cc.org/eggref/4/spiffy Good work! :-) Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] trying to gracefully stop threads
On 07/12/13 19:23, Michael Greenly wrote: > I've been trying to learn how threads work but have become a bit stumped > by this example: > > https://gist.github.com/mgreenly/7847072#file-graceful-scm > > My assumption is that the thread would be started and recurs until done > becomes false at which time that thread would exit cleanly and allow the > join in the primary thread to continue. > > The 'done' flag only becomes false when INT is signaled and handled > > Instead I get a "Error: uncaught exception: # (join-timeout-exception)>". > > This implies to me that INT is killing the thread t1 and the primary > thread raises the join-timeout becuase t1 no longer exists? With interpreted code (csi) I get the rather bizzare - Error: uncaught exception: # graceful termination - With compiled code (csc) I get - Error: uncaught exception: # - Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] trying to gracefully stop threads
Hi, > I've been trying to learn how threads work but have become a bit stumped > by this example: > > https://gist.github.com/mgreenly/7847072#file-graceful-scm Also, beware bug #1067 when using 'done' like this in compiled code: http://bugs.call-cc.org/ticket/1067 Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] go routines for chicken
Hi, > However, the Go runtime will exploit OS-level threads under the hood if a > goroutine blocks, and Chicken will not. If you're not using the FFI and the Chicken runtime blocks due to a SRFI-18 thread blocking then, AIUI, there is a bug in Chicken. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Turn on profiling and app panics with out of memory - can profiling work if using iup gui?
Hi, > Before I spend a lot of time debugging this I wanted to ask the list if > it should be expected to work. I know the iup egg uses that trampoline > stuff, is this likely to be a problem for the profiler? > > I'm using chicken 4.8.0. > > [panic] out of memory - heap full while resizing - execution terminated A number of issues which cause this error have been fixed in trunk versions of Chicken. IIRC, some things went into 4.8.0.5 and some were later. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] [Chicken-hackers] Redefinition of imported binding gets implicitly exported
Hi, > I looked into this recently since it also seemed like a bug to me, but > the behavior seems to be intentional judging from the code. Even if the behaviour is intentional, there is possibly still a bug. This worked find on my own machine but failed on others so the implicit ordering of something somewhere seems to matter. > A workaround is to exclude `process` from the import list in `m` (as in > `(import (except posix ...))`) -- this prevents the behavior you're > seeing, at least. I need is in some places tho', and if it's used anywhere in a program, it takes over the binding everywhere and seems to become implicitly available everywhere. > When `##sys#alias-global-hook` is used to resolve an identifier name for > an assignment, it's called with the already-looked-up name from the > environment and shortcuts when that identifier is already aliased, > returning the imported name (in this case, the built-in `process`) > rather than a new, module-prefixed identifier that would shadow the > binding like you said. > > It seems to me that when `##sys#alias-global-hook` is used to resolve > names for `set!` forms, it should be called with the bare > (pre-se-lookup) identifier, and when `assign` is true and you're > currently in a module it should always create a module-prefixed > identifier and update the environment, instead of returning the existing > alias for imported symbols. But, I couldn't get this to work without > breaking other things. > > CC'ing -hackers. > > Evan > > ___ > Chicken-hackers mailing list > chicken-hack...@nongnu.org > https://lists.nongnu.org/mailman/listinfo/chicken-hackers Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Redefinition of imported binding gets implicitly exported
Hi, > I get the wrong binding for process when I (use m): > > - > #;1> (use m) > ; loading ./m.import.so ... > ; loading ./m.so ... > #;2> (process) > hello > - Of course... I was expecting the posix unit's binding for process: - #;1> (use posix) ; loading library posix ... #;2> process # #;3> (use m) ; loading ./m.import.so ... ; loading ./m.so ... #;4> process # #;5> (process) hello - Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Redefinition of imported binding gets implicitly exported
Hi, With the following in m.scm: - (module m (do-something) (import chicken scheme) (use posix) (define process (make-parameter 'hello)) (define (do-something) (printf "Doing something...\n")) ) - ...and compiled thusly: csc -s -O2 -d1 m.scm -j m -o m.so csc -s m.import.scm -O2 -d0 -o m.import.so ...on Chicken 4.7.0 or 4.8.0.4 and maybe others, I get the wrong binding for process when I (use m): - #;1> (use m) ; loading ./m.import.so ... ; loading ./m.so ... #;2> (process) hello - ...even tho process is not exported from the module m. Interestingly I wasn't getting this on my development machine but when I deployed some new code last night I discovered that the binding was being redefined on the deployment machine even tho' the version of Chicken was the same. I'm not sure if it has anything to do with the order in which modules are loaded. Surely the new definition should shadow the existing one, not redefine it? The behaviour exists even if the module is imported with a prefix: - #;1> (use (prefix m m:)) ; loading ./m.import.so ... ; loading ./m.so ... #;2> (process) hello - I'm not sure if this happens with definitions from other eggs rather than so called "units". When compiling m.scm -> m.so I get the following warning: - Warning: redefinition of imported value binding: process - Is this behaviour considered a bug? Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Another lowdown->sxml-serializer problem
Hi, >> 2. Convert w/ markdown->sxml: >> >> ((p "This" (#\space) "fragment" >> (a (@ (href ("http://call-cc.org/";))) "Chicken" (#\space) "Scheme") ".")) > > Well, evidently this is a bug in markdown->sxml, since the above is not > well-formed SXML. Not only is the URL incorrectly being wrapped in a > list, but the lists of characters aren't really SXML either. Agreed. Unfortunately some of the SXML tooling is OK with something that isn't an element name appearing in the car of a list and some of it isn't. Both ("http://call-cc.org/";) and (#\space) are badly-formed sxml that the sxml->html tooling will generally be ok with and most things that use foldts generally will not be. :-( Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] losing 'shuffle' ?
Hi, >> I've started working with the development snapshot, 4.7.3, but see in the >> NEWS: >> >>> "shuffle" has been deprecated >> >> Is it being moved? Or is there an alternative function? > > It didn't think that anybody used it. Should it stay? Ooop! I've just realised that this has gone in chicken-core:e1a577 (between 4.8.0.4 and master). I use this in my Helveticards demo code. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Timezone bugs in the posix module
Hi, There seem to be some inconsistencies in the timezone handling in the posix module. http://api.call-cc.org/doc/library/current-seconds - (current-seconds) procedure Returns the number of seconds since midnight, Jan. 1, 1970. - This seems to be true and it appears to be in Zulu time. On a machine in BST: - $ date; csi -p '(use posix) (current-seconds)' Sun Sep 29 18:06:50 BST 2013 # 1380474410.0 - On a machine in CDT: - $ date; csi -p '(use posix) (current-seconds)' Sun Sep 29 12:06:50 CDT 2013 # 1380474410.0 - ...we get the same value. All is well. However, http://api.call-cc.org/doc/posix/seconds-%3Estring - (seconds->string [SECONDS]) procedure Converts the local time represented in SECONDS into a string of the form "Tue May 21 13:46:22 1991". SECONDS defaults to the value of (current-seconds). - ..seems to be misleading as [SECONDS] is in Zulu time (as shown above). It is seconds->string itself which does the conversion to local time for the resulting string: - $ date; csi -p '(use posix) (seconds->string 0)' Sun Sep 29 12:08:15 CDT 2013 # Wed Dec 31 18:00:00 1969 - However, there's also a bug as I get the following on a machine in BST: - $ date; csi -p '(use posix) (seconds->string 0)' Sun Sep 29 18:09:02 BST 2013 # Thu Jan 1 01:00:00 1970 - ...and if I force that machine into BST: - $ export TZ=BST; date; csi -p '(use posix) (seconds->string 0)' Sun Sep 29 17:21:34 BST 2013 # Thu Jan 1 00:00:00 1970 - ...and UTC: - $ export TZ=UTC; date; csi -p '(use posix) (seconds->string 0)' Sun Sep 29 17:09:46 UTC 2013 # Thu Jan 1 00:00:00 1970 - ...and Europe/London: - $ export TZ=Europe/London; date; csi -p '(use posix) (seconds->string 0)' Sun Sep 29 18:21:50 BST 2013 # Thu Jan 1 01:00:00 1970 - ...and a definitely bogus timezone: - $ export TZ=rubbish; date; csi -p '(use posix) (seconds->string 0)' Sun Sep 29 17:25:47 rubbish 2013 # Thu Jan 1 00:00:00 1970 - ...so seconds->string sometimes ignores the timezone and doesn't throw an error. - $ wdate Sun Sep 29 12:15:19 CDT 2013 (America/Chicago) Sun Sep 29 17:15:19 UTC 2013 (UTC) Sun Sep 29 18:15:19 BST 2013 (Europe/London) Sun Sep 29 19:15:19 CEST 2013 (Europe/Rome) Mon Sep 30 06:15:19 NZDT 2013 (NZ) - On the machine in BST: - $ export TZ=CDT; date; csi -p '(use posix) (seconds->string 0)' Sun Sep 29 17:10:58 CDT 2013 # Thu Jan 1 00:00:00 1970 - - $ export TZ=America/Chicago; date; csi -p '(use posix) (seconds->string 0)' Sun Sep 29 12:11:43 CDT 2013 # Wed Dec 31 18:00:00 1969 - ...so it seems that the posix unit does not support the same names for timezones as the underlying operating system / date command (Linux in this case). - $ export TZ=Europe/Rome; date; csi -p '(use posix) (seconds->string 0)' Sun Sep 29 19:12:52 CEST 2013 # Thu Jan 1 01:00:00 1970 $ export TZ=CEST; date; csi -p '(use posix) (seconds->string 0)' Sun Sep 29 17:13:10 CEST 2013 # Thu Jan 1 00:00:00 1970 $ export TZ=NZ; date; csi -p '(use posix) (seconds->string 0)' Mon Sep 30 06:14:00 NZDT 2013 # Thu Jan 1 12:00:00 1970 $ export TZ=NZDT; date; csi -p '(use posix) (seconds->string 0)' Sun Sep 29 17:14:15 NZDT 2013 # Thu Jan 1 00:00:00 1970 - Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Weird stdout buffering during (load ...)
Hi, http://paste.call-cc.org/paste?id=e3ae15323d083667cc21eba9db9e0b2ed2ee77fd In the paste above I have some code which seems to print the same thing to stdout three times unless I call (newline), in which case, the thing is printed only once. I modified things such that I print to stdout and also write something into a file such that if it is called multiple times the file contents are different than when it is called once. In that case, I get multiple occurances on stdout but only one write to the file which suggests that the (load ...) *is* only occurring once. I'm not being particularly clear because I have been unable to produce a simple repro for this outside the rest of my program. This is running on Chicken 4.7.0. I should upgrade to Chicken 4.8.0 but, in the meantime, is anyone able to suggest any known problems that would cause something to be flushed to stout multiple times? As an aside, I note that (use extras) is required in interpreted code but not in compiled code. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users