Re: [Toybox] [PATCH] Implement mv -n / cp -n (no clobber).

2016-03-27 Thread Rob Landley
On 03/27/2016 01:46 PM, Andy Chu wrote: >> 3) Security features for distributed systems ... sh is obviously not >> designed for untrusted input (including what's on the file system). > > 4) ... along these same lines, a lot of other people are annoyed by > the gratuitous and crippled shell in make

Re: [Toybox] [PATCH] Implement mv -n / cp -n (no clobber).

2016-03-27 Thread Rob Landley
On 03/27/2016 01:25 PM, Andy Chu wrote: >> So I threw out CP_MORE as a bad idea, and almost all commands just have >> the "include it or not" option now. There are a few global options, but >> not many, and I may even eliminate some of those (I18N: the world has >> utf8 now, deal with it). > > I a

Re: [Toybox] [PATCH SET] Fix test harness issues and fix tests

2016-03-27 Thread Andy Chu
FYI with these patches, and this addition to expr.test: # Case that triggers ASAN error testing "regex" "expr 3 : '\(.\)' = 4 : '\(.\)'" "0\n" "" "" Then running the following command line shows a heap-use-after-free error in expr, detected by ASAN. (Basically there are two regex captures, and y

Re: [Toybox] [PATCH] Implement mv -n / cp -n (no clobber).

2016-03-27 Thread dmccunney
On Sun, Mar 27, 2016 at 2:25 PM, Andy Chu wrote: > Sure I could just go change coreutils and bash ... I've been puzzling > through the bash source code and considering that. > bash is like 175K+ lines of code, and If you wanted to support all of > it, I think you would end up with at least 50K

Re: [Toybox] [PATCH] Implement mv -n / cp -n (no clobber).

2016-03-27 Thread Andy Chu
>> Anecdotally, it seems like a lot of shell script issues are caused by >> unexpected existing state, but in a lot of cases you don't CARE about >> the existing state -- you just want a final state (e.g. a bunch of >> symlinks to toybox). > > "ln -sf" actually works pretty predictably. :) One mor

Re: [Toybox] [PATCH] Implement mv -n / cp -n (no clobber).

2016-03-27 Thread Andy Chu
> 3) Security features for distributed systems ... sh is obviously not > designed for untrusted input (including what's on the file system). 4) ... along these same lines, a lot of other people are annoyed by the gratuitous and crippled shell in make: https://github.com/apenwarr/redo -- implement

Re: [Toybox] [PATCH] Implement mv -n / cp -n (no clobber).

2016-03-27 Thread Andy Chu
> rm /usr/bin/toybox > cp toybox /usr/bin/toybox #fails because cp is dangling symlink > > It's not a race condition, it's a "you can keep running a binary after > it's deleted but can't launch new instances" problem. OK I see now. Why not just: mv /usr/bin/toybox /tmp/cp /tmp/cp toybox /usr