On 5/21/07, Tassilo Horn <[EMAIL PROTECTED]> wrote:
> Martin Bähr
> <[EMAIL PROTECTED]>
> writes:
>
> Hi Martin,
>
> > On Mon, May 21, 2007 at 08:51:49AM +0200, Tassilo Horn wrote:
> >> I've converted some of my little admin scripts to fish functions
> >> residing in /root/.config/fish/functions/. Some days ago I discovered
> >> how convenient the `sudo' [1] utility program is. But unfortunately
> >> it seems to be unable to find and execute root's fish functions.
> >
> > could it be that sudo does not execute fish to find the command?
>
> I've thought that, too, but this also fails:
>
> [EMAIL PROTECTED] ~/u/r/st-ss07> sudo fish -c do-update
> Password:
> fish: Unknown command "do-update"
> Standard input: do-update
>                 ^

sudo does not use any terminal to expand it's parameters, so a plain
'sudo ll' does not seem to work. This is true for both fish and bash.

The following works, though:

sudo fish -c ll

The reason why the same thing doesn't work with your own functions
seems to be an init path issue - sudo does not clear the $HOME
variable of the calling process, and because of this, fish looks into
e.g. /home/tassilo/.configure/fish/functions instead of the equivalent
directory in /root. I don't know what the reasoning behind not setting
$HOME in sudo is and if it serves any higher purpose, but there are
various reasons for relying on $HOME to determine the location of ~
instead of using info from /etc/passwd having to do with wanting to
install software as another user and such. It should be noted that su
does change $HOME.

I don't know how to best resolve this. Perhaps it is a sudo bug?
Suggestions are welcome.

Axel


> Bye,
> Tassilo
> --
> On his  birthday, Chuck  Norris randomly selects  one lucky child  to be
> thrown into the sun.

--
Axel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to