Hmm... in that case, we simply let the user crash his system? ;)
If nobody has any brilliant ideas about this bug, shall I mark it closed? Perhaps
add a sentence somewhere in the docs to warn users that they can crash lilypond if
they use cyclic references in markup?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
whenever you use foo = \fromproperty #'bar, you add "foo, bar" to a global list of
"references used". Whenever you see a \fromproperty #'baz, you check to see if "baz"
is mentioned in the global list of references used. If it is, exit with an error.
You probably only need to store one of foo/bar, though. I'd need to work it out on
paper to figure out which one, though. (I do all my math with a pencil :)
I'm not proposing this as a serious suggestion, though. This is too ugly, and IMO
not worth the trouble. If somebody is playing with \fromproperty, then they should
be able to fix their own ly files to avoid these crashes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm, doesn't Scheme provide a stack depth counter? For example, groff (which
I maintain) fails with an `input stack limit exceeded (probable infinite loop)'.
This limit is 1000 for groff.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
GUILE has stack checking, but you need to #define it during the GUILE compile , IIRC.
It uses the C stack. Also, it has a performance penalty: every GUILE function call
needs to be checked for possible stack overflow.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In case this is done on C level I think that the penalty can be neglected.
I believe that stack checking is a must for interpreted languages like Scheme,
TeX, or troff.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately, the error message usually is not really helpful:
Fehler: Cyclic markup detected: line-markup, arguments: TODO
First, I don't think there is any way to get the code position where a markup was defined (which would be the ideal output). Second, I don't know any easy way to print out the arguments to the markup function in human-readable form. Third, the algorithm only detects loops, but does not find the user-entered begin of the loop. In particular, the error message above came from the definition:
composer = \markup {Cyclic reference to \fromproperty #'header:temp }
temp = \markup {Cyclic reference to \fromproperty #'header:composer }
Reinhold, just to be clear when testing this from my side, do I need to apply both 5027042 AND 4951073 and THEN test make and reg tests? or something else?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
they work separately, i.e. each of them should fix this particular problem (and thus work on the included regtest).
Notice, however, that both pathces include the same regtest, so applying both pathes might even give conflicts with that regtest.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Originally posted by: hanw...@gmail.com
Hi RUne,
any idea on how we could detect/solve this problem?
Note that most programming languages also crash if you do an infinite recursion.
Originally posted by: hanw...@gmail.com
(No comment was entered for this change.)
Labels: -Priority-High Priority-Low
Originally posted by: gpermus@gmail.com
\header{
FIELD = VALUE
}
if ( VALUE contains "\fromproperty #'header:FIELD" )
return "rude message"
? :)
I'm not certain which programming language we use at this point, so the syntax is
obviously wrong.
Originally posted by: hanw...@gmail.com
this won't work with mutual recursion,
f1 = \markup \fromproperty #'header:f2
f2 = \markup \fromproperty #'header:f1
Originally posted by: gpermus@gmail.com
Hmm... in that case, we simply let the user crash his system? ;)
If nobody has any brilliant ideas about this bug, shall I mark it closed? Perhaps
add a sentence somewhere in the docs to warn users that they can crash lilypond if
they use cyclic references in markup?
Originally posted by: lemzw...@googlemail.com
IMHO, it *must* be fixed, this is, lilypond should exit with an error
but without a crash.
Originally posted by: hanw...@gmail.com
Werner,
do you have any concrete suggestion how we could achieve that?
Originally posted by: gpermus@gmail.com
Ugly hack:
whenever you use foo = \fromproperty #'bar, you add "foo, bar" to a global list of
"references used". Whenever you see a \fromproperty #'baz, you check to see if "baz"
is mentioned in the global list of references used. If it is, exit with an error.
You probably only need to store one of foo/bar, though. I'd need to work it out on
paper to figure out which one, though. (I do all my math with a pencil :)
I'm not proposing this as a serious suggestion, though. This is too ugly, and IMO
not worth the trouble. If somebody is playing with \fromproperty, then they should
be able to fix their own ly files to avoid these crashes.
Originally posted by: lemzw...@googlemail.com
Hmm, doesn't Scheme provide a stack depth counter? For example, groff (which
I maintain) fails with an `input stack limit exceeded (probable infinite loop)'.
This limit is 1000 for groff.
Originally posted by: hanw...@gmail.com
GUILE has stack checking, but you need to #define it during the GUILE compile , IIRC.
It uses the C stack. Also, it has a performance penalty: every GUILE function call
needs to be checked for possible stack overflow.
Originally posted by: lemzw...@googlemail.com
In case this is done on C level I think that the penalty can be neglected.
I believe that stack checking is a must for interpreted languages like Scheme,
TeX, or troff.
Originally posted by: hanw...@gmail.com
(No comment was entered for this change.)
Labels: -Priority-Low Priority-Postponed
Originally posted by: percival.music.ca@gmail.com
(No comment was entered for this change.)
Labels: -Type-Defect -Priority-Postponed Type-Crash
Owner: ---
Originally posted by: reinhold...@gmail.com
First attempt is up at: http://codereview.appspot.com/4951073
The cyclic reference is broken, but somehow the warning message is never triggered... Any idea?
Labels: Patch-new
Owner: reinhold...@gmail.com
Status: Started
Originally posted by: pkx1...@gmail.com
Passes make but fails reg test check:
Failed files: (f2/lily-1e1652fb.ly)
fatal error: Children (4) exited with errors.
command failed: /home/jlowe/lilypond-git/build/out/bin/lilypond -I /home/jlowe/lilypond-git/input/regression/ -I ./out-test -I /home/jlowe/lilypond-git/input -I /home/jlowe/lilypond-git/Documentation -I /home/jlowe/lilypond-git/Documentation/snippets -I /home/jlowe/lilypond-git/input/regression/ -I /home/jlowe/lilypond-git/Documentation/included/ -I /home/jlowe/lilypond-git/build/mf/out/ -I /home/jlowe/lilypond-git/build/mf/out/ -I /home/jlowe/lilypond-git/Documentation/pictures -I /home/jlowe/lilypond-git/build/Documentation/pictures/./out-test -dbackend=eps --formats=ps -djob-count=7 -dseparate-log-files -dinclude-eps-fonts -dgs-load-lily-fonts --header=texidoc -I /home/jlowe/lilypond-git/Documentation/included/ -ddump-profile -dcheck-internal-types -ddump-signatures -danti-alias-factor=1 -I "/home/jlowe/lilypond-git/build/out/lybook-testdb" -I "/home/jlowe/lilypond-git/build/input/regression" -I "/home/jlowe/lilypond-git/input/regression" -I "/home/jlowe/lilypond-git/build/input/regression/out-test" -I "/home/jlowe/lilypond-git/input" -I "/home/jlowe/lilypond-git/Documentation" -I "/home/jlowe/lilypond-git/Documentation/snippets" -I "/home/jlowe/lilypond-git/input/regression" -I "/home/jlowe/lilypond-git/Documentation/included" -I "/home/jlowe/lilypond-git/build/mf/out" -I "/home/jlowe/lilypond-git/build/mf/out" -I "/home/jlowe/lilypond-git/Documentation/pictures" -I "/home/jlowe/lilypond-git/build/Documentation/pictures/out-test" --formats=eps -deps-box-padding=3.000000 -dread-file-list -dno-strip-output-dir "/home/jlowe/lilypond-git/build/out/lybook-testdb/snippet-names-1064022268.ly"
Child returned 1
make[2]: *** [out-test/collated-files.texi] Error 1
rm out-test/weblinks.itexi
make[2]: Leaving directory `/home/jlowe/lilypond-git/build/input/regression'
make[1]: *** [local-test] Error 2
make[1]: Leaving directory `/home/jlowe/lilypond-git/build/input/regression'
make: *** [test] Error 2
jlowe@jlowe-lilybuntu2:~/lilypond-git/build$ ^C
jlowe@jlowe-lilybuntu2:~/lilypond-git/build$
Fails on this file:
--snip--
\sourcefilename "/home/jlowe/lilypond-git/input/regression/header-cyclic-reference.ly"
\sourcefileline 0
\version "2.15.11"
#(ly:set-option 'warning-as-error #f)
\header {
texidoc = "Cyclic references in header fields should cause a warning, but
not crash LilyPond with an endless loop"
title = \markup {Cyclic reference to \fromproperty #'header:title}
}
\score {
{ c' d' e' f' }
}
--snip--
James
Labels: -Patch-new Patch-needs_work
Originally posted by: reinhold...@gmail.com
Oops, last-second changes before uploading are never a good idea :( Patch corrected.
Labels: -Patch-needs_work Patch-new
Originally posted by: pkx1...@gmail.com
Passes make and reg tests :)
Labels: -Patch-new Patch-review
Originally posted by: pkx1...@gmail.com
After comments from Han-wen and Joe N.
Summary: Try to auto-detect cyclic references in header fields (was 'cycling markup reference segfaults')
Labels: -Patch-review Patch-needs_work
Originally posted by: reinhold...@gmail.com
I have now created a new patch, which employs the hare+tortoise algorithm to detect cycles in markups:
http://codereview.appspot.com/5027042/
Unfortunately, the error message usually is not really helpful:
Fehler: Cyclic markup detected: line-markup, arguments: TODO
First, I don't think there is any way to get the code position where a markup was defined (which would be the ideal output). Second, I don't know any easy way to print out the arguments to the markup function in human-readable form. Third, the algorithm only detects loops, but does not find the user-entered begin of the loop. In particular, the error message above came from the definition:
composer = \markup {Cyclic reference to \fromproperty #'header:temp }
temp = \markup {Cyclic reference to \fromproperty #'header:composer }
For that reason, I would like to apply both
http://codereview.appspot.com/5027042/
and the updated
http://codereview.appspot.com/4951073/
The first is a general solution, while the second provides a specific solution for \fromproperty, which tells the user exactly where the loop occurs.
Labels: -Patch-needs_work Patch-new
Originally posted by: pkx1...@gmail.com
Reinhold, just to be clear when testing this from my side, do I need to apply both 5027042 AND 4951073 and THEN test make and reg tests? or something else?
Originally posted by: reinhold...@gmail.com
they work separately, i.e. each of them should fix this particular problem (and thus work on the included regtest).
Notice, however, that both pathces include the same regtest, so applying both pathes might even give conflicts with that regtest.
Originally posted by: pkx1...@gmail.com
Passes make and reg tests (http://codereview.appspot.com/5027042/)
James
Labels: -Patch-new Patch-review
Originally posted by: reinhold...@gmail.com
Fixed with commits
[re2ebf5785dd8eb5b195b614e7dca4f2a19363fc0]
and
[r25be0aa5e4481df77568b99357764f5b1ff46ceb]
Labels: fixed_2_15_12
Status: Fixed
Originally posted by: brownian.box@gmail.com
(No comment was entered for this change.)
Status: Verified