[sbopkg-users] [sbopkg-discuss] Re: Feature request - show diffs

Phillip Warner phillip.c.warner at gmail.com
Fri Feb 20 03:27:09 UTC 2009


On 2/18/09, Chess Griffin <chess at chessgriffin.com> wrote:
> * Mauro Giachero <mauro.giachero at gmail.com> [2009-02-18 10:03:08]:
>> > If that is the case, then instead
>> > of using a tmp file why not have a statement similar to this
>> >
>> > if [ -n "$(diff -q file1 file2 2>/dev/null)" ]; then
>> >  # do_dialog_code
>> > fi
>> >
>> > This would keep y'all from having to manage even more tmp files.
>>
>>
>> But this would to the diff twice...
>> I really think it's a matter of taste here. Frankly, I'm not worried about
>> temp files whose lifespan doesn't exceed that of a single function --
>> after
>> all, it's rather easy to manage them correctly.
>>
>
> I agree.  Let's go with Mauro's patch that leaves the tmp file and includes
> the DIFF and DIFFOPTS variables.
>
> --
> Chess Griffin
>
Leaving the tmp file, etc in is fine.  However, since DIFFOPTS is in
you shouldn't base whether or not to show the dialog by what is in the
tmp file (for instance a DIFFOPTS of '-s' would mess up your logic).
For that I still recommend keeping in the 'diff -q' command similar to
the above (no DIFF or DIFFOPTS used for that one) so that you know
what to expect in the tmp file.

I wouldn't worry about diffing twice, either.  Since with '-q' it is
only checking if there are any differences, the command won't likely
need to compare both files completely unless the worst case scenario
is present (changes at end of file or files identical).  And again,
these are small files, so there shouldn't be a bad lag.

--phillip


More information about the sbopkg-users mailing list