Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

mapnik: fix string > integer comparison bug #12033

Closed
wants to merge 1 commit into from

Conversation

2bits
Copy link
Contributor

@2bits 2bits commented May 3, 2012

Don't try to compare strings and integers.
Add .to_i so that jobs is an integer.

Don't try to compare strings and integers.
Add `.to_i` so that `jobs` is an integer.
@Sharpie
Copy link
Contributor

Sharpie commented May 3, 2012

@mxcl @adamv @MikeMcQuaid @jacknagel @mistydemeo

Seems like we should fix this one in ENV.rb, for example, the current code is:

def make_jobs
  # '-j' requires a positive integral argument
  if self['HOMEBREW_MAKE_JOBS'].to_i > 0 
    self['HOMEBREW_MAKE_JOBS']
  else
    Hardware.processor_count
  end 
end 

Hardware.processor_count definitely returns an integer:

def self.processor_count
  @@processor_count ||= `/usr/sbin/sysctl -n hw.ncpu`.to_i
end

Which means that ENV.make_jobs is a bit messed up in that it will return a string or an integer depending on if the user has set HOMEBREW_MAKE_JOBS.

@jacknagel
Copy link
Contributor

Agreed, it should always return an integer.

@2bits
Copy link
Contributor Author

2bits commented May 3, 2012

I guess that someone is going to fix this in ENV.rb and leave the formula unchanged. So I'll close this.

@2bits 2bits closed this May 3, 2012
@Sharpie
Copy link
Contributor

Sharpie commented May 3, 2012

ENV.rb has been patched.

2bits pushed a commit to 2bits/homebrew that referenced this pull request May 3, 2012
When referencing `Hardware.processor_count`, `ENV.make_jobs` will return an
integer. If referencing the environment variable `HOMEBREW_MAKE_JOBS`, it
returned a string.

Now, the function always returns an integer.

Fixes Homebrew#12033.
2bits pushed a commit to 2bits/homebrew that referenced this pull request May 3, 2012
When referencing `Hardware.processor_count`, `ENV.make_jobs` will return an
integer. If referencing the environment variable `HOMEBREW_MAKE_JOBS`, it
returned a string.

Now, the function always returns an integer.

Fixes Homebrew#12033.
rohansingh pushed a commit to rohansingh/homebrew that referenced this pull request May 7, 2012
When referencing `Hardware.processor_count`, `ENV.make_jobs` will return an
integer. If referencing the environment variable `HOMEBREW_MAKE_JOBS`, it
returned a string.

Now, the function always returns an integer.

Fixes Homebrew#12033.
rohansingh pushed a commit to rohansingh/homebrew that referenced this pull request May 7, 2012
When referencing `Hardware.processor_count`, `ENV.make_jobs` will return an
integer. If referencing the environment variable `HOMEBREW_MAKE_JOBS`, it
returned a string.

Now, the function always returns an integer.

Fixes Homebrew#12033.
Sharpie added a commit to Sharpie/homebrew that referenced this pull request Jun 18, 2012
When referencing `Hardware.processor_count`, `ENV.make_jobs` will return an
integer. If referencing the environment variable `HOMEBREW_MAKE_JOBS`, it
returned a string.

Now, the function always returns an integer.

Fixes Homebrew#12033.
Sharpie added a commit to Sharpie/homebrew that referenced this pull request Jun 18, 2012
When referencing `Hardware.processor_count`, `ENV.make_jobs` will return an
integer. If referencing the environment variable `HOMEBREW_MAKE_JOBS`, it
returned a string.

Now, the function always returns an integer.

Fixes Homebrew#12033.
Sharpie added a commit to Sharpie/homebrew that referenced this pull request Sep 12, 2012
When referencing `Hardware.processor_count`, `ENV.make_jobs` will return an
integer. If referencing the environment variable `HOMEBREW_MAKE_JOBS`, it
returned a string.

Now, the function always returns an integer.

Fixes Homebrew#12033.
snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this pull request Dec 17, 2012
When referencing `Hardware.processor_count`, `ENV.make_jobs` will return an
integer. If referencing the environment variable `HOMEBREW_MAKE_JOBS`, it
returned a string.

Now, the function always returns an integer.

Fixes Homebrew#12033.
snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this pull request Dec 17, 2012
When referencing `Hardware.processor_count`, `ENV.make_jobs` will return an
integer. If referencing the environment variable `HOMEBREW_MAKE_JOBS`, it
returned a string.

Now, the function always returns an integer.

Fixes Homebrew#12033.
@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants