Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

DOing a script from REBOL.org

 [1/6] from: SunandaDH:aol at: 31-Oct-2006 5:30


Hidden in the Library Recent Changes thread, Carl Read asked:
> Shouldn't this just, you know, work... > do
http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=texture-lab.r Gregg suggested using the "plain text" version of the script in the Library:
> do
http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=texture-lab.r And Anton diagnosed REBOL's inability to parse the script from the webpage as a documentation and/or coding problem in REBOL -- an embedded script needs to start with a newline. http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-message.r?m=rmlWTJC The Library now emits the HTML with a newline before the script header. This means that many scripts are DO-able from their Library webpage. Thanks to Carl and Gregg and Anton for raising and fixing the problem. **** Unfortunately, _many_ scripts are Do-able, but not the one in question. texture-lab.r contains greater-than and less-than signs. These are escaped to character entities in the HTML page, and that creates a syntax error. Gregg's solution still stands: use the version intended for execution rather than the one prettied up for display. Other alternatives include: -- download the script and run it locally. -- download the whole Library, and run the one script locally: http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-librarian.r Those first two suggestions work even when the library isn't available. -- Use the Library Data Services interface. Normally (see below for exception **) this best as it allows you to specify which version of a script you want to run -- the Library may have multiple versions of a script, and the most recent one may not be the one you want. do http://www.rebol.org/library/public/lds-local.r res: lds/send-server 'get-archive-version ["texture-lab.r/1"] do decompress res/data/script Normally, this would run Version 1 of texture-lab.r If there were other verisons, you could check them here: http://www.rebol.org/cgi-bin/cgiwrap/rebol/script-history.r?script-name=textur e-lab.r And that would work with most scripts in the Library. ** Sadly, texture-lab.r is an exception: it checks its own REBOL header. That means it is assuming it is running as a Do %name. So it fails as it can't find header/version. You could always save it to a temporary file and do it from there. **** Who said the X-Internet was easy!? Moral of the story: listen to Gregg. Sunanda.

 [2/6] from: rebolek:gma:il at: 31-Oct-2006 11:50


Hm, I never knew I would create so much problems ;) Sunanda wrote: ** Sadly, texture-lab.r is an exception: it checks its own REBOL header. That means it is assuming it is running as a Do %name. So it fails as it can't find header/version. Yes it checks it's header to get version number and help texts from USAGE field, but I've got lot of problems with this approach so I'm now uploading new version that does not check for its header. Rebolek On 10/31/06, SunandaDH-aol.com <SunandaDH-aol.com> wrote:
> Hidden in the Library Recent Changes thread, Carl Read asked: > > Shouldn't this just, you know, work...
<<quoted lines omitted: 52>>
> To unsubscribe from the list, just send an email to > lists at rebol.com with unsubscribe as the subject.
-- / Boleslav Brezovsky http://krutek.info \

 [3/6] from: gabriele::colellachiara::com at: 31-Oct-2006 11:51


Hi Sunanda, On Tuesday, October 31, 2006, 11:30:12 AM, you wrote: Sac> texture-lab.r contains greater-than and less-than Sac> signs. These are escaped to Sac> character entities in the HTML page, and that creates a syntax error. Maybe you can use a CDATA section? Regards, Gabriele. -- Gabriele Santilli <gabriele-rebol.com> --- http://www.rebol.com/ Colella Chiara software division --- http://www.colellachiara.com/

 [4/6] from: SunandaDH::aol::com at: 31-Oct-2006 6:57


Rebolek:
> Hm, I never knew I would create so much problems
Not your problems! They're problems mainly to do with embedding scripts in HTML pages in a way that is both: a) safe (ie we escape characters that could be used to execute XSS and other types of attack); and b) executable by REBOL It's tricky to get it all right.
> So I'm now uploading new version that does not check for its header.
There is no in-principle reason why scripts in the Library should not assume they have been installed. Many do. But if it can be avoided, that makes things more flexible. Thanks for the revised version. Gabriele:
> Maybe you can use a CDATA section?
Maybe. But then we'd have to escape the ]]> string that closes a CDATA (to stop someone uploading a script that contains a close CDATA sctring followed by malicious HTML. There's no ideal solution -- not that I know of, anyway. Sunanda.

 [5/6] from: anton::wilddsl::net::au at: 1-Nov-2006 21:28


Sunanda,
> The Library now emits the HTML with a newline before the script header. > > This means that many scripts are DO-able from their Library webpage.
Very good.
> ** Sadly, texture-lab.r is an exception: it checks its own REBOL > header. That > means it is assuming it is running as a Do %name. So it fails as it can't > find header/version. > Sunanda.
It is possible to simulate DOing a file as long as you have previously loaded its header. This this new script I've been working on just a few days ago: http://anton.wildit.net.au/rebol/library/simulate-do.r it needs http://anton.wildit.net.au/rebol/library/translate-line-terminators.r As you can see, it looks like there isn't too much to do to simulate DOing a file. Regards, Anton.

 [6/6] from: gabriele::colellachiara::com at: 1-Nov-2006 12:24


Hi Sunanda, On Tuesday, October 31, 2006, 12:57:33 PM, you wrote: Sac> Maybe. But then we'd have to escape the ]]> string that closes a CDATA Sure, but that's much less likely than comparisons. In that case users would need to use the download-a-script link to DO it. Actually, the HTML source for such scripts could just contain a DO with the download-a-script URL, so doing them still works. Regards, Gabriele. -- Gabriele Santilli <gabriele-rebol.com> --- http://www.rebol.com/ Colella Chiara software division --- http://www.colellachiara.com/

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted