Comments (6)
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.
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.
Please go ahead @josephholsten 😉...
from flock.
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.
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.
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)
- The -c option behaves differently to Linux HOT 10
- -V and --version flags are not recognised HOT 2
- mention sbase flock
- Add -h/--help option
- Download error when installing via "brew install flock" HOT 3
- travis tests for linux
- pass flint-checker analysis
- Getting a standard *.1 file requires installing Ronn HOT 2
- flock behavior on BSD - question HOT 2
- flock: failed to execute command - No such file or directory HOT 6
- File not created? HOT 1
- tag release? HOT 5
- resource.h:215:2: error: unknown type name 'uint64_t' HOT 1
- Flock supported in macports HOT 1
- build command failed HOT 2
- Mention netbsd flock
- mention systems where fcntl & flock syscalls don’t have mutual respect
- src/flock.c:223:2: error: implicit declaration of function ‘flock’ [-Werror=implicit-function-declaration] HOT 1
- Should support -x as a no-op like util-linux does HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flock.