Re: Circular dependencies - Deadlock
On Thu, 22 Jun 2017 06:39:08 +0200, David Kastrupwrote: > I don't really see this as calling for changes. If you want to create > utility files to be included at most once, you can try working with > guards like it is customary for C/C++ include files. I think we're shifting topic here from recursive include to multiple include. The latter is general practice. The OP is unintentional infinite recursive includes, and whether LP can help signalling this instead of just becoming non-responsive. Maybe it is possible to track include depth, and issue a (one) warning when the include dept exceeds a certain threshold (20? 50? 100?). -- Johan ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Circular dependencies - Deadlock
Simon Albrechtwrites: > On 21.06.2017 22:32, Michael Käppler wrote: >> Honestly I did not try it, but I am quite sure that it would be easy >> to implement a IFDEF mechanism like in C preprocessing with a few >> lines of Scheme, however. > > That won’t be Scheme involved there. IIRC \include statements are > resolved even before parser (and lexer?) step in. David K. will be > able to say more. \include is expanded in the lexer but there are a whole lot of setups where multiple includes are perfectly reasonable even without thinking about recursion: for example, you can organize a typical piece by defining variables and including a file with a score skeleton, and include several scores in that manner while creating one book. I don't really see this as calling for changes. If you want to create utility files to be included at most once, you can try working with guards like it is customary for C/C++ include files. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Circular dependencies - Deadlock
Am 21.06.2017 um 23:24 schrieb msk...@ansuz.sooke.bc.ca: On Wed, 21 Jun 2017, caag...@gmail.com wrote: On 06/21/2017 11:10 PM, Johan Vromans wrote: If you have a non-infinite recursive include it will continue. I think that would require solving the Halting Problem first. That's true if it has to determine whether the recursion is infinite, but my understanding of the proposal was that Lilypond would continue with a warning in any case, not trying to decide whether it's infinite, and let the user deal with shutting it down if in fact it is infinite. That would be a very nice way of dealing with the recursion, IMO. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Circular dependencies - Deadlock
On 21.06.2017 23:24, msk...@ansuz.sooke.bc.ca wrote: my understanding of the proposal was that Lilypond would continue with a warning in any case, not trying to decide whether it's infinite, and let the user deal with shutting it down if in fact it is infinite. I was going to write that not every user runs Lily from command line and knows to hit Ctrl+C in such a case. But in Frescobaldi, you’d just have to click the red cross appearing when you start compilation, so actually that’s a good proposal. Best, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Circular dependencies - Deadlock
On Wed, 21 Jun 2017, caag...@gmail.com wrote: > On 06/21/2017 11:10 PM, Johan Vromans wrote: > > If you have a non-infinite recursive include it will continue. > > I think that would require solving the Halting Problem first. That's true if it has to determine whether the recursion is infinite, but my understanding of the proposal was that Lilypond would continue with a warning in any case, not trying to decide whether it's infinite, and let the user deal with shutting it down if in fact it is infinite. -- Matthew Skala msk...@ansuz.sooke.bc.ca People before principles. http://ansuz.sooke.bc.ca/ ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Circular dependencies - Deadlock
On Wed, 21 Jun 2017, Johan Vromans wrote: > Instead of aborting, LP could issue a warning that it detected a circular > include. If it then hangs, you have a clue what is going on. If you have a > non-infinite recursive include it will continue. If it's only a warning (we need not get back into the "fatal warnings and non-fatal errors" discussion) then this seems harmless. Another point worth considering, though, is that it's not trivial to detect whether two paths represent the same file. Doing it correctly is more than just a string comparison, and unlikely to be portable. -- Matthew Skala msk...@ansuz.sooke.bc.ca People before principles. http://ansuz.sooke.bc.ca/ ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Circular dependencies - Deadlock
On 06/21/2017 11:10 PM, Johan Vromans wrote: If you have a non-infinite recursive include it will continue. I think that would require solving the Halting Problem first. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Circular dependencies - Deadlock
On Wed, 21 Jun 2017 15:57:59 -0500 (CDT), msk...@ansuz.sooke.bc.ca wrote: > This may be a problem if there's any possibility of an include being > conditional. Then, someone could write a non-infinite recursive include > deliberately, and be disappointed when Lilypond breaks it. Instead of aborting, LP could issue a warning that it detected a circular include. If it then hangs, you have a clue what is going on. If you have a non-infinite recursive include it will continue. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Circular dependencies - Deadlock
On Wed, 21 Jun 2017, Simon Albrecht wrote: > It would be even better, I think, if Lily noticed the circular dependency and > aborted with an informative message instead of just running on forever. This may be a problem if there's any possibility of an include being conditional. Then, someone could write a non-infinite recursive include deliberately, and be disappointed when Lilypond breaks it. -- Matthew Skala msk...@ansuz.sooke.bc.ca People before principles. http://ansuz.sooke.bc.ca/ ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Circular dependencies - Deadlock
On 21.06.2017 22:32, Michael Käppler wrote: Honestly I did not try it, but I am quite sure that it would be easy to implement a IFDEF mechanism like in C preprocessing with a few lines of Scheme, however. That won’t be Scheme involved there. IIRC \include statements are resolved even before parser (and lexer?) step in. David K. will be able to say more. Best, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Circular dependencies - Deadlock
What would be wrong about just outputting a warning "Trying to include already included file" or something like that and reject the recursive \include statement? I came across this when working with a include file collecting cue notes like that: \include "foo1.ly" \include "foo2.ly" \include "foo3.ly" \addquote "bla1" { \foo1_bla1 } \addquote "bla2" { \foo2_bla2 } (...) I change my code to circumvent the recursive loop but I needed a moment to figure out why LilyPond was hanging. A warning would be nice. Honestly I did not try it, but I am quite sure that it would be easy to implement a IFDEF mechanism like in C preprocessing with a few lines of Scheme, however. All the best, Michael Am 21.06.2017 um 22:03 schrieb msk...@ansuz.sooke.bc.ca: On Wed, 21 Jun 2017, Michael Käppler wrote: foo.ily: \include "bar.ly" bar.ly: \include "foo.ily" Am I right to consider this a bug? I don't think so - at least not a bug in Lilypond. It's just doing what you told it to do, and most other language parsers that have an "include" facility will similarly be unable to give a useful result when fed infinitely recursive include files. The usual advice to users is not to write such input. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Circular dependencies - Deadlock
On 21.06.2017 22:03, msk...@ansuz.sooke.bc.ca wrote: On Wed, 21 Jun 2017, Michael Käppler wrote: foo.ily: \include "bar.ly" bar.ly: \include "foo.ily" Am I right to consider this a bug? I don't think so - at least not a bug in Lilypond. It's just doing what you told it to do, and most other language parsers that have an "include" facility will similarly be unable to give a useful result when fed infinitely recursive include files. The usual advice to users is not to write such input. And indeed, the different file name extensions make this example very unlikely to happen. It would be even better, I think, if Lily noticed the circular dependency and aborted with an informative message instead of just running on forever. However, that may not be very relevant/necessary to have. So, a feature request, but not invalid, I’d say. Best, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Circular dependencies - Deadlock
On Wed, 21 Jun 2017, Michael Käppler wrote: > foo.ily: > \include "bar.ly" > bar.ly: > \include "foo.ily" > Am I right to consider this a bug? I don't think so - at least not a bug in Lilypond. It's just doing what you told it to do, and most other language parsers that have an "include" facility will similarly be unable to give a useful result when fed infinitely recursive include files. The usual advice to users is not to write such input. -- Matthew Skala msk...@ansuz.sooke.bc.ca People before principles. http://ansuz.sooke.bc.ca/___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Circular dependencies - Deadlock
Hi all, I searched the bug tracker for the following issue but did not find anything... Consider two files: foo.ily: \version "2.19.59" \include "bar.ly" bar.ly: \version "2.19.59" \include "foo.ily" { c4 d e f } If you try to compile bar.ly the parsing process continues forever, apparently because Lily includes the two files in a circular manner (maybe reaching a memory limit at some point - did not try that) Am I right to consider this a bug? Regards, Michael ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user