DO NOT archive if filename is longer than 255 23/6123/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 24 Aug 2017 16:00:53 +0000 (12:00 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 29 Aug 2017 15:43:01 +0000 (11:43 -0400)
Most Unix filesystems do not allow files being created that are longer
than 255 characters. The LF Infra VMs are built with XFS and seem to
have the extended attribute allowing longer filenames. This
unfortuantely creates zip that when we copy to Nexus which does not have
this to fail to unpack. Limit archive files to 255 characters or less to
avoid this.

Issue: RELENG-322
Change-Id: I9c70a67d69559b834ec1c1bce0c2b909e61127dd
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
shell/deploy

index 8b60b78..9bbf720 100755 (executable)
@@ -45,6 +45,13 @@ copy_archives() {
         for pattern in $archive_pattern; do
             [[ -e $pattern ]] || continue  # handle the case of no files to archive
             echo "Archiving $pattern" >> "$workspace/archives.log"
+
+            filename=$(basename $pattern)
+            if [ "${#filename}" -gt 255 ]; then
+                echo "Filename too long: $pattern" | tee -a "$workspace/archives-missed.log"
+                continue
+            fi
+
             dir=$(dirname "$pattern")
             mkdir -p "$dest_dir/$dir"
             mv "$pattern" "$dest_dir/$pattern"