Comments (10)
ah, well that use case convinces me. I'd usually this pattern for that use case, but that's obnoxious for one-offs.
ok, I'll look into implementing this.
from flock.
Great, I'll see how they're executing. I was a little afraid of entering n levels of encoding hell, so I just pass arguments along to execvp
, see https://github.com/discoteq/flock/blob/master/src/flock.c#L304
I'm not sure I agree that linux-utils behaviour is what is most reasonable, but compatibility trumps sanity, right?
from flock.
Ah, they're being "smart" and passing along to a subshell: https://github.com/karelzak/util-linux/blob/master/sys-utils/flock.c#L239
Can you find one other person to agree this is the appropriate behaviour? I'm torn.
from flock.
Looks like it was added back in util-linux/util-linux@baf39af#diff-1219b3b65dcec8078370f245769671b1R193
And the only explanation in its NEWS is:
- flock: replaced with flock-2.0.2 by H. Peter Anvin
from flock.
maybe if it's a single string, pass to a subshell; if it's multiple, exec directly? I feel like something has similar behaviour but I can't remember what.
from flock.
Thanks for looking into this.
I think the -c
option is to allow the caller have some symbols that would otherwise be interpreted by the shell.
flock -x file.lock cat id_rsa.pub >> authorized_keys
vs
flock -x file.lock -c 'cat id_rsa.pub >> authorized_keys'
In the first case above, the output of flock
is appended to authorized_keys
, outside of the lock; in the second case, the contents of id_rsa.pub
are appended to authorized_keys
inside the lock.
from flock.
+1
from flock.
so sorry, I dropped this right on the floor. I know I can't get to this till at least this evening, so here are my notes:
At the moment, -c
is just grabbing the command from getopt_long()
:
cmd_argv = &argv[optind + 1];
and tossing it straight into execvp()
if (0 != execvp(cmd_argv[0], cmd_argv)) {
so I really just want to build a new cmd_argv
with cmd_argv[0] = getenv("SHELL") || "/bin/sh"
, cmd_argv[1] = "-c"
, then push the rest in.
Needs doc, especially to say that you can SHELL=/bin/wtfsh
to specify your own.
from flock.
Yes, please implement this, it prevents it from being a 'drop in replacement' with some scripts i have :(
from flock.
If this is interesting to you, please review the implementation in #23
from flock.
Related Issues (20)
- -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
- Compilation error with GCC HOT 6
- 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.