On Monday 16 February 2009 11:07:56 you wrote: > Kamil Dudka wrote: > > On Thursday 12 February 2009 14:27:09 Jim Meyering wrote: > >> While rewriting that, > >> > >> install accepts a new option, --compare (-C): compare each pair of > >> source and destination files, and if the destination has identical > >> content and any specified owner, group, permissions, and possibly > >> SELinux context, then do not modify the destination at all. > > Why is this an option? > I.E. should we just accept -C for compat, but do this all the time? > I haven't thought about it really. Just wondering. > I suppose one might want timestamps updated/preserved to > know when the file was installed/built? Normally install always changes the timestamps, but with -C not. This is definitely a change of behavior. The option is necessary I think.
> > +static bool > > +have_same_content (int a_fd, int b_fd) > > +{ > > +#define CMP_BLOCK_SIZE 65536 > > + char a_buff[CMP_BLOCK_SIZE]; > > + char b_buff[CMP_BLOCK_SIZE]; > > + > > + size_t size; > > + while (0 < (size = full_read (a_fd, a_buff, CMP_BLOCK_SIZE))) { > > + if (size != full_read (b_fd, b_buff, CMP_BLOCK_SIZE)) > > + return false; > > + > > + if (memcmp (a_buff, b_buff, size) != 0) > > + return false; > > + } > > + > > + return size == 0; > > +#undef CMP_BLOCK_SIZE > > +} > > Is 128KiB of stack OK? > I noticed this related email from Eric: > http://lists.gnu.org/archive/html/m4-patches/2008-08/msg00001.html The idea of 64KiB on stack allocated buffers was taken from RHEL4 implementation. But you are right - it can be problem on some platforms. In this case it should be allocated dynamically. Any other ideas? Kamil _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils