Skip to content
Permalink
Browse files

Merge pull request #23 from cruise-automation/cpio_fix_data_parsing

fix date parsing for cpiofs
  • Loading branch information
crmulliner committed Jan 13, 2020
2 parents b205c14 + 37506fd commit 4a3596e759bc20351d6db09010f5054c4330ff79
Showing with 5 additions and 2 deletions.
  1. +1 −0 Changelog.md
  2. +3 −2 pkg/cpioparser/cpioparser.go
  3. +1 −0 pkg/cpioparser/cpioparser_test.go
@@ -4,6 +4,7 @@

### Fixed
- _check.py_ fix to support pathnames with spaces
- _cpiofs_ fix date parsing

## [v1.3.1] - 2020-01-07

@@ -46,11 +46,12 @@ type CpioParser struct {
func New(imagepath string) *CpioParser {
parser := &CpioParser{
//lrwxrwxrwx 1 0 0 19 Apr 24 2019 lib/libnss_dns.so.2 -> libnss_dns-2.18.so
//-rwxrwxrwx 1 0 0 19 Apr 24 13:37 lib/lib.c
fileInfoReg: regexp.MustCompile(
`^([\w-]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+([\w\s\d:]+)\s+(.*)$`),
`^([\w-]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\w+\s\d+\s+[\d:]+)\s+(.*)$`),
// crw-r--r-- 1 0 0 4, 64 Apr 24 2019 dev/ttyS0
devInfoReg: regexp.MustCompile(
`^([\w-]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+),\s+(\d+)\s+([\w\s\d:]+)\s+(.*)$`),
`^([\w-]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+),\s+(\d+)\s+(\w+\s\d+\s+[\d:]+)\s+(.*)$`),
fileLinkReg: regexp.MustCompile(`(\S+)\s->\s(\S+)`),
imagepath: imagepath,
}
@@ -36,6 +36,7 @@ func TestParseLine(t *testing.T) {

testdata := []testData{
{`-rw-r--r-- 1 0 0 21 Apr 11 2008 etc/motd`, 0100644, "/etc/", "motd", true, ""},
{`-rw-r--r-- 1 0 0 21 Apr 11 13:37 etc/mxtd`, 0100644, "/etc/", "mxtd", true, ""},
{`crw-r--r-- 1 0 0 4, 64 Apr 24 2019 dev/ttyS0`, 020644, "/dev", "ttyS0", false, ""},
{`lrwxrwxrwx 1 0 0 19 Apr 24 2019 lib/libcrypto.so.1.0.0 -> libcrypto-1.0.0.so`, 0120777, "/lib", "libcrypto.so.1.0.0", false, "libcrypto-1.0.0.so"},
}

0 comments on commit 4a3596e

Please sign in to comment.
You can’t perform that action at this time.