Subject: Re: Can't setenv more than one path
To: None <port-i386@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-i386
Date: 02/11/2005 21:34:56
> Whenever setenv receives more than one path it says
> /path/to/packages:Permission denied, where /path/to/packages would be
> the last in the list.
> For example, "setenv PKG_PATH
> /mnt/flash/bin;/mnt/cdrom/packages/i386/All" it gives "Permission
> denied" for the last path, which in this case would be
> "/mnt/cdrom/.../All".

> Is there something I am doing wrong?

Yes.

; is a command separator for csh and derivatives (which I infer you are
using from your mention of setenv).  You need to quote it if you want
it to become part of setenv's second argument.

Typing
	setenv PKG_PATH /mnt/flash/bin;/mnt/cdrom/packages/i386/All
is approximately equivalent to typing
	setenv PKG_PATH /mnt/flash/bin
	/mnt/cdrom/packages/i386/All
which is where the error is coming from.

> There is nothing in the manual about this.

I believe there is, but not where you're probably looking.  Check the
csh manpage and I believe you'll find that it says that "[s]equences of
pipelines may be separated by `;', and are then executed sequentially".

You can quote the ; in any of three ways: backslash, double quotes, or
single quotes:

	setenv PKG_PATH /mnt/flash/bin\;/mnt/cdrom/packages/i386/All
	setenv PKG_PATH "/mnt/flash/bin;/mnt/cdrom/packages/i386/All"
	setenv PKG_PATH '/mnt/flash/bin;/mnt/cdrom/packages/i386/All'

There are many variants possible, such as

	setenv PKG_PATH /mnt/fla'sh/bin;/mn't/cdrom/packages/i386/All

that vary in exactly what other characters are quoted.  Since the ; is
the only special character involved, it doesn't much matter what other
parts of the string get quoted.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B