Menu

#4890 \epsfile can't include the EPS file that contains the byte of 0x00

Verified
Enhancement
2016-06-24
2016-06-09
No

I've noticed that \epsfile can't include the EPS that contain the byte of 0x00.

Discussion

  • Masamichi Hosoda

    There are two files aaa-eps.ly and aaa-main.ly.

    %%% aaa-eps.ly %%%
    
    \version "2.19.42"
    
    \paper {
      indent=0\mm
      line-width=120\mm
      oddFooterMarkup=##f
      oddHeaderMarkup=##f
      bookTitleMarkup = ##f
      scoreTitleMarkup = ##f
    }
    
    \markup {
      {This is EPS.}
    }
    
    %%% aaa-main.ly %%%
    
    \version "2.19.42"
    
    \markup {
      {Before including eps.}
      {\epsfile #X #20 #"aaa-eps.eps"}
      {After including eps.}
    }
    

    The following commands build an EPS file and a PS file.

    $ lilypond -dbackend=eps --ps aaa-eps.ly
    $ lilypond --ps --pdf --png aaa-main.ly
    

    aaa-eps.eps contains the byte of 0x00 because an OTF font is embedded.
    There is no problem.

    aaa-main.ly uses \epsfile for including aaa-eps.ps.
    So aaa-main.ps contains aaa-eps.eps.

    LilyPond does not raise an error. But aaa-main.ps seems broken.
    It cannot be converted to PDF and PNG.

    aaa-main.ps is filled by 0x00 from the first 0x00 of embedded EPS until the end of EPS wrapper.
    Of course, after the first 0x00 of aaa-eps.eps is not filled by 0x00.
    In other words, again, aaa-main.ps seems broken.

    If the EPS file does not contain the byte of 0x00, \epsfile can include it.

    I investigated it, but I don't know the cause.

     
  • Masamichi Hosoda

    Fix ly:format for the string that contain zero

    strcpy and strncpy cannot be used in std::string concatenation
    because std::string may contain '\0' in its contents.

    In order to avoid problems with string that contains '\0',
    this commit replaces the strncpy to std::string::copy.

    http://codereview.appspot.com/300930043

     
  • Masamichi Hosoda

    • status: New --> Started
    • assigned_to: Masamichi Hosoda
    • Needs: -->
    • Type: -->
     
  • Masamichi Hosoda

    If I understand correctly, I've found the cause.
    I've uploaded the patch.

     
  • Anonymous

    Anonymous - 2016-06-10
    • Patch: new --> review
    • Type: --> Enhancement
     
  • Anonymous

    Anonymous - 2016-06-10

    Passes make, make check and a full make doc.

     
  • Anonymous

    Anonymous - 2016-06-12
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2016-06-12

    Patch on countdown for June 15th.

     
  • Anonymous

    Anonymous - 2016-06-15
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2016-06-15

    Patch counted down please push.

     
  • Masamichi Hosoda

    • labels: --> Fixed_2_19_44
    • status: Started --> Fixed
    • Patch: push -->
     
  • Masamichi Hosoda

    I've pushed to staging.

    Issue 4890: Fix ly:format for the string that contain zero
    commit 211634be6f90db700eb8e5725046b27aa153ee92

     
  • Federico Bruni

    Federico Bruni - 2016-06-24
    • status: Fixed --> Verified
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.