From 5206427a47a7d638fed6cef3aeeeefba0c2d21e8 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Mon, 2 Apr 2018 20:13:07 -0700 Subject: [PATCH] Update go-fs. Closes #6083 --- .../github.com/mitchellh/go-fs/fat/boot_sector.go | 13 +++++++------ .../github.com/mitchellh/go-fs/fat/cluster_chain.go | 3 ++- vendor/github.com/mitchellh/go-fs/fat/directory.go | 9 +++++---- .../mitchellh/go-fs/fat/directory_cluster.go | 7 ++++--- vendor/github.com/mitchellh/go-fs/fat/fat.go | 3 ++- vendor/github.com/mitchellh/go-fs/fat/short_name.go | 9 ++++++--- .../github.com/mitchellh/go-fs/fat/super_floppy.go | 3 ++- vendor/vendor.json | 10 +++++----- 8 files changed, 33 insertions(+), 24 deletions(-) diff --git a/vendor/github.com/mitchellh/go-fs/fat/boot_sector.go b/vendor/github.com/mitchellh/go-fs/fat/boot_sector.go index 689a6b75c..f62df9283 100644 --- a/vendor/github.com/mitchellh/go-fs/fat/boot_sector.go +++ b/vendor/github.com/mitchellh/go-fs/fat/boot_sector.go @@ -4,8 +4,9 @@ import ( "encoding/binary" "errors" "fmt" - "github.com/mitchellh/go-fs" "unicode" + + "github.com/mitchellh/go-fs" ) type MediaType uint8 @@ -99,7 +100,7 @@ func (b *BootSectorCommon) Bytes() ([]byte, error) { for i, r := range b.OEMName { if r > unicode.MaxASCII { - return nil, fmt.Errorf("'%s' in OEM name not a valid ASCII char. Must be ASCII.", r) + return nil, fmt.Errorf("%#U in OEM name not a valid ASCII char. Must be ASCII.", r) } sector[0x3+i] = byte(r) @@ -245,7 +246,7 @@ func (b *BootSectorFat16) Bytes() ([]byte, error) { for i, r := range b.VolumeLabel { if r > unicode.MaxASCII { - return nil, fmt.Errorf("'%s' in VolumeLabel not a valid ASCII char. Must be ASCII.", r) + return nil, fmt.Errorf("%#U in VolumeLabel not a valid ASCII char. Must be ASCII.", r) } sector[43+i] = byte(r) @@ -258,7 +259,7 @@ func (b *BootSectorFat16) Bytes() ([]byte, error) { for i, r := range b.FileSystemTypeLabel { if r > unicode.MaxASCII { - return nil, fmt.Errorf("'%s' in FileSystemTypeLabel not a valid ASCII char. Must be ASCII.", r) + return nil, fmt.Errorf("%#U in FileSystemTypeLabel not a valid ASCII char. Must be ASCII.", r) } sector[54+i] = byte(r) @@ -324,7 +325,7 @@ func (b *BootSectorFat32) Bytes() ([]byte, error) { for i, r := range b.VolumeLabel { if r > unicode.MaxASCII { - return nil, fmt.Errorf("'%s' in VolumeLabel not a valid ASCII char. Must be ASCII.", r) + return nil, fmt.Errorf("%#U in VolumeLabel not a valid ASCII char. Must be ASCII.", r) } sector[71+i] = byte(r) @@ -337,7 +338,7 @@ func (b *BootSectorFat32) Bytes() ([]byte, error) { for i, r := range b.FileSystemTypeLabel { if r > unicode.MaxASCII { - return nil, fmt.Errorf("'%s' in FileSystemTypeLabel not a valid ASCII char. Must be ASCII.", r) + return nil, fmt.Errorf("%#U in FileSystemTypeLabel not a valid ASCII char. Must be ASCII.", r) } sector[82+i] = byte(r) diff --git a/vendor/github.com/mitchellh/go-fs/fat/cluster_chain.go b/vendor/github.com/mitchellh/go-fs/fat/cluster_chain.go index a1f9161d7..344f12e7c 100644 --- a/vendor/github.com/mitchellh/go-fs/fat/cluster_chain.go +++ b/vendor/github.com/mitchellh/go-fs/fat/cluster_chain.go @@ -1,9 +1,10 @@ package fat import ( - "github.com/mitchellh/go-fs" "io" "math" + + "github.com/mitchellh/go-fs" ) type ClusterChain struct { diff --git a/vendor/github.com/mitchellh/go-fs/fat/directory.go b/vendor/github.com/mitchellh/go-fs/fat/directory.go index ff62319fd..2dec26ad2 100644 --- a/vendor/github.com/mitchellh/go-fs/fat/directory.go +++ b/vendor/github.com/mitchellh/go-fs/fat/directory.go @@ -2,9 +2,10 @@ package fat import ( "fmt" - "github.com/mitchellh/go-fs" "strings" "time" + + "github.com/mitchellh/go-fs" ) // Directory implements fs.Directory and is used to interface with @@ -16,9 +17,9 @@ type Directory struct { } // DirectoryEntry implements fs.DirectoryEntry and represents a single -// file/folder within a directory in a FAT filesystem. Note that the -// underlying directory entry data structures on the disk may be more -// than one to accomodate for long filenames. +// file/folder within a directory in a FAT filesystem. Note that there may be +// more than one underlying directory entry data structure on the disk to +// account for long filenames. type DirectoryEntry struct { dir *Directory lfnEntries []*DirectoryClusterEntry diff --git a/vendor/github.com/mitchellh/go-fs/fat/directory_cluster.go b/vendor/github.com/mitchellh/go-fs/fat/directory_cluster.go index b822e82db..691710636 100644 --- a/vendor/github.com/mitchellh/go-fs/fat/directory_cluster.go +++ b/vendor/github.com/mitchellh/go-fs/fat/directory_cluster.go @@ -5,11 +5,12 @@ import ( "encoding/binary" "errors" "fmt" - "github.com/mitchellh/go-fs" "math" "strings" "time" "unicode/utf16" + + "github.com/mitchellh/go-fs" ) type DirectoryAttr uint8 @@ -126,7 +127,7 @@ func NewDirectoryCluster(start uint32, parent uint32, t time.Time) *DirectoryClu // Create the "." and ".." entries cluster.entries = []*DirectoryClusterEntry{ - &DirectoryClusterEntry{ + { accessTime: t, attr: AttrDirectory, cluster: start, @@ -134,7 +135,7 @@ func NewDirectoryCluster(start uint32, parent uint32, t time.Time) *DirectoryClu name: ".", writeTime: t, }, - &DirectoryClusterEntry{ + { accessTime: t, attr: AttrDirectory, cluster: parent, diff --git a/vendor/github.com/mitchellh/go-fs/fat/fat.go b/vendor/github.com/mitchellh/go-fs/fat/fat.go index 8597986f6..3b6ceb16a 100644 --- a/vendor/github.com/mitchellh/go-fs/fat/fat.go +++ b/vendor/github.com/mitchellh/go-fs/fat/fat.go @@ -3,8 +3,9 @@ package fat import ( "errors" "fmt" - "github.com/mitchellh/go-fs" "math" + + "github.com/mitchellh/go-fs" ) // The first cluster that can really hold user data is always 2 diff --git a/vendor/github.com/mitchellh/go-fs/fat/short_name.go b/vendor/github.com/mitchellh/go-fs/fat/short_name.go index df03a2aaf..c91c161f5 100644 --- a/vendor/github.com/mitchellh/go-fs/fat/short_name.go +++ b/vendor/github.com/mitchellh/go-fs/fat/short_name.go @@ -30,11 +30,11 @@ func generateShortName(longName string, used []string) (string, error) { if dotIdx == -1 { dotIdx = len(longName) } else { - ext = longName[dotIdx+1 : len(longName)] + ext = longName[dotIdx+1:] } ext = cleanShortString(ext) - ext = ext[0:len(ext)] + ext = ext[0:] rawName := longName[0:dotIdx] name := cleanShortString(rawName) simpleName := fmt.Sprintf("%s.%s", name, ext) @@ -42,7 +42,7 @@ func generateShortName(longName string, used []string) (string, error) { simpleName = simpleName[0 : len(simpleName)-1] } - doSuffix := name != rawName || len(name) > 8 + doSuffix := name != rawName || len(name) > 8 || len(ext) > 3 if !doSuffix { for _, usedSingle := range used { if strings.ToUpper(usedSingle) == simpleName { @@ -53,6 +53,9 @@ func generateShortName(longName string, used []string) (string, error) { } if doSuffix { + if len(ext) > 3 { + ext = ext[:3] + } found := false for i := 1; i < 99999; i++ { serial := fmt.Sprintf("~%d", i) diff --git a/vendor/github.com/mitchellh/go-fs/fat/super_floppy.go b/vendor/github.com/mitchellh/go-fs/fat/super_floppy.go index 16ad2caeb..ceaf4926a 100644 --- a/vendor/github.com/mitchellh/go-fs/fat/super_floppy.go +++ b/vendor/github.com/mitchellh/go-fs/fat/super_floppy.go @@ -3,8 +3,9 @@ package fat import ( "errors" "fmt" - "github.com/mitchellh/go-fs" "time" + + "github.com/mitchellh/go-fs" ) // SuperFloppyConfig is the configuration for various properties of diff --git a/vendor/vendor.json b/vendor/vendor.json index b48f00557..3f24598df 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -1022,14 +1022,14 @@ { "checksumSHA1": "mVqDwKcibat0IKAdzAhfGIHPwI8=", "path": "github.com/mitchellh/go-fs", - "revision": "7bae45d9a684750e82b97ff320c82556614e621b", - "revisionTime": "2016-11-08T19:11:23Z" + "revision": "7b48fa161ea73ce54566b233d6fba8750b2faf47", + "revisionTime": "2018-04-02T23:40:41Z" }, { - "checksumSHA1": "B5dy+Lg6jFPgHYhozztz88z3b4A=", + "checksumSHA1": "i+3acspzTbQODW3dWX2JKydHVAo=", "path": "github.com/mitchellh/go-fs/fat", - "revision": "7bae45d9a684750e82b97ff320c82556614e621b", - "revisionTime": "2016-11-08T19:11:23Z" + "revision": "7b48fa161ea73ce54566b233d6fba8750b2faf47", + "revisionTime": "2018-04-02T23:40:41Z" }, { "checksumSHA1": "z235fRXw4+SW4xWgLTYc8SwkM2M=",