]> git.e2factory.org Git - e2factory.git/commitdiff
files: fix corner-case in SourceID calculation
authorTobias Ulmer <tu@emlix.com>
Fri, 25 Nov 2016 18:42:02 +0000 (19:42 +0100)
committerTobias Ulmer <tu@emlix.com>
Fri, 25 Nov 2016 18:42:11 +0000 (19:42 +0100)
If either copy, patch or unpack attribute of a file entry is set to the
string "nil" with everything else being equal, the SourceID does not
change.

Signed-off-by: Tobias Ulmer <tu@emlix.com>
Changelog
plugins/files.lua

index b86b657df4f94c074b9bfb863074613adfc265a2..76d5000f3e7855d22ed0df8e040481326807e160 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,5 @@
 NEXT:
+ * Fix SourceID calculation in files plugin under artificial conditions
  * Remove error message when an optional tool isn't present
 
 e2factory-2.3.15
index e95ef1bf3ca85599034c11670a2048b43d324ec1..f6d6a2a5e96caf25c7936b2e82d4484854d4af85 100644 (file)
@@ -268,9 +268,15 @@ function files.files_source:sourceid(sourceset --[[always ignored for files]])
         hash.hash_append(hc, fileid)
         hash.hash_append(hc, file:location())
         hash.hash_append(hc, file:server())
-        hash.hash_append(hc, tostring(file:unpack()))
-        hash.hash_append(hc, tostring(file:patch()))
-        hash.hash_append(hc, tostring(file:copy()))
+        if file:unpack() then
+            hash.hash_append(hc, file:unpack())
+        elseif file:patch() then
+            hash.hash_append(hc, file:patch())
+        elseif file:copy() then
+            hash.hash_append(hc, file:copy())
+        else
+            assert(false, "no file attribute set")
+        end
 
         -- per file licence list
         for licencename in file:licences():iter() do