[Toybox] [New toys] - diff, userdel

2014-08-01 Thread Ashwini Sharma
Hi Rob, List,

Attached are the new toys unified DIFF and USERDEL.

Your inputs are welcome.

regards,
Ashwini


diff.c.patch
Description: Binary data


userdel.c.patch
Description: Binary data
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


Re: [Toybox] [New toys] - diff, userdel

2014-08-02 Thread Rob Landley
On 08/01/14 06:08, Ashwini Sharma wrote:
> Hi Rob, List,
> 
> Attached are the new toys unified DIFF and USERDEL.
> 
> Your inputs are welcome.

Query, is this diff using Brahm Cohen's "patience" algorithm?

Backstory: the guy who wrote bittorrent invented his own diff algorithm
that produces more human-readable output than the others, I've been
meaning to use it here for years. He described the current formulation
of the algorithm here:

http://bramcohen.livejournal.com/73318.html?nojs=1

I've mentioned here a few times that I want to use it, although the most
recent hit Google comes up with is:

http://lists.landley.net/pipermail/toybox-landley.net/2012-March/000338.html

The architectural issue that's kept it down the todo list is that
less/vi/diff all need a common "text buffer" piece of infrastructure in
lib/ which hasn't been written yet.

So far only vi needs to insert stuff in the middle, so a tree is
probably overkill. (I can basically do two char * arrays with an
insertion point in the middle, have the second array be _backwards_ so
that moving lines from one to another is always pushing/popping from the
ends of the arrays and never having to recoy the whole thing,  and then
inserting at the end of the whole file is just "second array is length
0". Then each line would be a separate malloc which is what getline is
returning already, and lets individual lines change length if they're
edited. It would churn memory a bit on nommu systems but I'm not sure
that's avoidable...)

Anyway, I'll try to take a look at this this weekend. Thanks.

Rob
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


Re: [Toybox] [New toys] - diff, userdel

2014-08-03 Thread Bobby Bingham
On Sat, Aug 02, 2014 at 11:39:21AM -0500, Rob Landley wrote:
> On 08/01/14 06:08, Ashwini Sharma wrote:
> > Hi Rob, List,
> >
> > Attached are the new toys unified DIFF and USERDEL.
> >
> > Your inputs are welcome.
>
> Query, is this diff using Brahm Cohen's "patience" algorithm?
>
> Backstory: the guy who wrote bittorrent invented his own diff algorithm

Patience diff is not a diff algorithm.  It's pre-processing for feeding
the input into another diff algorithm.  Step #3 in the algorithm
description amounts to "feed the remaining lines into a real diff
algorithm".

I have actually implemented patience diff and several underlying diff
algorithms for $DAYJOB.  I've been tempted to contribute a diff
implementation here, but I can't just take that code and submit it ...

I will try though to take a look at the patch at some point in the next
couple days and see if I have any comments about the diff algorithm
used.

--
Bobby Bingham


signature.asc
Description: Digital signature
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


Re: [Toybox] [New toys] - diff, userdel

2014-08-04 Thread Rob Landley
On 08/03/14 15:39, Bobby Bingham wrote:
> On Sat, Aug 02, 2014 at 11:39:21AM -0500, Rob Landley wrote:
>> On 08/01/14 06:08, Ashwini Sharma wrote:
>>> Hi Rob, List,
>>>
>>> Attached are the new toys unified DIFF and USERDEL.
>>>
>>> Your inputs are welcome.
>>
>> Query, is this diff using Brahm Cohen's "patience" algorithm?
>>
>> Backstory: the guy who wrote bittorrent invented his own diff algorithm
> 
> Patience diff is not a diff algorithm.  It's pre-processing for feeding
> the input into another diff algorithm.  Step #3 in the algorithm
> description amounts to "feed the remaining lines into a real diff
> algorithm".

Cool, that makes a bit more sense now.

> I have actually implemented patience diff and several underlying diff
> algorithms for $DAYJOB.  I've been tempted to contribute a diff
> implementation here, but I can't just take that code and submit it ...
> 
> I will try though to take a look at the patch at some point in the next
> couple days and see if I have any comments about the diff algorithm
> used.

I look forward to this. Thanks.

Rob
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net


Re: [Toybox] [New toys] - diff, userdel

2014-08-04 Thread Ashwini Sharma
Hi Rob,

Wasn't aware of your comments on diff,
An algorithm by Hunt & McIlory ( http://cm.bell-labs.com/cm/cs/cstr/41.pdf)
is used for this diff implementation.

Will have a look at Patience Diff and see if current implementation can be
patched.

regards,
Ashwini


On Mon, Aug 4, 2014 at 7:44 PM, Rob Landley  wrote:

> On 08/03/14 15:39, Bobby Bingham wrote:
> > On Sat, Aug 02, 2014 at 11:39:21AM -0500, Rob Landley wrote:
> >> On 08/01/14 06:08, Ashwini Sharma wrote:
> >>> Hi Rob, List,
> >>>
> >>> Attached are the new toys unified DIFF and USERDEL.
> >>>
> >>> Your inputs are welcome.
> >>
> >> Query, is this diff using Brahm Cohen's "patience" algorithm?
> >>
> >> Backstory: the guy who wrote bittorrent invented his own diff algorithm
> >
> > Patience diff is not a diff algorithm.  It's pre-processing for feeding
> > the input into another diff algorithm.  Step #3 in the algorithm
> > description amounts to "feed the remaining lines into a real diff
> > algorithm".
>
> Cool, that makes a bit more sense now.
>
> > I have actually implemented patience diff and several underlying diff
> > algorithms for $DAYJOB.  I've been tempted to contribute a diff
> > implementation here, but I can't just take that code and submit it ...
> >
> > I will try though to take a look at the patch at some point in the next
> > couple days and see if I have any comments about the diff algorithm
> > used.
>
> I look forward to this. Thanks.
>
> Rob
> ___
> Toybox mailing list
> Toybox@lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
>
___
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net