Davlet Panech bd803643a1 archive-dir.sh: handle unusual file names
archive-dir.sh fails on files that contain substrings similar to
"name=...". This happens when we parse the list of file names and
attributes, one per line, of the form:

  type=f owner=myuser ... name=some/file/name.ext

Problem observed with some docker FS layers containing files whose
names include a "name=..." token, eg:

  type=f owner=myuser ... name=aaa,name=bbb,ccc

The parsing algorithm picks up the last "name=bbb,ccc", incorrectly.

SOLUTION
===================
* use greedy wildcard when looking for "name=" (ie, look for 1st
  occurance)
* cut off "name=..." before attempting to parse out the other
  attributes, to make sure we don't confuse them with parts of the file
  name
* ignore errors from "look" utility; eg when the list file is empty

TESTS
===================
* Set ARCHIVE_BIG_DIRS="top-symlink docker:checksum-hardlink" in
  build.conf
* Create a file named "aaa,name=bbb,ccc" in $STX_BUILD_HOME/docker/
* Run Jenkins build that triggers the"archive-misc step, but skips
  package, ISO & docker image builds.
* Make sure the file gets created at destination w/o errors

Closes-Bug: 2084570
Signed-off-by: Davlet Panech <davlet.panech@windriver.com>
Change-Id: Ib455c1b381e0b5ddaa40714c27340b2ec3f5676a
2024-10-15 13:39:32 -04:00
..