Re: insufficient error checking

From: Scott Weisman <>
Date: Tue, 14 Dec 2010 05:04:47 -0800 (PST)

I didn't lose any data. I only pointed out that the problem with the
dirty bit because TA thought the file was saved, even though an
exception was thrown. So, whether or not further error checking is or
should be added, the dirty bit should not be reset in this case.

I guess I don't mind having errors show up in a new buffer in a split
view. But it would be nice if the new view was just a few lines high,
instead of half the screen. Also, the error is only half visible,
until I focus on the buffer and hit home. I will look more into this,
but here's another problem I encountered.

I was using the file-browser extension on a directory, and I kept
getting a similar nil argument error thrown when looking at one dir. I
added in a line to output the file name to the buffer before the line
that threw an exception, and the file had a "?" at the end, which
didn't show up in File Explorer. I assume it was a non-printing

To summarize, when lfs iterated over a directory, it returned a
filename that another lfs function didn't recognize as a valid
filename. I thought that perhaps Lua (stupidly) uses C-style (ie "\0"-
terminated) strings, but I have since found that is not the case. This
is not an issue with TA per se, and in this case for sure no error
checking should have been needed anyway, because one lfs function
should accept as a valid filename whatever value another lfs function

When I renamed the file in Windows to the same name (but presumably
removing non-printing chars), the extension then worked as expected.

Any ideas on this?

I do find Lua an intriguing language, things like this (which is
pretty basic) that don't work as expected drive me nuts.

> I assumed an error will be thrown on line 238 if the file cannot be opened
> for writing so the error on 243 you are getting wouldn't happen. It's
> strange that it is. A quick fix would be to insert:
> if not lfs.attributes(filename) then error('File not found') end
> just before 238 (after the iconv).
> If this fixes the problem, let me know. I'm curious to know that if a
> write error isn't thrown but the lfs one is, what file is being written
> to?
Received on Tue 14 Dec 2010 - 08:04:47 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:56:50 EST