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>
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"