Menu

#4494 Table Of Contents crash with negative first-page-number

Verified
nobody
Crash
2015-07-27
2015-07-11
Anonymous
No

Originally created by: *anonymous

Originally created by: ColinPKC...@gmail.com
Originally owned by: nine.fie...@gmail.com

The following crashes with released 2.19.22

%% snippet-start

\version "2.19.22"

\paper { first-page-number = #-1 }
\markuplist \table-of-contents
\tocItem "Adagio"
{ c''1 }

%% snippet-end

returning:

GNU LilyPond 2.19.22
Processing `table-poking.ly'
Parsing...
Interpreting music...
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Layout output to `/tmp/lilypond-esdOrO'...
Converting to `table-poking.pdf'...
warning: `(gs -q -dSAFER -dDEVICEWIDTHPOINTS=595.28
-dDEVICEHEIGHTPOINTS=841.89 -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH
-[r1200] -sDEVICE=pdfwrite -sOutputFile=table-poking.pdf -c.setpdfwrite
-f/tmp/lilypond-esdOrO)' failed (256)

fatal error: failed files: "table-poking.ly"

No error with 2.18.2 or a build from latest master

Discussion

  • Google Importer

    Google Importer - 2015-07-11

    Originally posted by: dak@gnu.org

    Sounds like a close cousin to issue 3388.  Do we distinguish logical and physical page numbers?

     
  • Google Importer

    Google Importer - 2015-07-11

    Originally posted by: dak@gnu.org

    "No error with 2.18.2 or a build from latest master"?  Are we talking about the same Ghostscript version in each instance?

    Because I don't think that anything in LilyPond itself has changed regarding the difference between 2.19.22 and current master.

     
  • Google Importer

    Google Importer - 2015-07-12

    Originally posted by: truer...@gmail.com

    In my experiment,
    lilypond-2.18.2 + ghostscript-8.70 (lilypond-2.18 official binary): succeed
    lilypond-2.18.2 + ghostscript-9.15: failed

    (lilypond-2.19.22 official binary contains ghostscript-9.15.)

    It seems that ghostscript-9.15 rejects negative page number.
    Is it necessary that negative page number?

    Here is the ghostscript-9.15 error messages.

    ```
    $ ps2pdf14 table-piking.ps table-piking.gs-9.15.pdf
    GPL Ghostscript 9.15: Destination page -1 lies outside the valid page range.
    GPL Ghostscript 9.15:    **** Warning: Outline has invalid link that was discarded.
    Error: /rangecheck in --pdfmark--
    Operand stack:
       --nostringval--   Rect   --nostringval--   Border   --nostringval--   Page   -1   Subtype   Link   ANN
    Execution stack:
       %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1967   1   3   %oparray_pop   1966   1   3   %oparray_pop   1950   1   3   %oparray_pop   1836   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1968   10   3   %oparray_pop   --nostringval--
    Dictionary stack:
       --dict:1186/1684(ro)(G)--   --dict:0/20(G)--   --dict:113/200(L)--
    Current allocation mode is local
    Last OS error: No such file or directory
    Current file position is 137043
    GPL Ghostscript 9.15: Unrecoverable error, exit code 1

    $
    ```

     
  • Google Importer

    Google Importer - 2015-07-12

    Originally posted by: thomasmo...@gmail.com

    @ #2
    2.18.2 and 2.19.22 are running in the host with gs 8.71
    git is running in the guest LilyDev3 with gs 9.05

     
  • Google Importer

    Google Importer - 2015-07-12

    Originally posted by: thomasmo...@gmail.com

    @ #3
    > It seems that ghostscript-9.15 rejects negative page number.
    > Is it necessary that negative page number?

    We frequently use -1 as default-value in titling-init.ly like
    (chain-assoc-get 'page:page-number props -1)

    The sense for negative first-page-number:
    If you want to start the music on a page with page-number 1, but have a title-page, a second page with table of contents and maybe a third page with some preamble before, you'll set first-page-number to -2 and exclude printing the negative and zero numbers by setting page-headers/footers in bookparts accordingly.

    Right now I have no idea how to reach this goal different.

     
  • Google Importer

    Google Importer - 2015-07-12

    Originally posted by: thomasmo...@gmail.com

    Ok, I can make it work with a changed /with-link

    \version "2.19.22"

    #(define (book-first-page layout props)
      (define (ancestor layout)
        "Return the topmost layout ancestor"
        (let ((parent (ly:output-def-parent layout)))
          (if (not (ly:output-def? parent))
              layout
              (ancestor parent))))
      (ly:output-def-lookup (ancestor layout) 'first-page-number))

     
    #(define-markup-command (with-link layout props label arg)
      (symbol? markup?)
      (let* ((arg-stencil (interpret-markup layout props arg))
             (x-ext (ly:stencil-extent arg-stencil X))
             (y-ext (ly:stencil-extent arg-stencil Y)))
        (ly:make-stencil
         `(delay-stencil-evaluation
           ,(delay (ly:stencil-expr
                    (let* ((table (ly:output-def-lookup layout 'label-page-table))
                           (first-page-number (book-first-page layout props))
                           (orig-page-number (if (list? table)
                                            (assoc-get label table)
                                            #f))
                           (p-nr (ly:output-def-lookup layout 'first-page-number))
                           (page-number (+ orig-page-number (+ 1 (* -1 first-page-number) )))
                           (link-expr (list 'page-link page-number
                                            `(quote ,x-ext) `(quote ,y-ext))))
                                           
    ;(newline)(display "first-page-number__")(display first-page-number)
    ;(newline)(display "p-nr_______________")(display p-nr)
          
                      (ly:stencil-add (ly:make-stencil link-expr x-ext y-ext)
          arg-stencil)))))
               x-ext
               y-ext)))
              
              
    \paper { first-page-number = #-1 }
    \markuplist \table-of-contents
    \pageBreak
    \tocItem "Adagio"
    { c''1 }

     
  • Google Importer

    Google Importer - 2015-07-12

    Originally posted by: thomasmo...@gmail.com

    (No comment was entered for this change.)

    Owner: thomasmo...@gmail.com
    Status: Started

     
  • Google Importer

    Google Importer - 2015-07-12

    Originally posted by: thomasmo...@gmail.com

    Table Of Contents crash with negative first-page-number

    Issue 4494

    Let \with-link point to the physical page-number

    https://codereview.appspot.com/258740043/

    Status: New

     
  • Google Importer

    Google Importer - 2015-07-13

    Originally posted by: thomasmo...@gmail.com

    (No comment was entered for this change.)

    Labels: Patch-new
    Status: Started

     
  • Google Importer

    Google Importer - 2015-07-13

    Originally posted by: pkx1...@gmail.com

    Fails make check.

    --snip--

    Processing `./45/lily-b9fd5d52.ly'
    Parsing...
    Renaming input to: `/home/jlowe/lilypond-git/input/regression/page-links-nolabel.ly'
    Finding the ideal number of pages...
    Fitting music on 1 page...
    Drawing systems...
    Writing header field `texidoc' to `./45/lily-b9fd5d52.texidoc'...
    Layout output to `./45/lily-b9fd5d52.eps'...Backtrace:
    In /home/jlowe/lilypond-git/build/out/share/lilypond/current/scm/lily.scm:
    1011:  6* (let* (# # #) (if separate-logs #) (if ping-log #) ...)
    1022:  7* [lilypond-file #<procedure {#f} (key failed-file)> "45/lily-b9fd5d52.ly"]
    1057:  8  [catch ly-file-failed #<procedure {#f} ()> #<procedure {#f} (x . args)>]
    In unknown file:
       ?:  9* [#<procedure {#f} ()>]
    In /home/jlowe/lilypond-git/build/out/share/lilypond/current/scm/lily.scm:
    1058: 10* [ly:parse-file "45/lily-b9fd5d52.ly"]
    In unknown file:
       ?: 11* [toplevel-book-handler #<Book>]
    In /home/jlowe/lilypond-git/build/out/share/lilypond/current/ly/lilypond-book-preamble.ly:
      12: 12* [apply #<procedure print-book-with-defaults (book)> (#<Book>)]
    In unknown file:
       ?: 13  [print-book-with-defaults #<Book>]
    In /home/jlowe/lilypond-git/build/out/share/lilypond/current/scm/lily-library.scm:
        ...
    254: 14  [ly:book-process #<Book> #< Output_def> ...]
    In unknown file:
       ?: 15* [output-framework "./45/lily-b9fd5d52" #<Paper_book> ...]
    In /home/jlowe/lilypond-git/build/out/share/lilypond/current/scm/framework-eps.scm:
    154: 16* [dump-stencils-as-EPSes (#<Stencil>) #<Paper_book> "./45/lily-b9fd5d52"]
    In unknown file:
       ?: 17  (letrec (# # # ...) (dump-infinite-stack-EPS stencils) ...)
    In /home/jlowe/lilypond-git/build/out/share/lilypond/current/scm/framework-eps.scm:
      85: 18* [dump-infinite-stack-EPS (#<Stencil>)]
      70: 19  (let* ((dump-me #)) (dump-stencil-as-EPS paper dump-me basename ...))
    In /home/jlowe/lilypond-git/build/out/share/lilypond/current/scm/framework-ps.scm:
        ...
    561: 20  (let* (# # # ...) (display header port) ...)
    584: 21* [ly:outputter-dump-stencil #<Paper_outputter> #<Stencil>]
    In unknown file:
       ?: 22* [#<procedure {#f} ()>]
    In /home/jlowe/lilypond-git/build/out/share/lilypond/current/scm/define-markup-commands.scm:
    534: 23* (let* (# # # #) (list # current-page-number # ...))
    542: 24* [1+ ...
    542: 25* [- {#f} 1]

    /home/jlowe/lilypond-git/build/out/share/lilypond/current/scm/define-markup-commands.scm:542:31: In procedure - in expression (- table-page-number first-page-number):
    /home/jlowe/lilypond-git/build/out/share/lilypond/current/scm/define-markup-commands.scm:542:31: Wrong type argument in position 1: #f

    --snip--

    Labels: -Patch-new Patch-needs_work

     
  • Google Importer

    Google Importer - 2015-07-13

    Originally posted by: thomasmo...@gmail.com

    (No comment was entered for this change.)

    Labels: -Patch-needs_work Patch-new

     
  • Google Importer

    Google Importer - 2015-07-13

    Originally posted by: pkx1...@gmail.com

    Passes make, make check and a full make doc.

    Labels: -Patch-new Patch-review

     
  • Google Importer

    Google Importer - 2015-07-14

    Originally posted by: thomasmo...@gmail.com

    attached a formated pach

    Owner: nine.fie...@gmail.com

     
  • Google Importer

    Google Importer - 2015-07-15

    Originally posted by: pkx1...@gmail.com

    I don't understand why this patch was added, what is wrong with the Rietveld issue?

     
  • Google Importer

    Google Importer - 2015-07-15

    Originally posted by: dak@gnu.org

    I assume that the patch corresponds to the Rietveld issue.  As opposed to the Rietveld issue, it would be complete with author, commit date, and commit message and thus in a form that Dan can commit faithfully in effigy.

     
  • Google Importer

    Google Importer - 2015-07-15

    Originally posted by: nine.fie...@gmail.com

    Yes, Thomas said as much in an email.

     
  • Google Importer

    Google Importer - 2015-07-17

    Originally posted by: pkx1...@gmail.com

    Patch on countdown for July 21st

    Labels: -Patch-review Patch-countdown

     
  • Google Importer

    Google Importer - 2015-07-20

    Originally posted by: pkx1...@gmail.com

    Patch counted down - please push.

    Labels: -Patch-countdown Patch-push

     
  • Google Importer

    Google Importer - 2015-07-21

    Originally posted by: nine.fie...@gmail.com

    Pushed to staging:

    commit [ra6bb9af34fc611f264533becc578285ea678033e]
    Author: Thomas Morley <thomasmorley65@gmail.com>
    Date:   Sun Jul 12 18:18:02 2015 +0200

        Table Of Contents crash with negative first-page-number
       
        Issue 4494
       
        Let \with-link point to the physical page-number

    Labels: -Patch-push Fixed_2_19_24
    Status: Fixed

     
  • Google Importer

    Google Importer - 2015-07-27

    Originally posted by: fedel...@gmail.com

    (No comment was entered for this change.)

    Status: Verified

     
  • Google Importer

    Google Importer - 2015-07-27

    Originally posted by: thomasmo...@gmail.com

    Dan, thanks for shepherding it in my absence