Recent

Author Topic: Writing error when selection gets highlighted  (Read 1980 times)

Rbart

  • New Member
  • *
  • Posts: 19
Writing error when selection gets highlighted
« on: December 09, 2023, 04:55:33 pm »
Hi,

I am getting this error all the time when writing in a unit of a form. It seems to appear when the IDE highlights the code on multiple line or when it want to autocomplete.
The error message is: "Unable to write "/usr/share/lazarus/2.2.6/docs/lcl/menus.xml"
This is annoying. It shows up when typing or selecting code. Why does the IDE want to go write to these xml files?
Am I alone to get this message? What did I do wrong?
How to solve this?
I am on Ubuntu 22.04 with Lazarus 2.2.6

Thank you for your help,
Rbart


Thaddy

  • Hero Member
  • *****
  • Posts: 16201
  • Censorship about opinions does not belong here.
Re: Writing error when selection gets highlighted
« Reply #1 on: December 10, 2023, 11:30:49 am »
Make the folder writable or better, make the folder writable for the user.
If I smell bad code it usually is bad code and that includes my own code.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10561
  • Debugger - SynEdit - and more
    • wiki
Re: Writing error when selection gets highlighted
« Reply #2 on: December 10, 2023, 11:49:41 am »
Do you still have the "FPDoc Editor" window open? https://forum.lazarus.freepascal.org/index.php/topic,65430.msg498544.html#msg498544

Because, as indicated, it may be the one writing to that file.

Otherwise, if you rebuild your IDE with -gl (Tools > Configure build Lazarus), and start it from a console (so it can write to the console) then maybe (just maybe / hopefully) it will print more info (including a stacktrace).



dbannon

  • Hero Member
  • *****
  • Posts: 3156
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Writing error when selection gets highlighted
« Reply #3 on: December 11, 2023, 12:13:45 am »
Make the folder writable or better, make the folder writable for the user.

No, absolutely NOT.  The directory that Lazarus (?) is trying to write to, as an ordinary user, is up in the /usr/share tree.  An ordinary user should not be trying to write there. Making that directory writable is only dealing with the symptom of the problem, the underlying problem will almost certainly manifest it self in some other way as well. (*)

RBart, is there a reason you have the FPDoc tool opening those files ?  Are you updating documentation as you go ?  Great if you are but don't work on a read only file. Make a copy of that file locally or, if you wish to jump around between them, remove your Package installed lazarus and build Lazarus from source, in your own home directory where you write to them all you like.

Very few people find a need to use FPDoc except to update documentation in my view.

Davo

(*) - Its a well know fact the the underlying cause of the fall of the Roman Empire was they started to play with read only permissions in certain file system.





Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

TRon

  • Hero Member
  • *****
  • Posts: 3658
Re: Writing error when selection gets highlighted
« Reply #4 on: December 11, 2023, 12:49:03 am »
No, absolutely NOT.  The directory that Lazarus (?) is trying to write to, as an ordinary user, is up in the /usr/share tree.  An ordinary user should not be trying to write there. Making that directory writable is only dealing with the symptom of the problem, the underlying problem will almost certainly manifest it self in some other way as well. (*)
+1

And anyone reading this and attempting to solve it with running Lazarus as root or providing yourself root permissions in order to circumvent the issue: DON'T. Instead inform yourself on your choice of operating system and obey its rules instead of trying to work around the issue.  Never ever should you require any permission in order to develop software on whatever operating system. For the purists amongst us: the exceptions  to that strict rule is of no concern to/for ordinary users and in case you do not consider yourself an ordinary user then you (should) know what you should do to provide yourself the permissions that are required and doing so in a safe manner.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10561
  • Debugger - SynEdit - and more
    • wiki
Re: Writing error when selection gets highlighted
« Reply #5 on: December 11, 2023, 01:43:40 am »
I have the feeling that he wants to use the "FpDoc Editor" as a help viewer, rather than editor.

However the purpose of it is "Editor".

Users who develop packages (that they then publish) can use it to write the docs.
Or people who want to update Lazarus docs as contribution, but yes, those should have a writeable setup anyway... After all, they would need to have an up to date git checkout.

