[prev in list] [next in list] [prev in thread] [next in thread] 

List:       macports-dev
Subject:    Re: "Failed to open portfile from registry" while reinstalling	because of configure.optflags
From:       René_J.V. Bertin <rjvbertin () gmail ! com>
Date:       2016-10-26 17:11:20
Message-ID: 32882902.BW1S36R28X () portia ! local
[Download RAW message or body]

On Wednesday October 26 2016 18:50:33 Clemens Lang wrote:

> On Wed, Oct 26, 2016 at 02:17:53AM +0200, Ren=E9 J.V. Bertin wrote:
> > Yeah. There could be a check if the Portfile exists to catch the 1st
> > possibility
> =

> That would introduce a race condition, wouldn't it? Checking whether a
> file exists before doing something with it is a classic mistake.

That depends. I don't see how it would if you check before executing code t=
hat assumes the file exist:

if {![file exists [$port portfile]/Portfile]} {
    ui_warn "[$port portfile]/Portfile] doesn't exist"
} else {
    if {![catch {set mport [mportopen_installed ...] etc.} err]} {
    } else {
        ui_warn "Failed to run/parse Portfile from registry for $portspec (=
$err)"
    }
}

I'm more used to the effects of the classic mistake where you assume a bit =
too easily that a file always exists ;)

> That information already exists, and you'll see it in debug mode.

Yes, I know $errorInfo is output, but to be honest it's not always easy to =
find, for instance because the logfile is rewritten at least once during a =
`upgrade --force`. I find it more useful to obtain the succinct error messa=
ge from catch and print that in the ui_warn call.

R
_______________________________________________
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic