Re: installer doesn't modify root path

2016-02-02 Thread Bachsau

> Am 02.02.2016 um 06:33 schrieb Phil Oertel :
> 
> I'm unable to sudo run any port commands after installing macports (version 
> 2.3.4, system is El Capitan 10.11.3). I installed via the package installer. 
> After running the installer and opening a new shell, my login user has 
> /opt/local/bin on his path, but root does not. So `sudo port` results in "not 
> found".

Just edit /etc/paths and you're done.

smime.p7s
Description: S/MIME cryptographic signature
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: installer doesn't modify root path

2016-02-02 Thread Harald Hanche-Olsen
-Original Message-
From: Phil Oertel 
Date: 2 February 2016 at 17:13:59

> Yes, it has both env_reset and a secure_path. And some comments at the top
> indicating that the file is periodically overwritten by Puppet.

Ah, then we have a definite diagnosis! Good. Then what remains is for you to 
negotiate with the puppet admins. Meanwhile, or if you can’t make them change 
their practice, you can always invoke macports via a shell script looking 
somewhat like this:

#!/bin/sh
PATH="/opt/local/bin:/opt/local/sbin:$PATH”
export PATH
exec port “$@“

– Harald
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: installer doesn't modify root path

2016-02-02 Thread Phil Oertel
On Tue, Feb 2, 2016 at 7:40 AM, Harald Hanche-Olsen 
wrote:

> -Original Message-
> From: Phil Oertel 
> Date: 2 February 2016 at 16:31:12
>
> > Entirely possible. I didn't make any such modification personally, but
> it's
> > a work laptop, so I don't know what they've done to the image prior to
> > giving it to me. Maybe I'll get them to stop whatever it is they're doing
> > to sudoers. Thanks, Brandon and Harald, this makes a lot more sense than
> > there being an installer bug :)
>
> You might look to see if they have set secure_path. If you can run sudo,
> surely you can look inside /etc/suoers and see what is there. 8-)
>

Yes, it has both env_reset and a secure_path. And some comments at the top
indicating that the file is periodically overwritten by Puppet.


>
> – Harald
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: installer doesn't modify root path

2016-02-02 Thread Harald Hanche-Olsen
-Original Message-
From: Phil Oertel 
Date: 2 February 2016 at 16:31:12

> Entirely possible. I didn't make any such modification personally, but it's
> a work laptop, so I don't know what they've done to the image prior to
> giving it to me. Maybe I'll get them to stop whatever it is they're doing
> to sudoers. Thanks, Brandon and Harald, this makes a lot more sense than
> there being an installer bug :)

You might look to see if they have set secure_path. If you can run sudo, surely 
you can look inside /etc/suoers and see what is there. 8-)

– Harald
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: installer doesn't modify root path

2016-02-02 Thread Harald Hanche-Olsen
-Original Message-
From: Brandon Allbery 
Date: 2 February 2016 at 16:28:50

> The problem with paths.d is that it adds path entries *after* the standard
> ones, whereas users tend to expect that e.g. /opt/local/bin/python
> "overrides" Apple's /usr/bin/python. So MacPorts edits your .bash_profile
> or .profile to prepend /opt/local/bin to $PATH.

Ah. That explains it; thanks. And that doesn’t work for me because I don’t use 
bash for my login shell, which would be why I made my own hack.

An alternative would have been to modify /etc/paths instead? Or is that too 
global, or something?

– Harald
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: installer doesn't modify root path

2016-02-02 Thread Brandon Allbery
On Tue, Feb 2, 2016 at 10:33 AM, Harald Hanche-Olsen 
wrote:

> An alternative would have been to modify /etc/paths instead? Or is that
> too global, or something?


Same problem, IIRC.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: installer doesn't modify root path

2016-02-02 Thread Phil Oertel
On Tue, Feb 2, 2016 at 7:22 AM, Harald Hanche-Olsen 
wrote:

> -Original Message-
> From: Brandon Allbery 
> Date: 2 February 2016 at 16:06:18
>
> > On Tue, Feb 2, 2016 at 9:57 AM, Harald Hanche-Olsen
> > wrote:
> >
> > > Well, you did not say in the bug report that you were using sudo, so no
> > > wonder it got closed.
> >
> > ? sudo is the recommended way to do this.
>
> Yes, but the way the bug report was phrased, it was very easy to suspect
> that either a root shell had been run using “sudo -i”, or perhaps even by
> enabling the root account and logging in as root – which is definitely not
> recommended, but I have seen this suggestion in the wild – though not
> recently.
>
> > > My own systems are too heavily modified at the moment for me to be
> sure,
> > > but I have a file /etc/paths.d/45-macports containing the two lines
> > >
> > > /opt/local/bin
> > > /opt/local/sbin
> > >
> >
> > This is not standard.
>
> Okay, now I am curious. How does the macports installation manipulate the
> path? As far as I know, the above method is standard, even though it may
> not be what macports does. (If I installed that file there, I must have
> done it because it didn’t work otherwise.)
>
> > I would also suspect a sudoers modification here. The default should
> retain
> > the user's PATH,
>
> That’s what I am finding too, after some experimentation. Even the sudo
> man page agrees, though only if you read it really carefully.
>

Entirely possible. I didn't make any such modification personally, but it's
a work laptop, so I don't know what they've done to the image prior to
giving it to me. Maybe I'll get them to stop whatever it is they're doing
to sudoers. Thanks, Brandon and Harald, this makes a lot more sense than
there being an installer bug :)


> – Harald
>
>
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: installer doesn't modify root path

