(Note to devvies: I've put a LyX feature-request below, so don't hit "d" yet)

On Thu, Dec 10, 1998 at 02:54:38PM +0100, Sven Kopp wrote:
> SuSe Linux 2.0.35
> XFree86 3.3.3
> LyX 1.0.0pre2
> SCSI-Disks
> -------------------------------
> Hi folks,
> 
> trying to import a LaTeX-File (with included sub-LaTeX-files) as "normal"
> user from a mounted DOS (FAT16)-partition /C on which I don't have a write
> permission (read-only) crashes the ext2-fs: It produces a huge (I mean a
> really huge) .xsession-errors-file in my home-directory until the root-disk
> (ext2) is full. Even killing LyX doesn't stop the fill-up (up to 400MB).
> Deleting the .xsession-errors-file doesn't liberate the as full-marked
> blocks. A "diff" between the diskusage (du / as root) before and after
> importing the LaTeX-File only shows minor differences. A e2fsck-run as root
> corrects the ext2-fs with a lot of errors (which could be fixed).  It's a
> known problem of LyX or ext2-fs ?
> 
> Sven Kopp [EMAIL PROTECTED]
> 

Wow. That's some weird wild stuff. Thanks for the bug report.

I can't tell you what's causing the crash, but I looked at the reLyX source,
and it turns out that the idiot who coded it up (OK, me) didn't check for
errors when opening the temporary files it creates. I didn't get 400 MB of
errors, but that's probably system-dependent. I did get a bunch of errors
followed by a reLyX crash. In your case, it may be a LyX bug (see below)
 combined with a reLyX bug combined with a Perl or ext2-fs bug.

To fix it, I changed "open foo" to "open foo or die" which means  that now
instead of getting a bunch of errors, we just get the one error "permission
denied". 

I think I could add a test to reLyX to see if the directory is writable, but
it seems like Perl will do that anyway when I try to use "open" so why bother?

This is certainly better than crashing your computer. OTOH, it doesn't really
fix your problem, since it means you won't be able to import TeX files.
IMO, this is a LyX bug. It certainly ought to be legal to import from a or
directory, and no matter how I change reLyX, I can't solve that problem.

I think the answer is to have the Import command copy the .tex file to the
TempDir that LyX is using before running reLyX. (If they've set use_tempdir
false, then you might need to check to make sure you're not copying a file
onto itself.) Then the temporary files as well as the eventual lyx file will
be created in TempDir. Hopefully, the user will eventually save it to
somewhere else if necessary.

Oh yeah, if you *do* have to copy it, it would probably be polite to delete it
also. Obviously, if you're in a /tmp/lyx_jfkasjdf directory, then the whole
directory gets deleted. But if use_tempdir is false and the TeX file did *not*
originate in that directory, then one would have to delete it explicitly.
If the TeX file *did* originate in that directory, then it would be most
impolite to delete it! (Maybe you could just set a variable if you had copied
it, and only delete it in that case?)

So, Asger, you implemented the Import->LaTeX. Would you like to fix it?
It's a bugfix, so it's allowed in 1.0. And it's a problem that could come up
pretty often, even though I suspect that in most cases it won't actually crash
a computer!

I'll check in this & some other minor changes for sure before 1.0, even if I
can't get the figure stuff in. I assume Lars will give us a "make sure to
check in your last patches" warning?

-Amir

Reply via email to