Using the SmartServer of v0.15 with xinetd

John Arbash Meinel john at arbash-meinel.com
Thu Apr 12 17:16:58 BST 2007


Thomas Ackermann wrote:
> John Arbash Meinel schrieb:
>> What is $HOME set to for the running bzr process?
>>
>> If you are getting a failure to open /root/.bzr.log it sounds like $HOME
>> is set to /root. Which will also have implications for ~/.bazaar/
>> ~/.bazaar/plugins, etc.
>>   
> 
> Hello John,
> "bzr" is started from "xinted" but as user "bzruser".
> 
> I configured .profile and .bashrc in the $HOME of "bzruser" to
> explicitely set it:
> 
> localhost:~ # su - bzruser
> bzruser at localhost:~> echo $HOME
> /home/archive/bzr

Well, if $HOME is set to /root, then it won't be running the .profile in
/home/archive/bzr.

Notice that above you used "su - bzruser" the '-' indicates to switch
your environment.

It may be that xinetd is only using the equivalent of "su bzruser" which
leaves the environment of root, but just runs as the user 'bzruser'.


> 
> Let´s test:
> 
> bzruser at localhost:~> bzr log bzr://localhost:22618
> bzr: ERROR: Generic bzr smart protocol error: unexpected smart server
> error: ("failed to open trace file: [Errno 13] Permission denied:
> '/root/.bzr.log'",)
> 
> 
> 
> No chance :-(
> 
> Do i possibly need to add some variable to the brz-file in
> /etc/xinetd.conf?!?

Well, another thing you could try is to have xinetd spawn something as
'bzruser' which just does:

echo $HOME

service bzr
{
        server_args     =
        log_on_success  += DURATION USERID
        log_on_failure  += USERID
        nice            = 10
        disable         = no
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = bzruser
        server          = /bin/env
        port            = 22618
}

Running that on my machine gave me something like:
LC_MONETARY=en_US
HOSTNAME=juju.arbash-meinel.com
TERM=xterm-color
SHELL=/bin/bash
HISTSIZE=1000
PERL5LIB=/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi:/usr/lib/perl5/site_perl/5.8.6
LC_NUMERIC=en_US
LC_ALL=en_US
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
LC_MESSAGES=en_US
LC_COLLATE=en_US
PWD=/root

Interestingly enough, there was no "$HOME" set.

You might consider writing a bash wrapper script like:

bzr_as_bzruser.sh:

#!/bin/sh
su - bzruser -c "bzr "$*""


I'm not sure of the exact syntax, and I would guess there is a better
way to configure xinetd, but I don't know xinetd very well.

John
=:->



More information about the bazaar mailing list