Re: home-syncthing-service-type wants /root paths, yet syncthing can work

2024-01-09 Thread Ludovic Courtès
Hi,

Tomas Volf <~@wolfsden.cz> skribis:

> Hi,
>
> On 2024-01-05 15:05:38 +0100, Sébastien Lerique wrote:
>> Hi Guix! And dear helpers and devs,
>>
>> I'm running into a weird failure of home-syncthing-service-type.
>>
>> Running syncthing manually from the terminal works fine (here's an example
>> log: ).
>>
>> So I Ctrl-C syncthing, then add home-syncthing-service-type to my
>> home-configuration 
>> 
>> (bottom lines).
>>
>> After restarting, home-syncthing-service-type fails synchronizing because it
>> bases all user folders inside /root, to which it doesn't have writing
>> rights. This happens whether all syncthing configurations in
>> `.local/state/syncthing` had been removed in the meantime or not. Here's a
>> log: 
>>
>> Could this be a bug? A mistake in the configuration files?
>
> After some digging in the source code, I managed to pinpoint the cause.  Your
> configuration does not set user nor home, which causes Guix to call (getpw 
> #f).
> That returns the root user.  I would say this is a bug.  The code probably
> should be something like this (untested):
>
> (or #$home (passwd:dir (getpw (if (and #$home-service? (not #$user)) 
> (getuid) #$user

Agreed.  Sébastien, could you confirm and send a patch?

Thanks,
Ludo’.



Re: home-syncthing-service-type wants /root paths, yet syncthing can work

2024-01-06 Thread Tomas Volf
Hi,

On 2024-01-05 15:05:38 +0100, Sébastien Lerique wrote:
> Hi Guix! And dear helpers and devs,
>
> I'm running into a weird failure of home-syncthing-service-type.
>
> Running syncthing manually from the terminal works fine (here's an example
> log: ).
>
> So I Ctrl-C syncthing, then add home-syncthing-service-type to my
> home-configuration 
> 
> (bottom lines).
>
> After restarting, home-syncthing-service-type fails synchronizing because it
> bases all user folders inside /root, to which it doesn't have writing
> rights. This happens whether all syncthing configurations in
> `.local/state/syncthing` had been removed in the meantime or not. Here's a
> log: 
>
> Could this be a bug? A mistake in the configuration files?

After some digging in the source code, I managed to pinpoint the cause.  Your
configuration does not set user nor home, which causes Guix to call (getpw #f).
That returns the root user.  I would say this is a bug.  The code probably
should be something like this (untested):

(or #$home (passwd:dir (getpw (if (and #$home-service? (not #$user)) 
(getuid) #$user

For your immediate problem, explicitly setting the (home) field in the
syncthing-configuration should help.  I think.

Have a nice day,
Tomas Volf

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.


signature.asc
Description: PGP signature


home-syncthing-service-type wants /root paths, yet syncthing can work

2024-01-06 Thread Sébastien Lerique

Hi Guix! And dear helpers and devs,

I'm running into a weird failure of home-syncthing-service-type.

Running syncthing manually from the terminal works fine (here's an 
example log: ).


So I Ctrl-C syncthing, then add home-syncthing-service-type to my 
home-configuration 
 
(bottom lines).


After restarting, home-syncthing-service-type fails synchronizing 
because it bases all user folders inside /root, to which it doesn't have 
writing rights. This happens whether all syncthing configurations in 
`.local/state/syncthing` had been removed in the meantime or not. Here's 
a log: 


Could this be a bug? A mistake in the configuration files? In case it's 
useful, the system config is 
, and 
the versions:


sl@beoga ~> guix describe
Generation 3Jan 03 2024 23:08:17(current)
  guix 7b0863f
repository URL: https://git.savannah.gnu.org/git/guix.git
branch: master
commit: 7b0863f07a113caef26fea13909bd97d250b629e
  guix-science 4e7057c
repository URL: https://github.com/guix-science/guix-science.git
branch: master
commit: 4e7057ceafba901f619bac068c74c6df158fd4ec
  nonguix 8956906
repository URL: https://gitlab.com/nonguix/nonguix
branch: master
commit: 8956906f6bed6709e71f0c26ed6a3620f40dc487

Best to all, and thanks for any answer!
Sébastien