Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

use python flock firstly #737

Closed
wants to merge 1 commit into from
Closed

use python flock firstly #737

wants to merge 1 commit into from

Conversation

okhowang
Copy link
Contributor

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew tests with your changes locally?

some old flock has no -n flags which may cause flock failed in brew.
so I use python's flock first which has more stable performance across platform

@codecov-io
Copy link

Codecov Report

Merging #737 into master will decrease coverage by 2.88%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #737      +/-   ##
=========================================
- Coverage   64.28%   61.4%   -2.89%     
=========================================
  Files         393     392       -1     
  Lines       21082   21003      -79     
=========================================
- Hits        13553   12897     -656     
- Misses       7529    8106     +577
Impacted Files Coverage Δ
cmd/--repository.rb 0% <0%> (-100%) ⬇️
cmd/cleanup.rb 0% <0%> (-81.25%) ⬇️
cmd/unpack.rb 0% <0%> (-72.42%) ⬇️
rubocops/checksum_cop.rb 25.64% <0%> (-69.24%) ⬇️
formula_versions.rb 20% <0%> (-61.43%) ⬇️
cask/lib/hbc/cli/outdated.rb 45.45% <0%> (-54.55%) ⬇️
rubocops/options_cop.rb 47.05% <0%> (-52.95%) ⬇️
cmd/commands.rb 20.58% <0%> (-52.95%) ⬇️
utils/git.rb 50% <0%> (-50%) ⬇️
dev-cmd/test.rb 0% <0%> (-46.16%) ⬇️
... and 34 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ba4c2e...da5f4e8. Read the comment docs.

@sjackman sjackman self-assigned this Jun 22, 2018
@sjackman
Copy link
Member

Thanks for this bug report and pull request. Can you please report the exact error message that you see without this patch applied? Which distribution of Linux and version of flock are you using? Please report the output of brew config and flock --version.

@okhowang
Copy link
Contributor Author

okhowang commented Jul 2, 2018

error message without patch

flock: invalid option -- n
flock: unknown option, aborting.
Error: Another active Homebrew update process is already in progress.
Please wait for it to finish or terminate it to continue.

my linux is suse 10.1 32bit

flock --version

flock: unrecognized option `--version'
flock: unknown option, aborting.

flock

Usage flock [--shared | --timeout=seconds] filename command {arg arg...}

brew config

HOMEBREW_VERSION: 1.6.9
ORIGIN: https://github.com/Linuxbrew/brew
HEAD: 3ba4c2ed9b0587040949a4a9a95b576f520bae84
Last commit: 13 days ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: 55700341587d0a5f03a29c970e98ba49700f85c5
Core tap last commit: 10 days ago
HOMEBREW_PREFIX: /data/home/okhowang/.linuxbrew
HOMEBREW_REPOSITORY: /data/home/okhowang/.linuxbrew
HOMEBREW_CELLAR: /data/home/okhowang/.linuxbrew/Cellar
HOMEBREW_CACHE: /home/okhowang/.cache/Homebrew
HOMEBREW_DEVELOPER: 1
HOMEBREW_FORCE_BREWED_CURL: 1
HOMEBREW_GIT: /home/okhowang/.linuxbrew/opt/git/bin/git
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_LINKAGE_CACHE: 1
HOMEBREW_TEMP: /home/okhowang/tmp
CPU: octa-core 32-bit sandybridge
Homebrew Ruby: 2.4.3 => /home/okhowang/local/ruby-2.4.3/bin/ruby
Clang: 4.0 build 400
Git: 2.17.1 => /home/okhowang/.linuxbrew/opt/git/bin/git
Curl: 7.60.0 => /data/home/okhowang/.linuxbrew/opt/curl/bin/curl
Java: N/A
Kernel: Linux 2.6.16.60-0.21-domU-101126 i686 GNU/Linux
OS: N/A
Host glibc: 2.4
/usr/bin/gcc: 4.1.2
glibc: N/A
gcc: 5.5.0_4
xorg: N/A

@sjackman
Copy link
Member

sjackman commented Jul 3, 2018

On Ubuntu 16.04…

$ flock --version
flock from util-linux 2.27.1
$ flock --help

Usage:
 flock [options] <file>|<directory> <command> [<argument>...]
 flock [options] <file>|<directory> -c <command>
 flock [options] <file descriptor number>

Please report which -a flock. It seems your implementation of flock is different than the typical one provided by util-linux. Do you know which package it is that provides your flock? Do you have administrator access, and is it possible to install util-linux?

@okhowang
Copy link
Contributor Author

okhowang commented Jul 4, 2018

$ which -a flock
/usr/bin/flock

and I have no administrator permissions.
I means that python's flock is more reliable than cmdline's flock, so we should use python's flock before cmdline's

@sjackman
Copy link
Member

sjackman commented Jul 4, 2018

I'm not familiar with SUSE's package management system. Are you able to determine which package provides the executable /usr/bin/flock?

@okhowang
Copy link
Contributor Author

okhowang commented Jul 5, 2018

util-linux                       | 2.12r-35.28 | i586

it's util-linux@2.12r
i have checked flock's code in this version. And there is no -n options

@sjackman
Copy link
Member

sjackman commented Jul 5, 2018

SUSE 10.1 was released in 2006 and is now 12 years old.
https://en.wikipedia.org/wiki/OpenSUSE_version_history#10.x_Series

I'm afraid that we do not have the time available to support distributions of Linux that are this old. Are you able to use a newer distribution of Linux?

Ubuntu supports their long-term-support (LTS) releases for five years. That's roughly also the age of distributions that we aim to support in Linuxbrew.
https://www.ubuntu.com/info/release-end-of-life

You can if you like maintain this patch locally by committing it to your master branch. brew update will then keep that commit and rebase it on to the top of master each time you run brew update.

@sjackman sjackman closed this Jul 5, 2018
@sjackman
Copy link
Member

sjackman commented Jul 5, 2018

We're currently in the process of merging Linuxbrew/brew into Homebrew/brew (see #612). For that reason, I'm only merging PRs into Linxubrew/brew that would also be acceptable for eventual inclusion into Homebrew/brew.

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