LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with inifile.fp under Linux

Hello all,
I noticed a problem with inifile.fp under Linux: I can't write the updated
ini file !

hConfigFile = Ini_New(0);
if (Ini_ReadFromFile (hConfigFile, ConfigPath));

Ini_GetInt(hConfigFile, "Client", "ChartsRefreshRate", &ChartsRefreshRate);
Ini_GetInt(hConfigFile, "Client", "ChartsDuration", &ChartsDuration);

.... Change the values ...

Ini_PutInt(hConfigFile, "Client", "ChartsRefreshRate", ChartsRefreshRate);
Ini_PutInt(hConfigFile, "Client", "ChartsDuration", ChartsDuration);

if (0!=(Err=Ini_WriteToFile (hConfigFile, ConfigPath)))
fprintf(stderr, "\nWarning: problem writing %s configuration files: %s",
ConfigPath, GetUILErrorString(Err));

This fails and displays:
Warning: problem writing Config.ini configuration files: File not found

But not only that, it also deletes the ConfigPath file !!!
Which is rather unacceptable !

I see that the inifile.fp I have on the PC (CVI 8.5) is different than the
one I have on the Linux install (cvicc 8.0). Can I copy all the inifile.*
files to Linux or is it more complicated than that ?
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 1 of 7
(4,040 Views)
I did a quick workaround with Ini_WriteGeneric and a custom function with a
fprintf, but still, I think that's a bug.
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 2 of 7
(4,026 Views)

Hi Guillaume,

 

This definitely sounds like a bug. Thank you for reporting it. I've created an internal bug report: 133763

 

Replacing the 8.0 version of inifile with the 8.5 version might be possible, but the odds of it fixing this are pretty low. This sounds like a Linux-specific bug, and I'm not aware of any similar bug that was fixed between 8.0 and 8.5. However, if you want to try it, make sure you back up the 8.0 version before trying to build with the 8.5 version. It might not link correctly if, for example, the 8.5 version of inifile.c uses functions that were not available with the 8.0 runtime.

 

Luis

0 Kudos
Message 3 of 7
(4,019 Views)
Thanks for putting it in the buglist.

I tried using the 8.5 code, but I got all kinds of compile errors, in the
end I just did like I said in my previous post.
I looked at the offending code and it does all sort of crafty things instead
of simply saving the file (looking for file presence, saving to temp file,
moving, deleting in case of interim failure, etc...).
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 4 of 7
(4,006 Views)

Hi Guillaume

 

(I realize it has been a while, but I thought I'd ask anyway, in case you still remember this).

 

I was investigating this bug today, but so far I haven't been able to reproduce it. I tried it in both Windows and Linux, with both a writeable location for the test .ini file and a non-writeable location, but so far the behavior is as expected. Ini_WriteToFile does return an error when the location isn't writeable, but it doesn't delete the file.

 

So I was wondering whether this might be related to the specific path you were using, or maybe even with the content of the .ini file itself. I don't suppose you would remember whether there was anything unusual about the path, would you? Also, do you happen to still have this .ini file lying around somewhere and wouldn't mind sharing it with me?

 

Luis

0 Kudos
Message 5 of 7
(3,638 Views)
Hello Luis,

I came here to check if a new version of CVI (cvicc, not the real-time
module) for Linux had come out and, sadly, it appears that's still not the
case...

But I saw your followup to our original discussion.

The ini file has grown tremendously since then, but I think I had the
problem with even the most basic file: simple name (same directory, no
path), but maybe it was on an NFS directory (that's no longer the case).

Also the fact that instead of writting _in_ the file (where permission was
allowed) you wrote to a temp file (that may not have had permission) and
then renamed accordingly...
I'll start a new project soon that will require ini files, so I'll test it
again.

> (I realize it has been a while, but I thought I'd ask anyway, in case you
> still remember this).  
> I was investigating this bug today, but so far I haven't been able to
> reproduce it. I tried it in both Windows and Linux, with both a
> writeable location for the test .ini file and a non-writeable location,
> but so far the behavior is as expected. Ini_WriteToFile does return an
> error when the location isn't writeable, but it doesn't delete the file.
>   So I was wondering whether this might be related to the specific
> path you were using, or maybe even with the content of the .ini file
> itself. I don't suppose you would remember whether there was anything
> unusual about the path, would you? Also, do you happen to still have this
> .ini file lying around somewhere and wouldn't mind sharing it with me?
>   Luis

--
Guillaume Dargaud
http://www.gdargaud.net/
0 Kudos
Message 6 of 7
(3,555 Views)

Hello Guillaume - 

 

I just wanted to let you know that the LabWindows/CVI 2010 Run-Time Module for Linux is now in beta.  You can register for the beta program at ni.com/beta by picking LabWindows/CVI Run-Time Module for Linux from the drop down list.  We look forward to hearing from you and anyone else with interest in Linux.

 

NickB

National Instruments

0 Kudos
Message 7 of 7
(3,477 Views)