<beneroth>
corrupted pilDB index trees.. "Tree size mismatch" thrown by @lib/tool.l dbCheck
<beneroth>
I had 3 such cases, in each the node counter was one smaller than then actual tree, I "fixed" it by manually increasing the counter so dbCheck was happy
<Regenaxer>
hmm, should not happen
<beneroth>
what are possible causes for that?
<beneroth>
yeah :D
<Regenaxer>
Haven't seen this for years
<beneroth>
I mean.. any ideas for potential causes besides "using put instead of put>" ?
<Regenaxer>
Must be the E/R model
<Regenaxer>
but still, the tree does not depend much on the model
<Regenaxer>
just store + fetch
<Regenaxer>
Not easy to get this mismatch ;)
<beneroth>
indeed
<Regenaxer>
Are there any strange keys?
<Regenaxer>
so that fetch does not return what store stored?
<Regenaxer>
Hmm, "Bidi"
<beneroth>
mist... I'm not sure about the relation anymore
<Regenaxer>
I see no problem if Vip is used I think, as it does not handle Bidi :)
<beneroth>
yeah I guess picolisp parser is doing nothing with unicode bidi characters, does it?
<Regenaxer>
Anyway there is very little code compiled in Pil
<beneroth>
compilation doesn't matter here
<beneroth>
the point is, making source code look doing X when it actuall does Y
<Regenaxer>
It is a way of hiding evil code, right?
<beneroth>
T
<Regenaxer>
So the ediTor / viewer must handle Bidi
<beneroth>
obfuscation. like in source code it looks like being commented out and compiler/parser sees its not as commented out
<Regenaxer>
yeah
<beneroth>
the issue is if the parser/compiler handles it differently than the editor I guess
<beneroth>
so you, with vip no problem :P
<Regenaxer>
How about Vim or Emacs?
<beneroth>
dunno, I haven't read all the bidi stuff yet.
<Regenaxer>
Would be interesting to produce a test case
<Regenaxer>
I wonder if a plain $ cat src.l will hide it
<Regenaxer>
i.e. which parts can handle it
<beneroth>
"Like most non-text rendering systems, compilers and interpreters do not typically process formatting control characters,including Bidi overrides, prior to parsing source code. "
<beneroth>
this is the core point, I guess
<beneroth>
well as you said, you also don't handle it in vip
<Regenaxer>
The core point is that the code is not visible
<Regenaxer>
not what the compiler does
<beneroth>
T
<beneroth>
well
<beneroth>
it appears as a different code than what the compiler does. I expect it still visible
<beneroth>
s/does/does see
<Regenaxer>
Code inspection does not show it
<beneroth>
you see "dab" in your editor, looks good. parser sees "bad" because that is in bytes there, but marked with bidi characters to change ordering when doing formatted rendering
<beneroth>
so I guess vip would still display "bad" while more "advanced" editors which implemented bidi formatting rules might show "dab" instead
<Regenaxer>
I think the danger is that you can hide potions of code by overwriting it backwards
<Regenaxer>
Just clear the code with a dummy comment
<Regenaxer>
(this is bad code) # Good comment <back>clear withe good looking stuff</back>
<Regenaxer>
So it is not the compiler or reader
<Regenaxer>
it is the human code reviewer
<beneroth>
I think it's the other way round.. human reviewer sees the code with the effect of bidi, compiler without. your example is human reviewer not applying bidi and compiler applying it.
<beneroth>
interesting to see what Rust etc. changed in their compilers because of this.. it sounds like they did a change on their tooling
<Regenaxer>
I think no compiler does apply bidi
<beneroth>
yep, but code editors do
<beneroth>
so do they "fix" code editors or compilers?
<Regenaxer>
yes, so it is the reviewer, not the compiler
<beneroth>
you are not wrong. but you forbid the israeli programmer to have a comment in right-to-left-writing :d
<Regenaxer>
What is the problem, the comment can be any direction
<Regenaxer>
to the compiler it is always a comment
<Regenaxer>
In the linear source it is ignored
<Regenaxer>
the compiler does not do anything with it
<beneroth>
yes
<Regenaxer>
it is only the reviewer who does not see what it is
<Regenaxer>
So IDEs need to be changed
<Regenaxer>
perhaps
<beneroth>
it's code which is displayed as comment but is in fact not a part of the comment when ignoring bidi, afaik
<Regenaxer>
yes, cause it hides something
<Regenaxer>
visually
<beneroth>
if you have a single line comment, then a bidi change-direction-char, then a linebreak, then text -> same line & part of comment for editor, different line & not part of comment for parser
<Regenaxer>
as I say, visualy effect
<Regenaxer>
*visual
<Regenaxer>
(this is bad code) # <back>clear withe good looking stuff</back> then print "# Good comment"
<Regenaxer>
A hex dump will reveal it
<Regenaxer>
The parser can't do anything about it
<beneroth>
we have to check their fixes to grok it
<beneroth>
bbl, will be back in about 30min
<Regenaxer>
yeah
beneroth has quit [Quit: Leaving]
beneroth has joined #picolisp
razzy has joined #picolisp
<razzy>
hello to all
<Regenaxer>
Hi razzy!
<razzy>
i do not understand error [../all-doc.html:1] Bad input ')' when reading file by char.
<Regenaxer>
'char' does not give such an error
<Regenaxer>
only 'read'
<Regenaxer>
Probably you are reading the current input stream with 'char' and thus confuse 'read'
<beneroth>
back
<beneroth>
hi razzy
<beneroth>
usually the error "Band input ')'" means there is a ")" without a matching opening "(" parens when reading S-Expressions
<beneroth>
but .html is probably not made up of valid S-Expressions.. so don't use (read), as Regenaxer said :)
<Regenaxer>
I think razzy uses 'char'
<Regenaxer>
so he destroys his current input
<razzy>
Regenaxer: beneroth: i am pretty sure i am reading file by (char) and writing to file by (line)
<Regenaxer>
(char) never gives such an error
<Regenaxer>
only 'read'
<Regenaxer>
so it *must* be your repl
<Regenaxer>
current input stream
<beneroth>
uuh
<beneroth>
razzy, can you post some code?
<razzy>
I am confused by this. how can i debug when error occur?
<Regenaxer>
razzy, perhaps check the tutorial on debugging?
<beneroth>
you should still end up in a debug repl if stdin/stdout is a terminal
<razzy>
maybe I have bug in code, which occur only in middle of html file
<beneroth>
then add some logging to your code, so you can see the progress
<beneroth>
or use (trace)
<Regenaxer>
yes, trace is best to get a first idea where it goes wrong
<Regenaxer>
(trace 'char)
<razzy>
ok working on it
<Regenaxer>
(mapc trace '(char line))
<Regenaxer>
and other functions, whatever may be called
<razzy>
I was hoping to start debugging when error occur (I know by that point might be late)
<beneroth>
that is the default behaviour of picolisp.. that you get a debug repl when an error occurs
<beneroth>
so if that is not happening, then your code/execution is preventing it somehow.
razzy has quit [Ping timeout: 268 seconds]
razzy has joined #picolisp
<razzy>
Regenaxer: what do you meanit must be my REPL breaking?
<Regenaxer>
Think how the repl works
<Regenaxer>
especially 'load'
<razzy>
so far, i think, i stumble on magical character and something break
<Regenaxer>
nope
<Regenaxer>
*must* be 'read'
<razzy>
i will post code.
razzy has quit [Ping timeout: 246 seconds]
razzy has joined #picolisp
<razzy>
hmm
<razzy>
Regenaxer: i have code here. http://ix.io/3DCs and it break for weird reason
<razzy>
it break even when i launch it as script
<beneroth>
L is not initialized when you work destructively with it in (inc 'L)
<beneroth>
how does it work if you add L 0 to your initial setq?
<beneroth>
I would replace the (use (A C D L) (setq A NIL C 0 D 0) ...) with (let (A NIL C 0 D 0 L 0) ...). or (use (A C D L) (off A) (zero C D L) ...)
<beneroth>
ah I meant (push 'L) not (inc 'L) of course...but the critic still applies
<razzy>
beneroth: no change, as expected
<razzy>
you can run it too, it uses local pil21 doc/app.html
<razzy>
i will go for walk, than i find exact char it break on.
<Regenaxer>
razzy, sorry, we have guests
<razzy>
Regenaxer: enjoy your company, no problem.
<razzy>
why i cannot use (str "('!')") and can use (str "(!)")
<razzy>
Regenaxer:
libry has joined #picolisp
<libry>
Hello all! Does anyone have any advice on how to point Picolisp to a non-default library folder? I'm using Emacs and trying to start a repl but it's not pointing to the correct library folder (/usr/lib64 on RHEL-based distros).
<beneroth>
hey libry
<beneroth>
read INSTALL
<libry>
Gotcha, I will do that!
<libry>
Is that from the Tarball installation method?
<beneroth>
it tells about setting /usr/share/picolisp
<beneroth>
yeah, but when installed via OS repo it should be there too
<libry>
I installed it from a third party RPM but I'll unpack the tarball and check that out.
<libry>
Excellent, I will try the local install from tarball method instead then.
<libry>
Thanks for the help :)
<Regenaxer>
:)
<Regenaxer>
I always start with a relative path
<Regenaxer>
e.g ../../pil21/pil +
<razzy>
Regenaxer: maybe this one, is this ok? i cannot use (str "('!')") and can use (str "(!)").
<Regenaxer>
yes, ' is a quote
<Regenaxer>
a read macro in pil
<Regenaxer>
so 'a' is not meaningful
<Regenaxer>
Why do you use 'str'? It is not necessary usually
<Regenaxer>
'str' is the pil reader
<razzy>
str was issue. I do not know how to strip "" from long string without str
<razzy>
I am still scared of prin
<Regenaxer>
Why do you want to "strip" the quotes? A string in PicoLisp (i.e. a transient symbol) does not have any quotes, they are just meta-characters for I/O
<Regenaxer>
So you should never need to "strip" them
<razzy>
fair point, i will think about it
<Regenaxer>
ok
<Regenaxer>
the point is: Where did you get a string with double quotes get from?
<Regenaxer>
I think this is wrong somehow
<razzy>
Regenaxer: file app.html
<razzy>
doc/app.html
<Regenaxer>
parsing HTML?
<razzy>
Regenaxer: yop, parsing html. and come to think of it, i do not have double " just weird "''"
<Regenaxer>
you can do:
<Regenaxer>
: (in "doc/app.html" (from "\"") (till "\"" T))
<Regenaxer>
-> "-//W3C//DTD HTML 4.0 Transitional//EN"
<Regenaxer>
You cannot parse non-Lisp fiies with 'read'
<Regenaxer>
Use char, line, from, till etc
<razzy>
reason for striping " was so i can have clean save to file
<razzy>
i know i cannot use read
<Regenaxer>
ok, yes
<razzy>
Regenaxer: question: if I (in) file by (char) than print with (prin), do i always get same file regadless of content?
<Regenaxer>
yes, but only if the file is UTF-8
<Regenaxer>
(in "file" (while (char) (prin @] ?
<Regenaxer>
same as (in "file" (echo)) btw
<razzy>
ok, i want to be sure, thank you
<razzy>
Good night I wish to all! :]
razzy has quit [Quit: leaving]
<Regenaxer>
:)
libry has left #picolisp [ERC (IRC client for Emacs 27.2)]