Hello,
First, thank you for this project !
While trying to install and test it on Debian, I had a problem since the first launch with the following error :
11:50 $ brew --version
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.sh: line 61: printf: rc1: invalid number
Homebrew 1.8.4-1-g9a8e19e
Linuxbrew/homebrew-core (git revision 628c; last commit 2018-11-30)
After little investigation and useful echo debugging I got :
11:51 $ brew --version
DEBUG: git version 2.20.0.rc1##
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.sh: line 61: printf: rc1: invalid number
Homebrew 1.8.4-1-g9a8e19e-dirty
Linuxbrew/homebrew-core (git revision 628c; last commit 2018-11-30)
And I can confirm with :
11:53 $ apt-cache policy git
git:
Installed: 1:2.20.0~rc1-1
Candidate: 1:2.20.0~rc1-1
Version table:
*** 1:2.20.0~rc1-1 500
500 http://ftp.fr.debian.org/debian sid/main amd64 Packages
100 /var/lib/dpkg/status
As you may notice from the previous one, I'm running under Debian sid, so package versions are formatted a bit differently.
So this may be a bug only under Debian sid.
Have a good day !
Victor D;
Hi, Victor. Thanks for the bug report. Outside of the annoying error message, is Linuxbrew otherwise working correctly? It looks to me as though it should be. If so, you can if you like ignore it and carry on. If you'd like to fix the bug and submit a PR with the fix, we'd be super happy to accept a fix! Here's the buggy line:
https://github.com/Linuxbrew/brew/blob/9a8e19e7ea13765ed2fab799152d68e740043408/Library/Homebrew/brew.sh#L58-L62
If extblog option is set for bash (it's on by default one mine).
Something like :
printf "%01d%02d%02d%02d" ${1//.*(rc)/ }
will do the trick to sanitize the release candidate format.
I don't think we can depend on extended globbing (extglob) being enabled. Something like this might work.
printf "%01d%02d%02d%02d" ${${1%\~rc*}//./ }
In fact this is the exact return of "git --version" not the apt one.
$ git --version
git version 2.20.0.rc1
That is already filtered to : 2.20.0.rc1
So, it should only escape "rc", as latest version number could be relevant too ?
By the way, extented globbing can easily be activated with "shopt -s extglob", and scoped to the "numeric" function only, avoiding side effects on other parts.
But if this is a thing to avoid here, this is working too :
printf "%01d%02d%02d%02d" ${1//[.rc]/ }
I tried yours, but bash complains about a bad substitution, it doesn't seem to like the imbrication, even with :
${${1}//./ }
Glad to hear that you found a fix. You can if you like submit a PR upstream to https://github.com/Homebrew/brew
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.