Programming and Scripting :: MyDSL info parser



Quote (roberts @ Mar. 17 2008,21:39)
All of your scripts specify
Quote
#!/home/dsl/bin/murgaLua-0.6.4

Which would naturally lead one such assumption as it is not needed in DSL unless features that are only available in 0.6.4.were being attempted.

I see.

I use the newer interpreter when testing newer features. It is not a requirement, though. Anything I write for use in DSL should be useable with murgaLua 0.5.5. The features of newer versions are used only if they are available....
Code Sample
if Fl_Browser.column_widths then
 results:column_widths({results:w()/2,150,0})
 spacer="\t"
else spacer="\t\t" -- force some extra space for older versions


Sometimes I remove the interpreter line when uploading, but usually I don't think about it.

Might be an issue with os.rename and the new mydslBrowser.lua formerly known as mydsl info parser.

It becomes apparent with the standard grub pendive installation, where the first partition is fat32 and the second is ext2.

Upon first invocation of the script, you can see the download of the mydslinfo.bz2 occur via wget but the result is:

"Cannot read database /mnt/sda1/mydsl/mydslinfo.bz2"
"Please try updating again.

Upon each attempt at such results in the same message, each with another copy of mydslinfo.bz2 named as a lua tempfile. in the /tmp directory  An endless loop.

Appears that line:

os.rename(tempfile,listfile)

quietly fails.

This can duplicated by:
Code Sample

#!/bin/lua
listfile = "/mnt/sda1/mydsl/mydslinfo.bz2"
tempfile = "/tmp/lua_xCjkEa"
os.rename(tempfile,listfile)


Where /mnt/sda1 is fat32 and /tmp is ext2.

This issue involves 4.3RC1.

This was not an issue in early versions of the script.

I assume "early versions" would be prior to March 15, when the messy version (i.e. overwriting with an empty file) of the updatedb function was still being used.

Considering the apparent simplicity of the function, I can't see how the script itself is faulty (not saying I'm genius of course).
Perhaps there is an issue with fat32 + os.rename. The error you mentioned occurs if the database file is empty or non-existent, so I'm guessing it's not being moved. I can't think of any reason for this other than a problem with rename.

I assume the temp file download completes, since you didn't get the error "Database check failed".

What happens if you replace os.rename(tempfile,listfile) with os.execute("sudo mv -f "..tempfile.." "..listfile)?

I think that what I said with the first six words that I posted as well as the code posted. os.rename fails. I was just pointing that fact out.

Naturally the native mv works across different filesystems or we would all in trouble

sudo is not needed with the os.execute of the mv command as the target mydsl/ is setup with proper permissions.

I will make that adjustment to your script.

Quote
sudo is not needed with the os.execute of the mv command as the target mydsl/ is setup with proper permissions.
I just thought there might be a chance of problems with moving (as opposed to copying) from fat32. I have no experience with it, and know you're smart enough to notice that sudo is there =o)

Thanks. I'll make the change on my end too.

Next Page...
original here.