From: Jeremie Courreges-Anglas Subject: Re: portimport(1): default to -p/usr/ports and avoid silly error To: ports@openbsd.org Date: Tue, 30 Jun 2026 18:37:26 +0200 On Tue, Jun 30, 2026 at 05:15:02PM +0100, Stuart Henderson wrote: > On 2026/06/30 18:02, Jeremie Courreges-Anglas wrote: [...] > > Index: portimport > > =================================================================== > > RCS file: /cvs/ports/infrastructure/bin/portimport,v > > diff -u -p -r1.10 portimport > > --- portimport 19 Feb 2020 17:53:18 -0000 1.10 > > +++ portimport 30 Jun 2026 15:26:34 -0000 > > @@ -29,7 +29,7 @@ usage() { > > } > > > > user=$(id -un) > > -portsdir= > > +portsdir=/usr/ports > ... > > -portsdir=${portsdir:-${PWD%"/$pkgpath"}} > > how about this? > > portsdir=${portsdir:-/usr/ports} What would be the indended difference in behavior? The proposed diff aligns the handling of $portsdir with the handling of $user. I strongly suspect that the lack of readability of constructs such as portsdir=${portsdir:-${PWD%"/$pkgpath"}} hindered our understanding of the script during all these years. > > grep -q "^@new" pkg/P* && echo "New users/groups, remember to commit infrastructure/db/user.list!" > > cd "$portsdir/${pkgpath%/*}" > > - cvs -R -d$cvsroot update -AdP ${pkgpath##*/} > > + cvs -d$cvsroot update -AdP ${pkgpath##*/} > > agreed, -R makes no sense here. > > I suppose it could mv ${pkgpath} ${pkgpath}.bak or similar if run from > /usr/ports? That'd been an improvement for imports from /usr/ports, indeed... but I have no use case for this and it's not a new problem. Right now I'd like to fix that bloody error that pesters everybody since years. ;) PS: for users of non-default PORTSDIR, I suspect it would only be a matter of using make -f /etc/mk.conf -V PORTSDIR -- jca