ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* smallest possible testfile for mpgraph-error?
@ 2001-02-26 11:02 Patrick Gundlach
  2001-02-26 21:46 ` Taco Hoekwater
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Gundlach @ 2001-02-26 11:02 UTC (permalink / raw)


Hi,

perhaps I have found a small testfile:

simple.mp:
------------------------------
beginfig(1);
draw btex hello world etex;
endfig;
------------------------------

using texexec with --mptex option.

if I say \protectbufferstrue in cont-sys.tex a simple.1 is 
created. (texexec --mptex simple.mp)

if I do not say \protectbufferstrue in cont-sys.tex, simple.1 is 
still created, but also (!!) a file called mpgraph.mp with the 
following content:
------------------------------
end.
------------------------------
(one line)

Now I rename simple.mp to mpgraph.mp:

with \protectbufferstrue, mpgraph.1 is ok.

without \protectbufferstrue, no mpgraph.1 is created, 
mpgraph.log is the following:
-------------------------------
This is MetaPost, Version 0.641 (Web2C 7.3.1) (mem=metafun 2001.2.19)  19 FEB 2001 13:00
**&metafun mpgraph
(mpgraph.mp )
-------------------------------
and mpgraph.mp seems to be the original (but it isn't!!):
-------------------------------
beginfig(1);
draw btex hello world etex;
endfig;
-------------------------------

This is what happens: ( no \protectbufferstrue, mpgraph.mp
)

mpgraph.mp has been renamed to tmpgraph.kep, then overwritten by 
something (this I dont know, probably the same as above 
(beginfig(1)...)  + "end.").
Then mpto opens mpgraph.mp (55 bytes), writes it to tmpgraph.tex). Then \\end is appended to tmpgraph.tex. 
After that, pdftex is called to create tmpgraph.dvi (208 bytes). 
!! But just before creating the dvi 
file, mpgraph.mp gets overwritten with a single   
"end." line. 
Then dvitomp is called with arguments tmpgraph.dvi and 
mpgraph.mpx (looks ok, 448 bytes). Then texexec removes the 
tmpgraph.dvi and tmpgraph.tex. Now mpost is invoked and sees 
only the mpgraph.mp which has only the line "end.".

And so on. If anyone needs the strace output, mail me again.

Viele Gruesse,

  Patrick Gundlach


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: smallest possible testfile for mpgraph-error?
  2001-02-26 11:02 smallest possible testfile for mpgraph-error? Patrick Gundlach
@ 2001-02-26 21:46 ` Taco Hoekwater
  0 siblings, 0 replies; 2+ messages in thread
From: Taco Hoekwater @ 2001-02-26 21:46 UTC (permalink / raw)
  Cc: ConTeXt

Patrick Gundlach wrote:
> 
> Now I rename simple.mp to mpgraph.mp:
> 
> with \protectbufferstrue, mpgraph.1 is ok.

lots of stuff can go wrong with names like mpgraph.mp.

(at least one of them is the shell itself: it caches
i-node numbers, and I've had similar problems with
totally non-TeX related files if and only if the file
was opened for writing without actually unlinking it.
This may not be the problem here, but it is nevertheless
possible).

> mpgraph.mp has been renamed to tmpgraph.kep, then overwritten by 
> something (this I dont know, probably the same as above 
> (beginfig(1)...)  + "end.").

This is texexec: in the subroutine 'checkMPlabels'

> Then mpto opens mpgraph.mp (55 bytes), writes it to tmpgraph.tex). Then \\end is appended > to tmpgraph.tex. 

probably mpto

> After that, pdftex is called to create tmpgraph.dvi (208 bytes). 
> !! But just before creating the dvi 
> file, mpgraph.mp gets overwritten with a single   
> "end." line. 

This is context itself, that is called to generate the label.
because it doesn't know about protected buffers, it writes
mpgraph.mp. Context does this *always* nowadays, even on the
following sequence of commands:

touch test.tex
texexec test
[press control-d]

The problem is in \initializeMPgraphics, which is part of
\everyjob. The following definition would be a lot safer:

\def\initializeMPgraphics%
  { \immediate\openin\scratchread\MPgraphicfile.mp
    \ifeof\scratchread
      \immediate\closein\scratchread
    \else 
     \immediate\openout\MPwrite\MPgraphicfile.mp
     \immediate\write\MPwrite{end.}%
     \immediate\closeout\MPwrite
   \fi
   \immediate\closein\scratchread
   }

I don't see any obvious reason why \protectbufferstrue
shouldn't be the default, btw.

Greetings, Taco


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-02-26 21:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-26 11:02 smallest possible testfile for mpgraph-error? Patrick Gundlach
2001-02-26 21:46 ` Taco Hoekwater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).