2016-02-02 Thread Brandon Allbery
On Tue, Feb 2, 2016 at 10:22 AM, Harald Hanche-Olsen 
wrote:

> Okay, now I am curious. How does the macports installation manipulate the
> path? As far as I know, the above method is standard, even though it may
> not be what macports does. (If I installed that file there, I must have
> done it because it didn’t work otherwise.)


The problem with paths.d is that it adds path entries *after* the standard
ones, whereas users tend to expect that e.g. /opt/local/bin/python
"overrides" Apple's /usr/bin/python. So MacPorts edits your .bash_profile
or .profile to prepend /opt/local/bin to $PATH.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: installer doesn't modify root path

2016-02-02 Thread Harald Hanche-Olsen
-Original Message-
From: Brandon Allbery 
Date: 2 February 2016 at 16:06:18

> On Tue, Feb 2, 2016 at 9:57 AM, Harald Hanche-Olsen  
> wrote:
>  
> > Well, you did not say in the bug report that you were using sudo, so no
> > wonder it got closed.
>  
> ? sudo is the recommended way to do this.

Yes, but the way the bug report was phrased, it was very easy to suspect that 
either a root shell had been run using “sudo -i”, or perhaps even by enabling 
the root account and logging in as root – which is definitely not recommended, 
but I have seen this suggestion in the wild – though not recently.

> > My own systems are too heavily modified at the moment for me to be sure,
> > but I have a file /etc/paths.d/45-macports containing the two lines
> >
> > /opt/local/bin
> > /opt/local/sbin
> >
>  
> This is not standard.

Okay, now I am curious. How does the macports installation manipulate the path? 
As far as I know, the above method is standard, even though it may not be what 
macports does. (If I installed that file there, I must have done it because it 
didn’t work otherwise.)

> I would also suspect a sudoers modification here. The default should retain
> the user's PATH,

That’s what I am finding too, after some experimentation. Even the sudo man 
page agrees, though only if you read it really carefully.

– Harald

___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: installer doesn't modify root path

2016-02-02 Thread Brandon Allbery
On Tue, Feb 2, 2016 at 9:57 AM, Harald Hanche-Olsen 
wrote:

> Well, you did not say in the bug report that you were using sudo, so no
> wonder it got closed.
>

? sudo is the recommended way to do this.


> My own systems are too heavily modified at the moment for me to be sure,
> but I have a file /etc/paths.d/45-macports containing the two lines
>
> /opt/local/bin
> /opt/local/sbin
>

This is not standard.


> These should be enough to ensure that those directories appear in the path
> when you run sudo. You can check by running “sudo printenv PATH”. I believe
> that file is installed by the macports installer? If not, you can install
> it yourself. But from what you say, I gather you must have this file? What
> about /etc/sudoers? Have you made any modifications to that file?
>

I would also suspect a sudoers modification here. The default should retain
the user's PATH, but you can configure sudo to always use the target user's
PATH instead, which would lead to this. It would be up to you to arrange
that MacPorts and other software continues to work after such a change.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: installer doesn't modify root path

2016-02-02 Thread Harald Hanche-Olsen
-Original Message-
From: Harald Hanche-Olsen 
Date: 2 February 2016 at 15:57:39

> […] You can check by running “sudo printenv PATH”.  […]

Uh, sorry, I missed the fact that you did show the result of running that, and 
that /opt/local/bin is missing from the output. So the question remains, why? 
As I said, I have fiddled too much with my own system to be sure what things 
look like in a standard setup.

– Harald
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: installer doesn't modify root path

2016-02-02 Thread Harald Hanche-Olsen
Well, you did not say in the bug report that you were using sudo, so no wonder 
it got closed.

My own systems are too heavily modified at the moment for me to be sure, but I 
have a file /etc/paths.d/45-macports containing the two lines

/opt/local/bin
/opt/local/sbin

These should be enough to ensure that those directories appear in the path when 
you run sudo. You can check by running “sudo printenv PATH”. I believe that 
file is installed by the macports installer? If not, you can install it 
yourself. But from what you say, I gather you must have this file? What about 
/etc/sudoers? Have you made any modifications to that file?

– Harald

-Original Message-
From: Phil Oertel 
Date: 2 February 2016 at 06:34:21

> I'm unable to sudo run any port commands after installing macports (version
> 2.3.4, system is El Capitan 10.11.3). I installed via the package
> installer. After running the installer and opening a new shell, my login
> user has /opt/local/bin on his path, but root does not. So `sudo port`
> results in "not found".
>  
> I filed a bug, https://trac.macports.org/ticket/50503, and it was promptly
> closed […]

___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


installer doesn't modify root path

2016-02-01 Thread Phil Oertel
I'm unable to sudo run any port commands after installing macports (version
2.3.4, system is El Capitan 10.11.3). I installed via the package
installer. After running the installer and opening a new shell, my login
user has /opt/local/bin on his path, but root does not. So `sudo port`
results in "not found".

I filed a bug, https://trac.macports.org/ticket/50503, and it was promptly
closed by ryandesign@ with the following explanation: "You're not meant to
use root; you're meant to use sudo from your normal admin user account."
Isn't that the same thing? That is, doesn't any command run via sudo
execute as root, using root's PATH? And in any event, `sudo port version`
results in "sudo: port: command not found". Can anyone advise?

Thanks!

Appendix: some commands and output:
$ port version
Version: 2.3.4
$ sudo port version
Password:
sudo: port: command not found
$ printenv PATH
/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/git/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
$ sudo printenv PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
$ which port
/opt/local/bin/port
$ sudo which port
$
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users