Opened 12 years ago
Last modified 10 years ago
#1253 new Defect
generate_svn_version.sh fails when building 7.0.65 (and earlier)
Reported by: | Bluefin Tuna | Owned by: | |
---|---|---|---|
Priority: | Major | Milestone: | Undetermined |
Component: | Undetermined | Version: | 7.4.36 |
Keywords: | Cc: |
Description
In the "generate_svn_version.sh" there are these instructions:
BRANCH=
git branch | sed -n 's/^\* *//p'
remote=git config --get branch.$BRANCH.remote
Execution of the script fails because quoting is missing. Debugging shows:
BRANCH='(no branch)' git config --get 'branch.(no' 'branch).remote'
The above fails with
error: invalid key: branch.(no
In this case, 'git branch' shows:
$ git branch
- (no branch) master
[Remark: It is unclear why these instructions are being run. The output for "git branch" should show the local branch, which should always be the "master" branch unless the user has decided to create a local branch, but that branch would not have any relationship to a branch on the git repository]
Solution: Change script to read
BRANCH=
git branch | sed -n 's/^\* *//p'
remote=git config --get 'branch.$BRANCH.remote'
One can assume that $BRANCH does not itself contain single quotes...
Change History (3)
comment:1 Changed 12 years ago by
comment:3 Changed 10 years ago by
Priority: | Undetermined → Major |
---|---|
Version: | 7.0.65 → 7.4.36 |
In 7.4.41 the shell code has changed but the problem is still present:
GIT_LOG=`git log -n1 --pretty="format:%H"` HOST=`hostname` BRANCH=`git branch | sed -n 's/^\* *//p'` remote=`git config --get branch.$BRANCH.remote` <------- PROBLEM WAITING TO HAPPEN URL=`git config --get remote.$remote.url` DATE=`git log -n1 --pretty="format:%ct"`
Tracing this yields:
+ BRANCH='(detached from client_release/7.4/7.4.41)' ++ git config --get 'branch.(detached' from 'client_release/7.4/7.4.41).remote'
So make fails:
error: wrong number of arguments usage: git config [options]
*FIX:*
Change the call to the git command by adding double quotes:
if [ -d .git/svn ]; then CMD="git svn info" elif [ -d .git ]; then GIT_LOG=`git log -n1 --pretty="format:%H"` HOST=`hostname` BRANCH=`git branch | sed -n 's/^\* *//p'` remote=`git config --get "branch.$BRANCH.remote"` URL=`git config --get "remote.$remote.url"` DATE=`git log -n1 --pretty="format:%ct"` elif [ -d .svn ]; then CMD="svn info" else CMD="" fi
Setting priority to "major" because:
1) Builds fail consistently since like forever 2) And this is so easy to fix.... come ON, guys!
Still present in 7.1.11