Lazarus

Using the Lazarus IDE => General => Topic started by: johnmc on August 30, 2022, 03:14:38 pm

Title: LHelp causes error on exit
Post by: johnmc on August 30, 2022, 03:14:38 pm
I am getting a error message when exiting LHelp (CHM File Viewer) it is unable to write to a file ...\AppData\local\lhelp\lhelp-lazhelp.co.... Access is denied.

Why would it even need to access this file or directory if it existed which it doesn't.

John
Title: Re: LHelp causes error on exit
Post by: dsiders on August 30, 2022, 05:38:41 pm
I am getting a error message when exiting LHelp (CHM File Viewer) it is unable to write to a file ...\AppData\local\lhelp\lhelp-lazhelp.co.... Access is denied.

Why would it even need to access this file or directory if it existed which it doesn't.

John

It is trying to write its configuration file: lhelp-lazhelp.conf.

Which Lazarus version?
Which Windows version?
Did you install Lazarus using a user account different than the one receiving the error?
Have you tried disabling virus protection to see if the error goes away?



Title: Re: LHelp causes error on exit
Post by: johnmc on August 30, 2022, 06:13:27 pm
A sorry should have included that info.
Lazarus 2.2.2 (rev lazarus_2_2_2) FPC 3.2.2 x86_64-win64-win32/win64
Windows 7 Pro.

Title: Re: LHelp causes error on exit
Post by: wp on August 30, 2022, 10:29:05 pm
What did you do when this error happened? I opened LHelp by clicking into the "classes" in the uses clause of the default empty project and pressing Ctrl+F1. The help file opened, and I navigated a bit in the help file. Then I closed LHelp and did not experience any error. I used the same Lazarus/LHelp version as you, only on Win 11.

P.S.
I wonder why LHelp writes is configuration into the system's config folder, rather than into the Lazarus config folder. This causes a problem when multiple Lazarus installations are on a system as secondary installations, and all these installations access the same LHelp config which, for example, contains a list of the recently opened help files stored as full paths. Therefore, I guess it could happen that I unknowingly open the chm files of other installations...

There are two types of conf files in the %appdata% config folder: a lhelp-standalone.conf written when LHelp is used as a stand-alone application, and a lhelp-lazhelp.conf written when LHelp is opened by Lazarus. I think the latter one should be written to the Lazarus configuration of the version which opened LHelp.
Title: Re: LHelp causes error on exit
Post by: johnmc on August 31, 2022, 12:13:29 pm
I open LHelp by clicking into the "classes" in the uses section of my program, the press F1, Ctl+F1 does nothing. I can navigate around the various sections of the LHelp. Selecting either Menu File>Exit or Alt+F4 , or selecting the x in the top right and then yes to really exit all result in a the error.

I have only one installation of Lazarus and I was was the installer ( not installed as administrator). the installation is in the default location c:\Lazarus.
Title: Re: LHelp causes error on exit
Post by: wp on August 31, 2022, 12:39:28 pm
This is the same that I am doing (except for the F1/Ctrl+F1 difference which is because I use the classic keyboard layout).

Does the lhelp-lazhelp.conf file already exist in c:\users\<your name>\appdata\local\lhelp? If yes is it write-protected (check in the Explorer)? Can you create some arbitrary file in this folder from the Explorer?

What happens when you run LHelp separately from the IDE? It is in folder components/chmhelp/lhelp of your Lazarus installation. You can also load the lhelp project from this folder in the IDE and debug it to find out where exactly the issue happens.
Title: Re: LHelp causes error on exit
Post by: johnmc on September 01, 2022, 12:55:29 pm
There is no file or directory  "c:\users\<your name>\appdata\local\lhelp"!

Outside of the IDE LHelp opens but has no contents but does not create the error on closing.
Title: Re: LHelp causes error on exit
Post by: wp on September 01, 2022, 01:48:45 pm
There is no file or directory  "c:\users\<your name>\appdata\local\lhelp"!
This directory is created automatically with the config file when LHelp closes. Just to make sure: you did replace the "<your name>" in the path by your user name in Windows? Do the parent directories appdata and appdata\local of lhelp exist in the c:\users\<your name>? Or did you reconfigure Windows to point the user config directory (c:\users\<your name>) to somewhere else?

Outside of the IDE LHelp opens but has no contents but does not create the error on closing.
You can navigate to the Lazarus help directory ( folder docs\chm in your Lazarus installation) and open one of the chm files manually. When you close LHelp it should create the folder c:\users\<your name>\appdata\local\lehlp (if it does not exist) and write the lhelp-standalone.conf file to it.
Title: Re: LHelp causes error on exit
Post by: marcov on September 01, 2022, 02:22:03 pm
It might be some complicated setup for e.g. educational (lab) PCs that only allow to store on the net (roaming).

But this will break more programs than just lazarus lhelp. Maybe best would be to check if local writing succeeds and try roaming otherwise.
Title: Re: LHelp causes error on exit
Post by: johnmc on September 01, 2022, 02:41:18 pm
You can navigate to the Lazarus help directory ( folder docs\chm in your Lazarus installation) and open one of the chm files manually. When you close LHelp it should create the folder c:\users\<your name>\appdata\local\lehlp (if it does not exist) and write the lhelp-standalone.conf file to it.
Not present and not created with standalone LHelp. But no errors on exit.


It might be some complicated setup for e.g. educational (lab) PCs that only allow to store on the net (roaming).

No just my personal laptop.


Title: Re: LHelp causes error on exit
Post by: marcov on September 01, 2022, 03:51:48 pm
It might be some complicated setup for e.g. educational (lab) PCs that only allow to store on the net (roaming).

No just my personal laptop.

