Skip to content

Commit

Permalink
Make syncqt order headers deterministically.
Browse files Browse the repository at this point in the history
Syncqt was relying on the order that headers appear in the filesystem.
That order is effectively non-deterministic, meaning that the files
generated when running syncqt on different copies of the same source are
very hard to compare.

For example, when generating source packages for the same sha1 twice in
a row, you would expect to get identical source packages, but you don't
because each packaging run downlaods the source tree from git, thus
randomizing the order of files on the filesystem.

This commit forces syncqt to be deterministic by making it sort each
directory it reads before it processes the directory.

On a side note: syncqt should probably be using Perl's File::Find
function instead of recursing through directories itself.

Reviewed-by: Lincoln Ramsay
  • Loading branch information
Jason McDonald committed Sep 25, 2009
1 parent b768917 commit 9ff1888
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/syncqt
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ sub findFiles {
} else {
($dir =~ /\/$/) || ($dir .= "/");
}
foreach $file ( readdir(D) ) {
foreach $file ( sort readdir(D) ) {
next if ( $file =~ /^\.\.?$/ );
$p = $file;
($file =~ /$match/) && (push @files, $p);
Expand Down

0 comments on commit 9ff1888

Please sign in to comment.