Welcome to CRUX bug tracking.

FS#1111 - Stop using a hard coded repository base directory

Attached to Project: CRUX
Opened by Thomas Penteker (teK) - Friday, 02 January 2015, 00:16 GMT
Last edited by Tim Biermann (tb) - Thursday, 24 June 2021, 11:24 GMT
Task Type Bug Report
Category ports
Status New
Assigned To CRUX Developers (crux)
Operating System CRUX
Severity Low
Priority Normal
Reported Version 3.1
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No


I just realised that we are setting the *local* repo dir in each .httpup file
shipped by, like: ROOT_DIR=/usr/ports/mechaniputer etc.

/usr/bin/ports explicitly sets PORTS_DIR="/usr/ports" and uses it for everything
but ports -u, afaics, e.g.:

port_version=`cd $PORTS_DIR/$port; . Pkgfile; echo $version-$release`

I propose to

a) make PORTS_DIR configurable. For now this could happen in /etc/pkgmk.conf
b) comment out the destination/ROOT_DIR parts in the .rsync/.httpup files served
and let the system default be /usr/ports but allow users to override this on a
per repo basis (just like it is today)
c) update the ports man page, post to the ML
d) adjust /etc/ports/drivers/{rsync,httpup}
e) adjust ports(1) to honor the different base dirs for --list and --diff

The only issue I see is with older versions of ports and recently downloaded
repos files from, where the neither the repo file nor ports
sets the target directory for the synced repository during ports -u.

Please comment.

This task depends upon

Comment by Ryan Mullen (rmull) - Saturday, 07 March 2015, 22:16 GMT
The config file would be /etc/prt-get.conf and not /etc/pkgmk.conf, right? pkgmk doesn't care where you store ports afaik. Otherwise good stuff.
Comment by Juergen Daubert (jue) - Tuesday, 04 August 2015, 11:45 GMT
IMO we shouldn't use pkgmk.conf nor prt-get.conf for configuration of /usr/bin/ports. If we make ports configurable we should do that in /etc/ports.conf.

Note: other CRUX tools might have /usr/ports hard coded !

What's the advantage of using other directories than /usr/ports ?
Comment by Fun (fun) - Sunday, 18 June 2017, 15:44 GMT
I think it is a "security issue" to have external repositories choosing the destination directory. I've attached patches for rsync and httpup drivers to behave more like the git driver (use $PORTS_DIR/$(basename xxx)). Both patches take some forms of care regarding spaces. They don't fully address this issue. Still, as this is undecided, I've attach them here.

I see no advantage having different base directory for ports, as the symlinks gives enough flexibility, but only as long as the ports tool remain for root use only. I see no reason not to allow users to update, build and install ports to ~/bin. But this might be another issue.
   httpup.driver.patch (0.4 KiB)
   rsync.driver.patch (1 KiB)