vere
vere copied to clipboard
conn: do not chdir for conn.sock
Instead, we create the socket in a temporary directory - TMPDIR
if it is not too long, or else /tmp
. The directory is made via mkdtemp
with the template urbit-XXXXXX
. The socket is located there (getting around the length limit) and $pier/.urb/conn.sock
is symlinked to it.
This fixes an issue where if urbit is started with sudo -u pieruser
from a directory that the pier user doesn't have access to (e.g. a different user's home directory that is chmod 0750), the process would die trying to chdir
back to the old directory.
It also gives clients more flexibility; previously, they would have had to chdir
to the pier directory to connect to the socket without risking overrunning the length limit. They can still do that (and use ".urb/conn.sock"
as their sun_path
), but they now also have the option of using readlink
and connecting to the full absolute path of the socket without changing directories.
Replaces calls to uv_strerror
with strerror
for system calls; the former does not print system call errors properly.
Supersedes #580.
I'm actually indifferent as to whether this or #580 is taken. I think this is a slightly better solution, since it allows clients to always be able to specify the full absolute path to the socket when connecting to it. But either way is fine.
@pkova Are you the right person to review this?
Oh, I guess now there's also lick.c
.
In that case the temporary directory should probably be stored on u3_Host
or u3C
or something and created in main.c
. Right?
@mopfel-winrux how do you want to handle %lick
? I don't have much insight yet into what it's doing. Would it make sense for it to follow suit with this change and use a tmp directory for its sockets?
If not, then the next best thing is probably to reopen #580 and also apply that to lick.c
.
@mrdomino I'm sorry I completely missed this. We should also do this for lick.c
Yeah. How does lick work? Does it make one socket or many?
I guess it's going to be necessary to track and manage the temp dir from some location that is neither conn.c nor lick.c if we go this route.
I also gave a little thought to putting the socket directory under /run/urbit/sampel-palnet rather than /tmp/urbit-XXXXXX. I'm leaning towards /tmp at the moment, but could be persuaded either way. On Saturday, March 2nd, 2024 at 17:56, mopfel-winrux @.***> wrote:
@.***(https://github.com/mrdomino) I'm sorry I completely missed this. We should also do this for lick.c
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
It makes multiple sockets. One per [%spin name=path]
card it is given. It puts them in `.urb/dev/ folder under the name path. we could use that directory
Ok, so supposing we want to keep sockets symlinked in the pier directory, maybe we can just do a symlink from dev under the temp directory to dev under the pier directory?
On Monday, March 11th, 2024 at 06:32, mopfel-winrux @.***> wrote:
It makes multiple sockets. One per [%spin name=path] card it is given. It puts them in `.urb/dev/ folder under the name path. we could use that directory
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>