Opened 17 years ago

Closed 7 years ago

Last modified 7 years ago

#12306 closed defect (fixed)

BUG: "variant foo bar { ... }" constructs fail at package archival time

Reported by: jmpp@… Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 2.4.0
Component: base Version: 1.5.0
Keywords: Cc: cooljeanius (Eric Gallager)
Port:

Description

Listing two variant names in a single line in order to define a common code block for both causes the archival stage to fail:

archiving port+foo bar.<platform>.<archiveformat>
bar.<platform>.<archiveformat>: no such file or directory

Archive creation code is failing to add the second variant to the archive file name and adding a space instead, causing a no such file or directory error. We should either fix this or refuse such constructs, in view of the variant descriptions feature introduced recently (don't know if two variants on a single line plays well with variant descriptions, haven't checked).

-jmpp

Change History (12)

comment:1 Changed 17 years ago by jmpp@…

Priority: ExpectedImportant
severity: NormalSerious

It seems like this is a serious bug, installing ports with this variant constructs apparently messes up the registry:

$[juan @macbookpro: base](97/0 0,1) -> port installed
Error: port installed failed: Registry error: cyrus-sasl2 @1.0.4_1 not registered as installed.
No ports are installed.

$[juan @macbookpro: cyrus-sasl2](294/0,0) -> pwd
/usr/local/src/macosforge/macports/trunk/dports/security/cyrus-sasl2

$[juan @macbookpro: cyrus-sasl2](295/0,0) -> sudo port -d uninstall
DEBUG: Changing to port directory: /usr/local/src/macosforge/macports/trunk/dports/security/cyrus-sasl2
DEBUG: Requested variant kerberos is not provided by port cyrus-sasl2.
DEBUG: Requested variant darwin is not provided by port cyrus-sasl2.
DEBUG: Requested variant i386 is not provided by port cyrus-sasl2.
DEBUG: Requested variant macosx is not provided by port cyrus-sasl2.
DEBUG: Executing variant kerberos-darwin provides kerberos darwin
DEBUG: can't read "revision": no such variable
    while executing
"lappend plist $revision"
    (procedure "receipt_flat::installed" line 28)
    invoked from within
"${macports::registry.format}::installed $name $version"
    (procedure "registry::installed" line 4)
    invoked from within
"registry::installed $portname $v"
    (procedure "portuninstall::uninstall" line 5)
    invoked from within
"portuninstall::uninstall $portname [composite_version $portversion [array get variations]] [array get options]"
Error: port uninstall failed: can't read "revision": no such variable

This when attempting a port installation off the old Portfile. But I also cancelled a port call somewhere along the line (don't recall if it was a destooring or an installation) so my registry might have broken because of that too. In any case, bumping this bug up to higher priority/severity just in case.

-jmpp

comment:2 Changed 17 years ago by jmpp@…

Some investigation reveals MacPorts chokes when spaces are inserted in the receipts directory:

$[juan @macbookpro: cyrus-sasl2](337/0,0) -> sudo rm -rf /opt/local/var/macports/receipts/cyrus-sasl2

$[juan @macbookpro: cyrus-sasl2](338/0,0) -> port installed
The following ports are currently installed:
  apr @1.2.8_0 (active)
  apr-util @1.2.8_2+no_bdb+no_sqlite (active)
  autoconf @2.61_0 (active)
  bash-completion @20060301_0 (active)

 ---snip---

$[juan @macbookpro: cyrus-sasl2](343/1,0) -> sudo mkdir -p /opt/local/var/macports/receipts/foo/1\+foo\ bar

$[juan @macbookpro: cyrus-sasl2](345/0,0) -> ls /opt/local/var/macports/receipts/foo/
total 0
drwxr-xr-x   2 root  admin  68B Jul 16 15:33 1+foo bar/

$[juan @macbookpro: cyrus-sasl2](346/0,0) -> port installed
Error: port installed failed: Registry error: foo @2.0.1_0 not registered as installed.
No ports are installed.

$[juan @macbookpro: cyrus-sasl2](347/1,0) -> sudo rm -rf /opt/local/var/macports/receipts/foo 

$[juan @macbookpro: cyrus-sasl2](348/0,0) -> port installed
The following ports are currently installed:
  apr @1.2.8_0 (active)
  apr-util @1.2.8_2+no_bdb+no_sqlite (active)

---snip---

The installed command does not escape the space and returns with a foo @1+foo string, which is naturally not recorded as installed (the full string should have been "foo @1+foo+bar", supressing the space). My mistake to have used foo for both the example port and variant names, but that's orthogonal. In any case, the bug seems to be in full installation name construction (portname plus version plus revision plus all variants), which is either not escaping the space too or not supressing it in the first place, as I believe it should be done (was it like that before this bug cropped up?).

-jmpp

comment:3 Changed 17 years ago by jmpp@…

Milestone: Needs developer reviewMacPorts base bugs

Milestone Needs developer review deleted

comment:4 Changed 17 years ago by nox@…

Priority: ImportantHigh
Summary: "variant foo bar { ... }" constructs fail at package archival timeBUG: "variant foo bar { ... }" constructs fail at package archival time

comment:5 Changed 15 years ago by tobypeterson

Milestone: MacPorts base bugsMacPorts Future

Milestone MacPorts base bugs deleted

comment:6 Changed 11 years ago by cooljeanius (Eric Gallager)

Does this still happen? Base has changed since this ticket was opened...

comment:7 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:8 in reply to:  6 Changed 11 years ago by larryv (Lawrence Velázquez)

Cc: jmpp@… removed
Keywords: archivemode double variants removed

Replying to egall@…:

Does this still happen? Base has changed since this ticket was opened...

The Guide doesn’t even suggest variant foo bar as a valid portfile construct, although base still allows it. Do any portfiles even do this?

comment:9 Changed 10 years ago by mf2k (Frank Schima)

Priority: HighNormal

comment:10 Changed 10 years ago by mf2k (Frank Schima)

Owner: changed from jmpp@… to macports-tickets@…

jmpp is no longer active. See #44809.

comment:11 Changed 7 years ago by raimue (Rainer Müller)

Resolution: fixed
Status: newclosed

A Portfile with

variant foo bar { ... }

will lead to

Can't map the URL 'file://.' to a port description file ("Variant name foo bar contains invalid characters").

comment:12 Changed 7 years ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 2.4.0
Note: See TracTickets for help on using tickets.