Giter Club home page Giter Club logo

Comments (6)

mralusw avatar mralusw commented on August 15, 2024 1

This never got fixed, apparently. The proper fix, in my opinion, is to cast the result to either long or unsigned long, and use either %1ld or (respectively) %1lu. This would be portable, safe and non-hacky — there's no need to identify platforms.

from flock.

josephholsten avatar josephholsten commented on August 15, 2024

A brief search shows me this is at least correct for Linux. Need to confirm this is correct for illumos and bsd system types.
@mohammad-akhlaghi want to draft the changeset for this, or shall I?

from flock.

mohammad-akhlaghi avatar mohammad-akhlaghi commented on August 15, 2024

Please go ahead @josephholsten 😉...

from flock.

mohammad-akhlaghi avatar mohammad-akhlaghi commented on August 15, 2024

With the help of Zahra Sharbaf, we recently discovered that simply replacing %1u with %1lu is not a generic solution and will cause a crash on macOS (using LLVM compiler)! The more generic solution is to replace it with %ld (as the error message in my first comment also reports, the actual type is: long int). I have tested this fix with GCC and it fixes the problem.

from flock.

mohammad-akhlaghi avatar mohammad-akhlaghi commented on August 15, 2024

There was a mistake in my previous message: on macOS, the format is int, not long int! So this is what our building script looks like now (modifying the source of flock after unpacking it to build safely on GNU/Linux and macOS, I can now confirm that it works in both cases):

case $on_mac_os in
    yes) sed -e's/\%1u/\%d/'  src/flock.c > src/flock-new.c;;
    no)  sed -e's/\%1u/\%ld/' src/flock.c > src/flock-new.c;;
    *)   echo "pre-make-build.sh: '$on_mac_os' unrecognized value for on_mac_os";;
esac

It would be great if this can be taken into the source of flock for future versions so we can remove this extra manual correction 😉.

from flock.

josephholsten avatar josephholsten commented on August 15, 2024

Well, I don’t love putting this into the build script, but fixed in an ugly way is better than broken! I’m sorry I’m not really able to draft this in the near future. I’m giving you a commit bit, please push us a PR!

from flock.

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.