[darcs-users] patch file naming

Ganesh Sittampalam ganesh at earth.li
Wed Mar 17 02:32:07 UTC 2004


I just discovered that the SHA1 element of a patch file name is generated
purely from the patch name, author, date, long comment (if any) +
inversion status (whether this is a reversed patch or not, I guess). Since
darcs happily clobbers patch files with the same name as the one it is
trying to write, this makes it rather easy to make an invalid repository
(e.g. :

darcs inittree
touch foo
darcs record -A foo at bar -m foo -a --look-for-adds
echo bar >> foo ; \
  darcs record -A foo at bar -a -m foo ; \
  echo quux >> foo ; \
  darcs record -A foo at bar -a -m foo

Obviously this "bug" is rather hard to cause accidentally, but it's still
a little worrying. Why not hash the entire patch contents, rather than
just the header information? Also, since get_common_and_uncommon in
Depends.lhs just compares headers, it seems as if a collision could cause
some really odd problems further down the line.



More information about the darcs-users mailing list