Opened 16 years ago

Closed 15 years ago

#17579 closed defect (fixed)

With archive mode enabled, any command tries to create the directory if it doesn't exist

Reported by: blb@… Owned by: nerdling (Jeremy Lavergne)
Priority: Low Milestone: MacPorts 1.9.0
Component: base Version: 1.8.0
Keywords: archive permissions Cc:
Port:

Description

If you enable archive mode (portarchivemode yes in macports.conf), and the packages directory (${prefix}/var/macports/packages) doesn't yet exist, every port command will fail if not run as root, like 'port info':

$ /mp/bin/port info bind9
portarchivepath /mp/var/macports/packages does not exist and could not be created: can't create directory "/mp/var/macports/packages": permission denied
    while executing
"mportinit ui_options global_options global_variations"
Error: /mp/bin/port: Failed to initialize MacPorts, portarchivepath /mp/var/macports/packages does not exist and could not be created: can't create directory "/mp/var/macports/packages": permission denied

Since this is being done in mportinit it will always be hit when port runs; perhaps this should be created when necessary in package1.0/portarchive.tcl?

Change History (11)

comment:1 Changed 16 years ago by tobypeterson

Milestone: MacPorts base bugsMacPorts Future

Milestone MacPorts base bugs deleted

comment:2 Changed 15 years ago by nerdling (Jeremy Lavergne)

Cc: snc@… added

Cc Me!

comment:3 Changed 15 years ago by nerdling (Jeremy Lavergne)

Cc: snc@… removed
Owner: changed from macports-tickets@… to snc@…
Status: newassigned

comment:4 Changed 15 years ago by nerdling (Jeremy Lavergne)

Resolution: fixed
Status: assignedclosed

Fixed in r60447.

Thanks!

comment:5 Changed 15 years ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 1.9.0

comment:6 Changed 15 years ago by jmroot (Joshua Root)

Wait, how does creating the directory in archive_init stop mportinit from failing?

comment:7 Changed 15 years ago by nerdling (Jeremy Lavergne)

For me, when testing, the problem went away by placing it there.

For example, if the directory doesn't exist, calling port search NAME would fail. Placing a test to create it before it gets to the error is handled by archive_init.

comment:8 Changed 15 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: closedreopened

Still fails with latest trunk:

% /opt/mptest/bin/port info zlib 
portarchivepath /opt/mptest/var/macports/packages does not exist and could not be created: can't create directory "/opt/mptest/var/macports/packages": permission denied
    while executing
"mportinit ui_options global_options global_variations"
Error: /opt/mptest/bin/port: Failed to initialize MacPorts, portarchivepath /opt/mptest/var/macports/packages does not exist and could not be created: can't create directory "/opt/mptest/var/macports/packages": permission denied

comment:9 Changed 15 years ago by nerdling (Jeremy Lavergne)

Status: reopenednew

Looking again I do see that was silly of me.

I see two options: using warnings and disabling archivemode, or using the alternate build prefix. Any preference on which we fail to?

comment:10 Changed 15 years ago by nerdling (Jeremy Lavergne)

In r60789 I've rolled back the changes from r60447, and I've added a permissions message in r60791.

comment:11 Changed 15 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.