On Mon, Feb 22, 2016 at 10:22:12PM +0100, Marc Espie wrote:
> 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.
>
> But I'm going to look at it later tonight.
Jiri, can you try this patch?
cd /usr/src
patch -p1 -i thepatchfile
cd /usr/src/usr.sbin/pkg_add
make clean
make obj
make
make install
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
index 8bb8f51..d949bcf 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
@@ -600,6 +600,7 @@ sub grab_object
$ftp,
@extra,
"-o",
+ "-n",
"-", $self->url($object->{name})
or $self->{state}->fatal("Can't run ".OpenBSD::Paths->ftp.": #1", $!);
}