fresh install silently fails if bzr id not set

Bug #1248627 reported by Colin Cooper
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Undecided
Dick Hollenbeck

Bug Description

On a linux machine where bzr has not previously been used (i.e. not a kicad developer box!)

1) Perform a fresh install using the script from here:
    http://bazaar.launchpad.net/~kicad-testing-committers/kicad/testing/view/head:/scripts/kicad-install.sh

2) Observe several thousands lines are output, ending with the following congratulatory output:
  All KiCad "--install-or-update" steps completed, you are up to date.

3) Search for the installed executables -- they aren't there. Although modules, templates, doc etc have appeared under /user/local)

Repetition has the same result.

DIAGNOSIS:
Way back around line 37 of the output is this:

bzr: ERROR: Unable to determine your name.
Please, set your name with the 'whoami' command.
E.g. bzr whoami "Your Name <email address hidden>"
make[2]: *** [../.downloads-by-cmake/boost_1_54_0/src/boost-stamp/boost-bzr_commit_boost] Error 3

After setting bzr name & email with the suggested command, the build runs and installs successfully.

It appears that the incomplete bzr config breaks the build, but the script continues and does not inform the user at the end of the problem.

Note: the default scrollback on many terminals (certainly on mine) is 1000 lines, so the error is lost off the top of the screen. Even if you capture stdout/stderr, you still have to search through a lot of text to find out the problem.

SUGGESTION: abort the build when the error is detected. User can easily issue bzr whoami & reaunch. Or test it during the prerequisites check.

Aside: I'd prefer to use a repository, but the official ubuntu/mint one is 18months old, and the adamwolf PPA is a WIP off a testing branch.

Revision history for this message
Dick Hollenbeck (dickelbeck) wrote : Re: [Bug 1248627] [NEW] fresh install silently fails if bzr id not set

Please submit a patch.

On 11/06/2013 10:52 AM, Colin Cooper wrote:
> Public bug reported:
>
> On a linux machine where bzr has not previously been used (i.e. not a
> kicad developer box!)
>
> 1) Perform a fresh install using the script from here:
> http://bazaar.launchpad.net/~kicad-testing-committers/kicad/testing/view/head:/scripts/kicad-install.sh
>
> 2) Observe several thousands lines are output, ending with the following congratulatory output:
> All KiCad "--install-or-update" steps completed, you are up to date.
>
> 3) Search for the installed executables -- they aren't there. Although
> modules, templates, doc etc have appeared under /user/local)
>
> Repetition has the same result.
>
>
> DIAGNOSIS:
> Way back around line 37 of the output is this:
>
> bzr: ERROR: Unable to determine your name.
> Please, set your name with the 'whoami' command.
> E.g. bzr whoami "Your Name <email address hidden>"
> make[2]: *** [../.downloads-by-cmake/boost_1_54_0/src/boost-stamp/boost-bzr_commit_boost] Error 3
>
> After setting bzr name & email with the suggested command, the build
> runs and installs successfully.
>
> It appears that the incomplete bzr config breaks the build, but the
> script continues and does not inform the user at the end of the problem.
>
> Note: the default scrollback on many terminals (certainly on mine) is
> 1000 lines, so the error is lost off the top of the screen. Even if you
> capture stdout/stderr, you still have to search through a lot of text to
> find out the problem.
>
>
> SUGGESTION: abort the build when the error is detected. User can easily issue bzr whoami & reaunch. Or test it during the prerequisites check.
>
> Aside: I'd prefer to use a repository, but the official ubuntu/mint one
> is 18months old, and the adamwolf PPA is a WIP off a testing branch.
>
> ** Affects: kicad
> Importance: Undecided
> Status: New
>

Revision history for this message
Colin Cooper (cdcooperuk) wrote :

patch attached, hopefully usable.

It checks that a bzr id is available after (possibly) installing bzr.

I arbitrarily chose exit code 2 to distinguish this from other exits. Feel free to change it.

