Moving sources (base/ports) from /usr

Polytropon freebsd at
Wed May 20 10:22:05 UTC 2020

On Wed, 20 May 2020 11:08:33 +0100, Steve O'Hara-Smith wrote:
> On Wed, 20 May 2020 11:52:00 +0200
> Ede Wolf <listac at> wrote:
> >  > 	That makes sense it isn't being picked up by make.
> > 
> > Sure, once you think about it.
> > 
> > But here is the strange part. I've exported SOURCEDIR via /etc/profile 
> 	Which means that it will be picked up by /bin/sh.

If invoked as a login shell; "man sh" says:

     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
     considered an interactive shell.  An interactive shell generally prompts
     before each command and handles programming and command errors
     differently (as described below).  When first starting, the shell
     inspects argument 0, and if it begins with a dash (-), the shell is
     also considered 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 in a user's home
     directory, if they exist.  If the environment variable ENV is set on
     entry to a shell, or is set in the .profile of a login shell, the shell
     then subjects its value to parameter expansion and arithmetic expansion
     and reads commands from the named file.  Therefore, a user should place
     commands that are to be executed only at login time in the .profile file,
     and commands that are executed for every shell inside the ENV file.  The
     user can set the ENV variable to some file by placing the following line
     in the file .profile in the home directory, substituting for .shrc the
     filename desired:

           ENV=$HOME/.shrc; export ENV

Maybe it helps setting SOURCEDIR in /root/.shrc, assuming
that root will execute the commands (and uses sh for that).

> > and it is set. However, mergemaster does not recognize it.
> > Then I export the same variable again on the command line and it works:
> 	By default root login uses /bin/csh which doesn't load /etc/profile
> but rather /etc/csh.cshrc and /etc/csh.login.

That was my suspicion too, but in case it was a C shell,
the commands for re-setting and re-exporting SOURCEDIR
would have failed, as csh requires a different syntax.

So it seems that it's really sh. :-)

However, the presented behaviour is quite strange. It
has been shown (!) that $SOURCEDIR is somehow set, but
mergemaster requires it to be set again?

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list