GithubHelp home page GithubHelp logo

Read lock danger about portalocker HOT 6 CLOSED

wolph avatar wolph commented on May 28, 2024
Read lock danger

from portalocker.

Comments (6)

wolph avatar wolph commented on May 28, 2024

That's a bit of a legacy issue unfortunately, while I agree with you that it's illogical I'm not a big fan of changing behaviour. This library is used by many others in many locations so besides introducing a new API I don't see a simple fix for the issue.

from portalocker.

petef4 avatar petef4 commented on May 28, 2024

Well yes, it is the API that I find to be broken, in ways not present on the upstream ActiveState recipe. A read lock ought not to be concerned with truncate. Defaulting to an effective mode="w" when the signature has mode="a" violates POLA.

The standard way forward for you would be to bump the major version to indicate an API change. For my purposes I should stick to the lower level fcntl as I only need to run on Linux.

from portalocker.

wolph avatar wolph commented on May 28, 2024

You're correct that it's not in the original ActiveState recipe but it was this way when I forked it a long time ago. The initial version found in this repo is how I found it at that time which means that there are people using in in this fashion. If people expect truncate but get append instead, applications will break in weird ways.

A major release bump can still be automatically installed if people simply specified portalocker as a requirement so that is definitely not an option. A new API to replace the old is an option but only with proper deprecation warnings for the old API.

from portalocker.

petef4 avatar petef4 commented on May 28, 2024

Fair enough. Personally I consider it best practice to use explicit versioning in requirements.txt. I'll leave you to support your legacy dependents and move on.

from portalocker.

wolph avatar wolph commented on May 28, 2024

It's definitely a valid point so I will add an API with a new and safer version.

from portalocker.

wolph avatar wolph commented on May 28, 2024

The new version 1.0.0 fixes this issue and is therefore backwards incompatible with the old version.

from portalocker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.