[darcs-users] Re: push --and-apply over ssh uses limited path

Samuel Tardieu sam at rfc1149.net
Mon Mar 1 02:02:11 UTC 2004


>>>>> "Donald" == Donald Bruce Stewart <dons at cse.unsw.edu.au> writes:

Donald> Push --and-apply uses ssh to exec the command 'darcs apply' on
Donald> the remote system. ssh doesn't execute that command in the
Donald> shell: it executes it directly, so unless darcs is installed
Donald> in the system's default PATH, push won't work.

Donald> We can fix this by executing an ssh "sh -lc darcs" instead, so
Donald> that users can set up a .profile with any extra environment
Donald> goo.

I think this is a very bad idea for several reasons:

  - "-l" is not a standard sh option (it is not present on my FreeBSD
    box for example)

  - if as I guess it means "login shell", this is certainly not the
    truth here; a login shell is supposed to setup an environment when
    you log in (such as asking you for your ssh-agent key), it is
    interactive

I do not understand why you do not choose a better default shell (zsh
for example) with your PATH sets in the appropriate file? (.zshenv
here)

Donald> This also solves another problem. On my remote system they set
Donald> the default umask to 077. This stuffs up group access to my
Donald> repository when I push over ssh: every push resets the file
Donald> modes back to 700.

A right umask can be set in two ways:

   - put it in your .zshenv (or equivalent) file

   - put a darcs wrapper in your PATH which does contains something
     like:
        #! /bin/sh
        umask 700
        /path/to/real/darcs "$@"        

Donald> Anyway, here is a simple patch to fix both problems, allowing
Donald> for the user's .profile to be respected.
 
It should not be respected here. Note that FreeBSD "sh" manpage makes
no distinction between "login" and "interactive" shells:

|  If no arguments are present and if the standard input of the shell is
|  connected to a terminal (or if the -i option is set), the shell is con-
|  sidered an interactive shell.  An interactive shell generally prompts
|  before each command and handles programming and command errors differ-
|  ently (as described below).  When first starting, the shell inspects
|  argument 0, and if it begins with a dash (-), the shell is also consid-
|  ered a login shell.  This is normally done automatically by the system
|  when the user first logs in.  A login shell first reads commands from the
|  files /etc/profile and then .profile if they exist.

  Sam
-- 
Samuel Tardieu -- sam at rfc1149.net -- http://www.rfc1149.net/sam





More information about the darcs-users mailing list