Revision history for this message
Dick Hollenbeck (dickelbeck) wrote : Re: [Bug 1248627] Re: fresh install silently fails if bzr id not set

On 11/07/2013 08:43 AM, Colin Cooper wrote:
> patch attached, hopefully usable.
>
> It checks that a bzr id is available after (possibly) installing bzr.
>
> I arbitrarily chose exit code 2 to distinguish this from other exits.
> Feel free to change it.
>
> ** Patch added: "exit with message after installing prerequisites if bzr name unavailable"
> https://bugs.launchpad.net/kicad/+bug/1248627/+attachment/3902399/+files/1248627.patch
>

Thanks.

My shell choked on the // comment prefix

Wondering how to test this, did you, with no id defined?

Revision history for this message
Colin Cooper (cdcooperuk) wrote :

"// comment prefix" . oops.

So sorry -- I should't jump between languages in a day (or assume comments are trivial)
It should, of course be a '#'

Patched patch attached.

I tested the logic with a simple script:
cat /tmp/bw
#!/bin/bash
echo at start
bzr whoami || exit 2
echo at end

results:
* On the box which kicad is installed (& which now has a bzr id), prints my name and email, gets to the end, exits with 0
* On a second box with a new, unconfigured bzr, prints the useful bazaar message & instructions, stops executing, exits with 2

Ideally I'd have run the full kicad-install.sh script, but the second box is desperately short of space.

It is probably possible to clear out the id from an existing bazaar user, but I have no prior experience of bazaar.

Revision history for this message
Dick Hollenbeck (dickelbeck) wrote :

Thanks Colin. Your report was the second time this came up, and now hopefully the last
thanks to this work of yours.

committed in 4446.

Changed in kicad:
status: New → Fix Committed
assignee: nobody → Dick Hollenbeck (dickelbeck)
Revision history for this message
follower (78luphr0rnk2nuqimstywepozxn9kl19tqh0tx66b5dki1xxsh5mkz9gl21a5rlwfnr8jn6ln0m3jxne2k9x1ohg85w3jabxlrqbgszpjpwcmvkbcvq9spp6z3w5j1m33k06tlsfszeuscyt241h-launchpad-a811i2i3ytqlsztthjth0svbccw8inm65tmkqp9sarr553jq53in4xm1m8wn3o4rlwaer06ogwvqwv9mrqoku2x334n7di44o65qze67n1wneepmidnuwnde1rqcbpgdf70gtqq2x9thj5tlcsac) wrote :

I just encountered this issue while attempting to build kicad via homebrew on OS X using this recipe: https://github.com/shaneburrell/homebrew-kicad

According to diagnostics, I am using: "revision 4561 of branch http://bazaar.launchpad.net/~kicad-testing-committers/kicad/testing"

I'm assuming the recipe doesn't use http://bazaar.launchpad.net/~kicad-testing-committers/kicad/testing/view/head:/scripts/kicad-install.sh given that script is only targeted at "compatible linux system".

It turns out that this issue could actually be considered a bug in bzr itself and there's actually an issue in the Bazaar tracker for it: "bzr refuses to commit with no username and no mailname" <https://bugs.launchpad.net/bzr/+bug/884502>

AFAICT the error itself occurs here: http://bazaar.launchpad.net/~kicad-testing-committers/kicad/testing/view/head:/CMakeModules/download_boost.cmake#L189 as I got the error message:

[ 40%] committing pristine boost files to 'boost scratch repo'
    bzr ci -q -m pristine /tmp/kicad-vxpd/.downloads-by-cmake/boost_1_54_0/src/boost
    bzr: ERROR: Unable to determine your name.
    Please, set your name with the 'whoami' command.
    E.g. bzr whoami "Your Name <email address hidden>"

However, given that the use of bzr in this case is merely to track Boost it doesn't seem reasonable to require a KiCad user to configure a username that's never actually going to be seen anywhere.

