Skip to content

Commit defbbfa

Browse files
committed
Compute hashes of executable files when migrating
The 'hash' column was added in commit bc1608f (Add hash to executable files and immutable executables., 2021-03-30), but the hashes were not computed for existing files, which broke migrations from < 8.0.0 (judging fails with error message "Fetching executable failed for compile script '<n>': Unexpected hash ..."). This commit fixes Version20210407120356.php so that it will compute the hashes. Note that this will not fix databases that have already been migrated from 7.x using a DOMjudge version in the range 8.0.0 to 8.3.0. The recommended workaround is to upgrade directly from 7.x to 8.3.1 (or higher). Alternatively, there is a patch[1] that can be used to fix such databases (it applies to 8.3.0, but the code can be adapted for 8.0). [1] DOMjudge@f62d0ec
1 parent 2c1a834 commit defbbfa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

webapp/migrations/Version20210407120356.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public function up(Schema $schema) : void
5151
$executableBit = '0';
5252
}
5353
$this->connection->executeStatement(
54-
'INSERT INTO executable_file (`immutable_execid`, `filename`, `ranknumber`, `file_content`, `is_executable`) VALUES (?, ?, ?, ?, ?)',
55-
[$immutable_execid, $filename, $idx, $content, $executableBit]
54+
'INSERT INTO executable_file (`immutable_execid`, `filename`, `ranknumber`, `file_content`, `hash`, `is_executable`) VALUES (?, ?, ?, ?, ?)',
55+
[$immutable_execid, $filename, $idx, $content, $md5($content), $executableBit]
5656
);
5757
}
5858

0 commit comments

Comments
 (0)