return fmt.Errorf("line %d: bad locator %q", lineno, token)
}
- toks := strings.Split(token, ":")
+ toks := strings.SplitN(token, ":", 3)
if len(toks) != 3 {
return fmt.Errorf("line %d: bad file segment %q", lineno, token)
}
if !ok {
return os.ErrNotExist
}
+ if locked[oldinode] {
+ // oldinode cannot become a descendant of itself.
+ return ErrInvalidArgument
+ }
if existing, ok := newdn.inodes[newname]; ok {
// overwriting an existing file or dir
if dn, ok := existing.(*dirnode); ok {
type storedSegment struct {
kc keepClient
locator string
- size int
- offset int
- length int
+ size int // size of stored block (also encoded in locator)
+ offset int // position of segment within the stored block
+ length int // bytes in this segment (offset + length <= size)
}
func (se storedSegment) Len() int {
return name
}
-var manifestEscapeSeq = regexp.MustCompile(`\\([0-9]{3}|\\)`)
+var manifestEscapeSeq = regexp.MustCompile(`\\([0-7]{3}|\\)`)
func manifestUnescapeFunc(seq string) string {
if seq == `\\` {
return manifestEscapeSeq.ReplaceAllStringFunc(s, manifestUnescapeFunc)
}
-var manifestEscapedChar = regexp.MustCompile(`[^\.\w/]`)
+var manifestEscapedChar = regexp.MustCompile(`[\000-\040:\s\\]`)
func manifestEscapeFunc(seq string) string {
return fmt.Sprintf("\\%03o", byte(seq[0]))