flock icon indicating copy to clipboard operation
flock copied to clipboard

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

Open reesd opened this issue 7 years ago • 7 comments

reesd avatar Jan 10 '17 20:01 reesd

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

reesd avatar Jan 10 '17 20:01 reesd

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

josephholsten avatar Jan 12 '17 16:01 josephholsten

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).

josephholsten avatar Jan 12 '17 20:01 josephholsten

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

FelikZ avatar Apr 06 '18 10:04 FelikZ

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 avatar Jan 31 '19 11:01 Mayeu

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).

Mayeu avatar Mar 05 '19 10:03 Mayeu

@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?

josephholsten avatar Mar 05 '19 20:03 josephholsten