If it is a standard install then it is weird and not normal. Probably the old bogeyman antivirus or multiple lhelp instances (does lhelp have a single instance policy?)
Title: Re: LHelp causes error on exit
Post by: johnmc on September 01, 2022, 08:42:52 pm
I have found the problem. Somehow the directory and files in it were hidden and read only.

Now fixed, I hope.
Title: Re: LHelp causes error on exit
Post by: MarkMLl on September 01, 2022, 09:51:20 pm
I have found the problem. Somehow the directory and files in it were hidden and read only.

I wonder why that was a problem?

I've certainly seen alignment issues in lhelp but I'd have thought that provided the relevant files existed it should have worked.

MarkMLl
Title: Re: LHelp causes error on exit
Post by: johnmc on September 02, 2022, 02:45:51 pm
I have found the problem. Somehow the directory and files in it were hidden and read only.

I wonder why that was a problem?

I've certainly seen alignment issues in lhelp but I'd have thought that provided the relevant files existed it should have worked.

MarkMLl

If its trying to write to a readonly files then that should be a problem.

My concern is why were they set as readonly, I don't think that its lhelp because there were a lot of other directories set as readonly, anyway now they are visible and read/write. I will keep an eye on them.

John
Title: Re: LHelp causes error on exit
Post by: Arioch on October 01, 2022, 04:07:24 pm
I wonder why that was a problem?

just a blind shot:  LHelp was first run out of the installer, so it was running "with root privileges" (UAC elevated user in Vista+ terms, admin user in XP- terms), and all the files created by it in the session inherited this admin-only credentials. Then regular user program indeed can not touch it.

Was hits when making a trial box program, the installer had a checkbox to immediately run the program, but then it no more could be executed by restricted users ever again


Quote
I've certainly seen alignment issues in lhelp but I'd have thought that provided the relevant files existed it should have worked.

My AppData\Local\lhelp\lhelp-lazhelp.conf is writeable, yet i see broken layouts too. Not related.

My guess is different though, but it is a blind guess too, i did not looked into details.
I think they use bleeding edge HTML/JS/CSS generated for recent Chrome, yet LHelp itself uses some old limited rendered, like THTMLFrame with its HTML 3.x internals. Just a guess though.
Title: Re: LHelp causes error on exit
Post by: MarkMLl on October 01, 2022, 04:30:26 pm
just a blind shot:  LHelp was first run out of the installer, so it was running "with root privileges" (UAC elevated user in Vista+ terms, admin user in XP- terms), and all the files created by it in the session inherited this admin-only credentials. Then regular user program indeed can not touch it.

But he specifically said that the files were readable (albeit hidden).

I can see that there might have been a problem if the directory that contained them wasn't writeable and lhelp was trying to create an index in-situ, but that's information we haven't yet been given.

MarkMLl
Title: Re: LHelp causes error on exit
Post by: Arioch on October 01, 2022, 04:43:23 pm
But he specifically said that the files were readable (albeit hidden).

sure.

you can read /bin/sh and /bin/bash and /bin/login as mere user can't you? how would you work otherwise

they are perfectly readable, but they are not writeable
Title: Re: LHelp causes error on exit
Post by: MarkMLl on October 01, 2022, 05:02:53 pm
they are perfectly readable, but they are not writeable

I'll try again: why would files not being writeable upset lhelp, which one would expect to only need RO access?

MarkMLl
Title: Re: LHelp causes error on exit
Post by: Arioch on October 01, 2022, 05:09:21 pm
one would expect to only need RO access?

because that is not so :-)

R/O files are files in Program Files (or /usr/bin, /usr/share) - the files that constitute immutable "product distribution"

%AppData%\* is the home dir, ~/.* - hence the place is supposed to contain mutable temporary files and configs

On my box this file consists of

Code: Pascal  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <CONFIG>
  3.   <TChmContentProvider>
  4.     <TabControlWidth Value="227"/>
  5.   </TChmContentProvider>
  6.   <Position Maximized="False">
  7.     <Left Value="2307"/>
  8.     <Top Value="293"/>
  9.     <Width Value="1145"/>
  10.     <Height Value="755"/>
  11.   </Position>
  12.   <LastFileOpen Value="D:\Books\%%thormotors\APT Server.chm"/>
  13.   <Recent>
  14.     <ItemCount Value="10"/>
  15.     <Item0 Value="file://D:\fpcupdeluxe\lazarus\docs\chm\ref.chm"/>
  16.     <Item1 Value="file://D:\fpcupdeluxe\lazarus\docs\chm\user.chm"/>
  17.     <Item2 Value="file://D:\fpcupdeluxe\lazarus\docs\chm\toc.chm"/>
  18.     <Item3 Value="file://D:\fpcupdeluxe\lazarus\docs\chm\rtl.chm"/>
  19.     <Item4 Value="file://D:\fpcupdeluxe\lazarus\docs\chm\prog.chm"/>
  20.     <Item5 Value="file://D:\fpcupdeluxe\lazarus\docs\chm\lcl.chm"/>
  21.     <Item6 Value="file://D:\fpcupdeluxe\lazarus\docs\chm\lazutils.chm"/>
  22.     <Item7 Value="file://D:\fpcupdeluxe\lazarus\docs\chm\fpdoc.chm"/>
  23.     <Item8 Value="file://D:\fpcupdeluxe\lazarus\docs\chm\fclres.chm"/>
  24.     <Item9 Value="file://D:\fpcupdeluxe\lazarus_deb\docs\chm\lazutils.chm"/>
  25.   </Recent>
  26.   <OpenSepTabs Value="True"/>
  27.   <OpenWithStatus Value="True"/>
  28. </CONFIG>
  29.  
TinyPortal © 2005-2018