I suspect a more thorough workaround (which would also be cross-platform) would be use Bazaar's ability to have a non-global username set using the `--branch` option to `bzr whoami`: http://wiki.bazaar.canonical.com/BzrSettingEmail#Setting_email_via_the_.27whoami.27_command_.28version_0.9_and_higher.29

From a brief look at the code I think adding it at <http://bazaar.launchpad.net/~kicad-testing-committers/kicad/testing/view/head:/CMakeModules/download_boost.cmake#L205> would work with something like this:

   COMMAND bzr whoami --branch "Nobody <email address hidden>"

This would mean a kicad user building from source need not be concerned with how bzr is configured at all.

(Some related notes of mine can be found here: http://www.labradoc.com/i/follower/p/notes-kicad#20131222 )

Revision history for this message
follower (78luphr0rnk2nuqimstywepozxn9kl19tqh0tx66b5dki1xxsh5mkz9gl21a5rlwfnr8jn6ln0m3jxne2k9x1ohg85w3jabxlrqbgszpjpwcmvkbcvq9spp6z3w5j1m33k06tlsfszeuscyt241h-launchpad-a811i2i3ytqlsztthjth0svbccw8inm65tmkqp9sarr553jq53in4xm1m8wn3o4rlwaer06ogwvqwv9mrqoku2x334n7di44o65qze67n1wneepmidnuwnde1rqcbpgdf70gtqq2x9thj5tlcsac) wrote :

It seems the correct incarnation to use is:

 ExternalProject_Add_Step( boost bzr_commit_boost
+ COMMAND bzr whoami --branch "Kicad Build <email address hidden>" --directory <SOURCE_DIR>
     COMMAND bzr ci -q -m pristine <SOURCE_DIR>
     COMMENT "committing pristine boost files to 'boost scratch repo'"
     DEPENDERS patch

You need to specify the target source directory with the "--directory" option otherwise it can't find the branch to apply the "whoami" to.

Also, as I look at it now, it would probably read better as:

    COMMAND bzr whoami --branch --directory <SOURCE_DIR> "Kicad Build <email address hidden>"

But I've not tested it.

Revision history for this message
follower (78luphr0rnk2nuqimstywepozxn9kl19tqh0tx66b5dki1xxsh5mkz9gl21a5rlwfnr8jn6ln0m3jxne2k9x1ohg85w3jabxlrqbgszpjpwcmvkbcvq9spp6z3w5j1m33k06tlsfszeuscyt241h-launchpad-a811i2i3ytqlsztthjth0svbccw8inm65tmkqp9sarr553jq53in4xm1m8wn3o4rlwaer06ogwvqwv9mrqoku2x334n7di44o65qze67n1wneepmidnuwnde1rqcbpgdf70gtqq2x9thj5tlcsac) wrote :

This patch works around the requirement that a Bazaar user be configured--in a cross-platform manner.

Note: If this patch is applied then the other patch from further up this issue would need to be backed out.

Note: This patch uses the generic username even if the user *has* specified one previously--this might be undesirable. It might be better to only use the generic username if the user hasn't specified one. (In my case I don't care because the bzr repository being used in this case is only ever a temporary cache.)

Revision history for this message
Adam Wolf (adamwolf) wrote :

Hi folks,

I'm running into this with my Mac packaging stuff. Any possibility we could get this in our Cmake module instead of in each install script?

Adam Wolf
Wayne and Layne, LLC

Revision history for this message
Adam Wolf (adamwolf) wrote :

Please note I tried using the environment variables EMAIL, BZREMAIL, and BZR_EMAIL to sidestep this per http://wiki.bazaar.canonical.com/BzrSettingEmail, and none of them actually work. Harrumph.

Adam Wolf
Wayne and Layne, LLC

Revision history for this message
Nick Østergaard (nickoe) wrote :

I suggest the latest patch in this thread to be applied, because I think it should work on all platforms and that the content of the whoami for bzr is not relevant for anyone anyway, hence forcing those dummy details is not hurting anyone.

Jon Neal (reportingsjr)
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.