Refactor #2330

Uptime gets computed twice on systems with /proc/uptime

Added by Felix Schäfer about 1 year ago. Updated 16 days ago.

Status:Closed Start:06/07/2009
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:library
Target version:1.5.8
Branch:ticket/master/2330-uptime
Votes: 0

Description

On systems with /proc/uptime, the uptime gets computed once by reading said file, and once by calling uptime itself.


Related issues

related to Facter - Bug #4466: Files in /proc should not be read directly by Ruby Accepted 08/04/2010

History

Updated by Felix Schäfer about 1 year ago

I’ll try to have a shot a it tomorrow at work.

Updated by Felix Schäfer about 1 year ago

I have forked facter on github and sent a pull request to jamtur01 and reductivelabs, in the hope that it will reach whom it may concern. Commit is here http://github.com/thegcat/facter/commit/082bd1eb12b61b18d3dab4ff6b70bbcf9eb705b0

Updated by James Turnbull about 1 year ago

  • Status changed from Unreviewed to Accepted
  • Target version set to 1.6.0

Updated by Paul Nasrat about 1 year ago

  • Status changed from Accepted to Code Insufficient

I reviewed this on list, but I’m updating this to get to the original patch author. i

Generally if we’re doing more complex facts we should have tests.

Also the patch as is won’t work as it’s doing assignment (single equals) in conditionals not comparison (==).

If you can fix up the logic and update this bug that’d be great, if you want advise on how to test please ask on the dev list.

Updated by Paul Nasrat about 1 year ago

  • Assignee set to Paul Nasrat

Updated by Nick Lewis 2 months ago

It looks like this started with a discussion on the mailing list which led to an insufficient patch, but it hasn’t been improved? Is anyone taking ownership of this one?

Updated by James Turnbull 2 months ago

  • Assignee changed from Paul Nasrat to James Turnbull
  • Target version changed from 1.6.0 to 1.5.8

I should – it’s originally my code.

Updated by James Turnbull 2 months ago

  • Status changed from Code Insufficient to Ready for Checkin

Updated by Rein Henrichs about 1 month ago

  • Assignee changed from James Turnbull to Rein Henrichs

We have a number of branches that have very different approaches to solving this bug. I have a proposal:

Uptime should be computed using the most accurate and easiest to parse method available on the underlying system, starting with /proc/uptime on systems that have it. It should only be computed once and this computed value should be used for all facts that depend upon it.

I’m happy to work on a patch that addresses these concerns and will update once I have one.

Updated by Rein Henrichs about 1 month ago

  • Status changed from Ready for Checkin to Investigating

Updated by Rein Henrichs 30 days ago

  • Status changed from Investigating to Ready for Checkin
  • Branch set to 2330-uptime-gets-computed-twice-on-systems-with-/proc/uptime

Available in my github (reinh) at 2330-uptime-gets-computed-twice-on-systems-with-/proc/uptime

Updated by Rein Henrichs 28 days ago

Updated my branch to use bin/cat proc/uptime because of #4466

Updated by Rein Henrichs 27 days ago

  • Branch changed from 2330-uptime-gets-computed-twice-on-systems-with-/proc/uptime to ticket/master/2330-uptime

Updating branch name.

Updated by Rein Henrichs 16 days ago

  • Status changed from Ready for Checkin to Closed
  • Assignee deleted (Rein Henrichs)
  • % Done changed from 0 to 100

Closing: merged into master and available in 1.5.8rc1.

Also available in: Atom PDF