Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should support -x as a no-op like util-linux does #9

Open
reesd opened this issue Jan 10, 2017 · 7 comments
Open

Should support -x as a no-op like util-linux does #9

reesd opened this issue Jan 10, 2017 · 7 comments

Comments

@reesd
Copy link

reesd commented Jan 10, 2017

No description provided.

@reesd
Copy link
Author

reesd commented Jan 10, 2017

Some background here - http://stackoverflow.com/a/31445288/255961

@josephholsten
Copy link
Contributor

I would gladly consider a PR, or at least some draft documentation (or a unit test) for the feature

@josephholsten
Copy link
Contributor

ah, per https://github.com/karelzak/util-linux/blob/master/sys-utils/flock.1#L81

how about:

* `-x`, `--exclusive`:
	Obtain an exclusive lock, sometimes called a write lock. Mutually exclusive with the `-s` shared lock option. This is the default.

It looks like this has already been implemented in #8, but hasn't been adequately documented (along with other things added by the patch).

@FelikZ
Copy link

FelikZ commented Apr 6, 2018

Workaround:

flock_ex()
{
    set +e
    man flock | grep -q "\-x"
    NON_LINUX_FLOCK=$?
    set -e

    if [ "$NON_LINUX_FLOCK" = 1 ]; then
        flock /tmp/docker-up.lock $@
    else
        flock -x /tmp/docker-up.lock -c "$@"
    fi
}

flock_ex docker-compose -p "$PREFIX" -f "$DIR/$RUN_ENV.yml" ps

@Mayeu
Copy link

Mayeu commented Jan 31, 2019

It looks like this has already been implemented in #8, but hasn't been adequately documented (along with other things added by the patch).

The current 0.2.3 version of flock (last one from the tag) does not contains this patch, thus the homebrew version don't work with -x yet.

Would it be possible for you to carve out a new release from the current master?

@Mayeu
Copy link

Mayeu commented Mar 5, 2019

For info, I have added the current master commit of flock in my personal homebrew tap.

I am open to contributing an update to your homebrew tap if a new release is carved out of the current master 🙂

(I can also help making it an addition to the official Homebrew core formula if you wish so).

@josephholsten
Copy link
Contributor

@Mayeu ok, what do we need to do to release?

  • Is the necessary patch merged?
  • Is it documented?
  • Is it tagged in git?
  • is the homebrew tap updated?

Anything else we'd need to check? Can you confirm you have permissions to make those changes?

Does anyone else want permissions?

geissonator added a commit to openbmc/openbmc-build-scripts that referenced this issue Sep 12, 2019
flock is not native on mac os. There is a package that can be installed,
https://github.com/discoteq/flock, but it does not support the -x
option. See discoteq/flock#9

By default, flock is exclusive so there's no need for the -x in the
first place

Tested:
Verified no error with flock when running script on mac os

Change-Id: Iab6bdb2a378cace290ad61569ae40c86baebc264
Signed-off-by: Andrew Geissler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants