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.
Ahah! unsetting HOME should be enough to get rid of this!
(which makes sense since _pfetch doesn't have a real home anyway)
Index: OpenBSD/PackageRepository.pm
===================================================================
RCS file:
/build/data/openbsd/cvs/src/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm,v
retrieving revision 1.117
diff -u -p -r1.117 PackageRepository.pm
--- OpenBSD/PackageRepository.pm 9 Feb 2016 10:02:27 -0000 1.117
+++ OpenBSD/PackageRepository.pm 22 Feb 2016 21:27:05 -0000
@@ -587,6 +587,7 @@ sub drop_privileges_and_setup_env
$> = $uid;
}
$ENV{LC_ALL} = 'C';
+ delete $ENV{HOME};
# don't error out yet if we can't change.
}