Forum > Other

UPD message fail with Error[22] Invalid argument on FreeBSD

(1/2) > >>

ig:
Hi,

This is a rather complex question, so stay with me for a while. I'll sketch the situation as accurate as possible, but if you need more info, give me a call.

I'm running FPC and Lazarus on FreeBSD
OS: FreeBSD 13.1
FPC: 3.2.2
Lazarus: 2.2.2

FPC and Lazarus are Installed using the pkg system

I started with Lazarus 2.2.0 and FPC 3.2.2. Upgraded after a while. The described issue below didn't became visible unit I upgraded to Lazarus 2.2.4. But it's not related to 2.2.4 or even 2.2.6 - I can now also reproduce this on 2.2.2.

Short version:
Sending UDP messages as root user to a server works. Using the same program using a non-privileged user doesn't, i.e. executable is built, but does not work properly,
--- Quote ---Send error[22]: Invalid arguments
--- End quote ---
is reported.


Using Python create a server handling UDP messages:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---import socketscksrv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)scksrv.bind(('127.0.0.1', 23223))scksrv.recvfrom(100)

Logon to FreeBSD as root user and install the additional package lNet.
Create a application with a Form. On the form drop the LUDPComponent.
Write the following program:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button1Click(Sender: TObject);begin  LUDPComponent1.Host := '127.0.0.1';  LUDPComponent1.Port := 23223;  if LUDPComponent1.Connect(LUDPComponent1.Host, LUDPComponent1.Port) then    LUDPComponent1.SendMessage('Hello', Format('%s:%d', [LUDPComponent1.Host, LUDPComponent1.Port]))  else    ShowMessage('Connection failed');end; procedure TForm1.LUDPComponent1Error(const msg: string; aSocket: TLSocket);begin  ShowMessage(msg);end;

Run the application. You'll notice that the message arrives at the server, so no problem.

On the same machine logon a a non-privileged user:
Launch Lazarus, Provide the location of the FPC RTL and start the IDE. You'll notice that the lNet package is not installed. So install the lNet package and rebuild the IDE.

At start-up the IDE now complains that the Fppkg configuration is incorrect. the option is given to change it manually or write. I've selected to write the proposed configuration. The fppkg configuration complains that :

--- Quote ---File: /usr/home/ig/.config/fppkg.cfg

Error: there is a problem with the Fppkg configuration. (Fppkg reports that the RTL is not installed.)

You could try to restore the configuration files automatically, or adapt the configuration file manually.
--- End quote ---



Write the same Python server program and create the same Lazarus application.

Run the Python server and the application.  The result is: Send error [22]: Invalid argument.

At first I thought this was a bug, in either lNet or Lazarus, but I fear the Fppkg configuration together with the Lazarus configuration is wrong. The Fppkg issue never arose of the root user, so I'm a little bit puzzled.

I've analyzed the configuration files for root and non-privileged user, and they differ largely.

* Where does this difference come from?
* Why is there a difference between the root user and the non-privileged user?
* Are there different templates used?
* If so why and what needs adapting?

Zvoni:

--- Quote ---FPC and Lazarus are Installed using the pkg system
--- End quote ---
That's probably your problem.
My guess is access-rights to paths

cappe:
it seems to work for me too, I repeat it seems because I have not investigated.

ig:

--- Quote from: cappe on March 31, 2023, 11:42:22 am ---it seems to work for me too, I repeat it seems because I have not investigated.

--- End quote ---

Could you post your configuration details?
FreeBSD version, patch level?
FPC version?
Lazarus version?

Configuration files?

marcov:

--- Quote from: ig on March 31, 2023, 08:30:18 am ---Run the Python server and the application.  The result is: Send error [22]: Invalid argument.

--- End quote ---

Who gets that error ? What does krace /truss say about it?


Navigation

[0] Message Index

[#] Next page

Go to full version