I can see the use of seeing docs, without needing the mouse to trigger a hint, but I don't think that is implemented (probably not hard to tweak the editor, but...)

Rbart

  • New Member
  • *
  • Posts: 19
Re: Writing error when selection gets highlighted
« Reply #6 on: December 11, 2023, 12:08:25 pm »
Hi,

Thanks for the information. To be honnest, I don't know why this FPDoc was open. I don't use it at this time. I am trying to find my way around this, for me, new IDE and language. Closing it seems to be solving the problem. I was this far as for not giving writing permissions. As it looked not as logical to me to do so with the files the IDE or what now seems to be this FPDoc editor wanted to write on.
I am on Ubuntu 22.04 with the Lazarus 2.2.6. Why should my choise of OS have to matter? Linux and Lazarus follow the same idea. And I kind of like that idea. It shouldn't matter what OS, device or even what version you use. All be it for environmental reasons only.
Still remains the fact that FPDoc wants to write something where it shouldn't be writing, at least I guess. If that is the case on Windows I don't know yet. I will let you know if I use Windows at some time when I unavoidable need it again.

Greetings from Belgium,
Rbart

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10561
  • Debugger - SynEdit - and more
    • wiki
Re: Writing error when selection gets highlighted
« Reply #7 on: December 11, 2023, 12:29:39 pm »
Why should my choise of OS have to matter?
The Linux question does not matter. But it would have, if you had intended to write to that file.

On Windows, the default install location is C:\lazarus => and any user on Windows can write to that.
On Linux install is in /usr/.... and users can't write to it.

Quote
Still remains the fact that FPDoc wants to write something where it shouldn't be writing, at least I guess. If that is the case on Windows I don't know yet. I will let you know if I use Windows at some time when I unavoidable need it again.

FpDoc could probably be improved.

From memory: If you make changes to the content in the FpDoc window, then they will be saved automatically. (And that can be triggered by anything, just moving the caret, or ....)

That part is correct (though could be extended, to allow switching auto-save on/off).

The fact that it autosaves, when nothing was changed... That can be considered anywhere between inconvenience and bug.


And the error message could probably be more informative. I.e. point out that it is caused by the FpDoc Editor.


Rbart

  • New Member
  • *
  • Posts: 19
Re: Writing error when selection gets highlighted
« Reply #8 on: December 11, 2023, 01:02:08 pm »
To be clear. I didn't make changes in the FPDoc window it self. I  was just writing code in the editor. Or trying..    %)
As I see it now, it is a bug. But I could be wrong. It could be a setting. I don't know the IDE enough at this time. At least the error message could be improved.

TRon

  • Hero Member
  • *****
  • Posts: 3658
Re: Writing error when selection gets highlighted
« Reply #9 on: December 11, 2023, 04:27:24 pm »
To be clear. I didn't make changes in the FPDoc window it self. I  was just writing code in the editor. Or trying..    %)
As I see it now, it is a bug. But I could be wrong. It could be a setting. I don't know the IDE enough at this time. At least the error message could be improved.
You would have to go to through a lot of hoops in order to get there in the first place.
- open fpdoc editor
- manually select a file to open (or create), and in this case particularly open a xml file belonging to the lazarus/fpc documentation.
- specifically press the save button to save these changes to file.

In contrary to what martin_fr wrote, I was unable to detect any write actions from the editor when not specifically pressing the save button (but since I am not familiar with fpdoc editor (I use the lazarus doc editor for editing documentation) that might be my doing).

That is unless we are talking about different things here.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10561
  • Debugger - SynEdit - and more
    • wiki
Re: Writing error when selection gets highlighted
« Reply #10 on: December 11, 2023, 08:33:05 pm »
To be clear. I didn't make changes in the FPDoc window it self. I  was just writing code in the editor. Or trying..    %)
As I see it now, it is a bug. But I could be wrong. It could be a setting. I don't know the IDE enough at this time. At least the error message could be improved.

As I said: "The fact that it autosaves, when nothing was changed... That can be considered anywhere between inconvenience and bug."

 

TinyPortal © 2005-2018