2016-02-23 0:22 GMT+03:00 Marc Espie <[email protected]>:
> On Mon, Feb 22, 2016 at 09:08:09PM +0000, Stuart Henderson wrote:
>> On 2016/02/22 15:46, Jiri B wrote:
>> > Hi,
>> >
>> > I did quick install and then I executed 'pkg_add -iv $packages'
>> > under root user.
>> >
>> > The output get spammed with:
>> >
>> > ftp: /root/.netrc: Permission denied
>> >
>> > IIUC this is caused by 'drop_priviledge_and_setup_env' function
>> > in PackageRepository.pm which changes uid to '_pfetch' which
>> > spawns /bin/sh that cannot access root's homedir.
>> >
>> > OpenBSD 5.9 #1880 Sat Feb 20 2016
>> >
>> > * su - root
>> > * export PKG_PATH=$path
>> > * pkg_add -vi $package
>> > * observe terminal
>> >
>> > j.
>> >
>>
>> Confirmed.
>>
>> I guess most of us haven't noticed this yet because we are using
>> HTTP in PKG_PATH because it's so much faster.
>
> Nope, .netrc is ftp's lair. I don't get why ftp (run as pfetch) will try
> to access root's .netrc.

Because you don't reset $HOME?

--
  WBR,
  Vadim Zhukov


Index: PackageRepository.pm
===================================================================
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm,v
retrieving revision 1.117
diff -u -p -r1.117 PackageRepository.pm
--- PackageRepository.pm        9 Feb 2016 10:02:27 -0000       1.117
+++ PackageRepository.pm        22 Feb 2016 21:35:10 -0000
@@ -587,6 +587,7 @@ sub drop_privileges_and_setup_env
                $> = $uid;
        }
        $ENV{LC_ALL} = 'C';
+       $ENV{HOME} = '/var/empty';
        # don't error out yet if we can't change.
 }

Reply via email to