id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c160500
likely block boundaries? return d.waitBufBytes >= d.syncBufferCap }
c160501
defer d.lock.RUnlock() return len(d.cache) }
c160502
Clear out the remaining requests for req := range d.requestsChan { d.updateWaitBufLocked(req.bytes) } if d.syncBufBytes != 0 || d.waitBufBytes != 0 || d.ignoreSyncBytes != 0 { return fmt.Errorf("Unexpected dirty bytes leftover on shutdown: "+ "syncBuf=%d, waitBuf=%d, ignore=%d", d.syncBufBytes, d.waitBufB...
c160503
[]cli.Command{ newCmdUpdateCheck(cl, g), // Deprecated newCmdUpdateCheckInUse(cl, g), newCmdUpdateNotify(cl, g), }, } }
c160504
Action: func(c *cli.Context) { cl.SetLogForward(libcmdline.LogForwardNone) cl.SetForkCmd(libcmdline.NoFork) cl.ChooseCommand(newCmdUpdateCheckInUseRunner(g), "check-in-use", c) }, } }
c160505
*cli.Context) { cl.ChooseCommand(&CmdSimpleFSPs{Contextified: libkb.NewContextified(g)}, "ps", c) cl.SetNoStandalone() }, } }
c160506
goroutine. We've already done the Add above, so the // wait calls should all work just fine. select { case fbm.archiveChan <- md: return default: go func() { fbm.archiveChan <- md }() } }
c160507
// return early if the context has been canceled case <-ctx.Done(): return default: } } } for i := 0; i < numWorkers; i++ { wg.Add(1) go worker() } for start := 0; start < len(ptrs); start += numPointersToDowngradePerChunk { end := start + numPointersToDowngradePerChunk if end > len(ptrs) ...
c160508
{ return fbm.doChunkedDowngrades(ctx, tlfID, ptrs, false) }
c160509
an example // of how this can happen. if ptr != data.ZeroPtr && !ptrMap[ptr] { ptrMap[ptr] = true } nextPtr++ if max >= 0 && len(ptrMap) >= max { complete = false break opLoop } } for _, update := range op.allUpdates() { currPtr++ // Skip past any ptrs we've already processed. ...
c160510
fbm.log.CDebugf(ctx, "Found last gc revision %d in "+ "MD revision %d", rmd.data.LastGCRevision, rmd.Revision()) return rmd.data.LastGCRevision, nil } for j := len(rmd.data.Changes.Ops) - 1; j >= 0; j-- { GCOp, ok := rmd.data.Changes.Ops[j].(*GCOp) if !ok || GCOp.LatestRev == kbfsmd.Rev...
c160511
fmt.Sprintf( "Can't handle the unref'd pointers of revision %d", lastRev)) } ptrs = append(ptrs, newPtrs...) // TODO: when can we clean up the MD's unembedded block // changes pointer? It's not safe until we know for sure // that all existing clients have received the latest // update (...
c160512
if err != nil { return kbfscrypto.TLFCryptKeyServerHalf{}, err } // get current uid and deviceKID session, err := k.config.KBPKI().GetCurrentSession(ctx) if err != nil { return kbfscrypto.TLFCryptKeyServerHalf{}, err } // verify we got the expected key err = kbfscrypto.VerifyTLFCryptKeyServerHalfID( serv...
c160513
k.config.KeyServer().PutTLFCryptKeyServerHalves(ctx, keyServerHalves) }
c160514
serverHalfID kbfscrypto.TLFCryptKeyServerHalfID) error { return k.config.KeyServer().DeleteTLFCryptKeyServerHalf( ctx, uid, key, serverHalfID) }
c160515
NewLoadUserArg(m.G()).WithPublicKeyOptional().WithSelf(true).WithNetContext(ctx).WithForcePoll(true) return m.WithUser(arg, f) }
c160516
if ldr := m.G().GetUPAKLoader(); ldr != nil { if err := ldr.PutUserToCache(ctx, u); err != nil { m.G().Log.CDebugf(ctx, "| CachedFullSelf#WithUser: continuing past error putting user to cache: %s", err) } } } else { m.G().Log.CDebugf(ctx, "| CachedFullSelf#WithUser: other user") } } else { m...
c160517
Invalidating me for UID=%s", u) m.me = nil } else { m.G().Log.Debug("| CachedFullSelf#HandleUserChanged: Ignoring cache bust for UID=%s", u) } return nil }
c160518
m.Unlock() if m.me != nil && !m.me.GetUID().Equal(m.G().GetMyUID()) { m.me = nil } return nil }
c160519
notification, no available channel") return } f.notificationGroup.Add(1) f.notifications.In() <- fn }
c160520
gets blocked while // trying to enqueue a notification (while it is holding locks), // we could have a deadlock. Yes, if there are too many // outstanding notifications we'll run out of memory and crash, // but otherwise we risk deadlock. Which is worse? f.notifications = channels.NewInfiniteChannel() // star...
c160521
JSONPayload: payload, SessionType: libkb.APISessionTypeREQUIRED, } _, err := mctx.G().API.PostJSON(mctx, arg) return err }
c160522
phoneNumbersResponse err := mctx.G().API.GetDecode(mctx, arg, &resp) if err != nil { return nil, err } return resp.PhoneNumbers, nil }
c160523
(err error) { err = c.Cli.Call(ctx, "keybase.1.paperprovision.paperProvision", []interface{}{__arg}, nil) return }
c160524
// If no match, return "" if len(paths) <= 1 { return "", fmt.Errorf("Unable to resolve bundle for valid path: %s", path) } appPath := paths[0] + ".app" if exists, _ := libkb.FileExists(appPath); !exists { return "", fmt.Errorf("App not found: %s", appPath) } return appPath, nil }
c160525
make(chan string, 1), notifySyncBuffer: make(chan *keybase1.FSPathSyncStatus, 1), notifyOverallSyncBuffer: make(chan keybase1.FolderSyncStatus, 1), shutdownCh: make(chan struct{}), } var ctx context.Context ctx, r.canceler = context.WithCancel(context.Background()) go r.send(ctx) retur...
c160526
r.notifyOverallSyncBuffer <- status: case <-r.shutdownCh: } }() } else { r.vlog.CLogf( ctx, libkb.VLog1, "ReporterKBPKI: notify overall sync buffer dropping %+v", status) } } }
c160527
close(r.onlineStatusBuffer) close(r.notifySyncBuffer) close(r.notifyOverallSyncBuffer) }
c160528
"notification for path: %s", err) } default: } select { case status, ok := <-r.notifySyncBuffer: if !ok { return } if err := r.config.KeybaseService().NotifySyncStatus(ctx, status); err != nil { r.log.CDebugf(ctx, "ReporterDaemon: error sending "+ "sync status: %s"...
c160529
file.Tlf.Type() == tlf.Public { n.NotificationType = keybase1.FSNotificationType_SIGNING } else { n.NotificationType = keybase1.FSNotificationType_ENCRYPTING } return n }
c160530
== tlf.Public { n.NotificationType = keybase1.FSNotificationType_VERIFYING } else { n.NotificationType = keybase1.FSNotificationType_DECRYPTING } return n }
c160531
handle.Type().FolderType(), Filename: string(handle.GetCanonicalPath()), StatusCode: code, NotificationType: keybase1.FSNotificationType_REKEYING, } }
c160532
{ n := baseFileEditNotification(file, writer, localTime) n.NotificationType = keybase1.FSNotificationType_FILE_CREATED return n }
c160533
{ n := baseFileEditNotification(file, writer, localTime) n.NotificationType = keybase1.FSNotificationType_FILE_MODIFIED return n }
c160534
{ n := baseFileEditNotification(file, writer, localTime) n.NotificationType = keybase1.FSNotificationType_FILE_DELETED return n }
c160535
= keybase1.FSNotificationType_FILE_RENAMED n.Params = map[string]string{errorParamRenameOldFilename: oldFile.CanonicalPathString()} return n }
c160536
placeholder return &keybase1.FSNotification{ NotificationType: keybase1.FSNotificationType_CONNECTION, StatusCode: status, } }
c160537
} return &keybase1.FSNotification{ Filename: file.CanonicalPathString(), StatusCode: code, } }
c160538
} else { nType = keybase1.FSNotificationType_ENCRYPTING } default: panic(fmt.Sprintf("Unknown mode: %v", mode)) } return &keybase1.FSNotification{ FolderType: t.FolderType(), Filename: filename, StatusCode: keybase1.FSStatusCode_ERROR, Status: err.Error(), ErrorType: ...
c160539
make(map[string]*types.NameInfo), decKeys: make(map[string]types.CryptKey), encKeys: make(map[string]encItem), } }
c160540
public) existing, ok := k.lookupEncKey(ckey) if ok { return existing.key, existing.ni, nil } defer func() { if err == nil { k.writeEncKey(ckey, encItem{ key: res, ni: ni, }) } }() return k.createNameInfoSource(ctx, membersType).EncryptionKey(ctx, tlfName, tlfID, membersType, public) }
c160541
nil } defer func() { if err == nil { k.writeDecKey(ckey, res) } }() return k.createNameInfoSource(ctx, membersType).DecryptionKey(ctx, tlfName, tlfID, membersType, public, keyGeneration, kbfsEncrypted) }
c160542
res = append(res, pt.([]byte)...) r.Debug(r.ctx, "getChunksFromCache: added: index: %d len: %v", c.index, len(pt.([]byte))) } else { r.Debug(r.ctx, "getChunksFromCache: missed: %v", c.index) return res, false } } return res, true }
c160543
return 16 case r.size >= 500*mb: return 8 default: return 4 } }
c160544
...interface{}) { mctx.Debug(format, args...) if s.logger != nil { s.logger.Printf(format, args...) } }
c160545
{ return -1 } // Make sure this key is for our current user and not a different one. username := mctx.ActiveDevice().Username(mctx) if parts[1] != username.String() { return -1 } e, err := strconv.ParseUint(parts[2], 10, 64) if err != nil { return -1 } return keybase1.Seqno(e) }
c160546
prefix: %v or suffix: %s", prefix, deviceEKSuffix) return -1 } key = strings.TrimSuffix(key, deviceEKSuffix) parts := strings.Split(key, prefix) if len(parts) != 2 { mctx.Debug("keyToGeneration: unexpected parts: %v, prefix: %v", parts) return -1 } g, err := strconv.ParseUint(parts[1], 10, 64) if err != ...
c160547
defer s.Unlock() return s.listAllForUser(mctx, mctx.ActiveDevice().Username(mctx)) }
c160548
} for _, childFI := range children { if childFI.Name() == "." { continue } err := RecursiveDelete(ctx, subdirFS, childFI) if err != nil { return err } } return fs.Remove(fi.Name()) }
c160549
} else if err != nil { resp.Status = "error" resp.Message = err.Error() } else { // Success resp.Status = "ok" } resp.Client = req.Client err = out.Encode(resp) if err != nil { // TODO: Log this somewhere? fmt.Fprintf(os.Stderr, "error: %s", err) os.Exit(1) } return abortErr }
c160550
envDebug := os.Getenv("KBFSGIT_DEBUG") if envDebug != "0" && envDebug != "false" && envDebug != "no" { params.Debug = true } // This is set to false in docker tests for now, but we need it. So // override it to true here. params.EnableJournal = true params.DiskCacheMode = libkbfs.DiskCacheModeRemote params.S...
c160551
"Initialized new git config") config, err := libkbfs.InitWithLogPrefix( ctx, kbCtx, gitKBFSParams, keybaseServiceCn, nil, log, "git") if err != nil { return ctx, nil, err } config.SetVLogLevel(vlogLevel) // Make any blocks written by via this config charged to the git // quota. config.SetDefaultBlockType(...
c160552
// for the meaning of debug. debug := 1 if name == "goroutine" { debug = 2 } return profileRead(p, debug) }
c160553
time.Time, error) { var b bytes.Buffer err := p.WriteTo(&b, debug) if err != nil { return nil, time.Time{}, err } return b.Bytes(), time.Now(), nil } }
c160554
we count as an alias to the // original token stripped := stripExpr.Split(token, -1) for _, s := range stripped { if s == "" { continue } tokenMap[token][s] = chat1.EmptyStruct{} // add the stem as an alias stemmed := porterstemmer.StemWithoutLowerCasing([]rune(s)) tokenMap[token][string(s...
c160555
msgs[i] uiMsg := utils.PresentMessageUnboxed(ctx, g, msg, uid, convID) uiMsgs = append(uiMsgs, uiMsg) } return uiMsgs }
c160556
g.Log.CDebugf(ctx, "replacing error: %v", err) return fmt.Errorf("%q isn't a valid repo name.", e.Name) default: return err } }
c160557
ps.stream) return &PassphraseStream{ stream: arr, gen: ps.gen, } }
c160558
mctx.G().AddLogoutHook(ekLib, "ekLib") mctx.G().AddDbNukeHook(ekLib, "ekLib") mctx.G().PushShutdownHook(func() error { mctx.Debug("stopping background eklib loop") ekLib.Shutdown() return nil }) }
c160559
p.ID, RefNonce: p.RefNonce, } }
c160560
Type: t, Size: uint64(fi.Size()), // TODO: deal with negatives? Mtime: mtime, Ctime: mtime, // Leave TeamWriter and PrevRevisions empty } }
c160561
} for i, pr := range ei.PrevRevisions { otherPR := other.PrevRevisions[i] if pr.Revision != otherPR.Revision || pr.Count != otherPR.Count { return false } } return true }
c160562
+ strconv.FormatInt(int64(rev), 10)) }
c160563
10, 64) if err != nil { return kbfsmd.RevisionUninitialized, false } return kbfsmd.Revision(i), true }
c160564
} // Shouldn't be possible. return nil, errors.New("Invalid key bundle type") } return nil, nil }
c160565
} // Shouldn't be possible. return nil, errors.New("Invalid key bundle type") } return nil, nil }
c160566
TLFReaderKeyBundleV3) { k.cache.Add(bundleID, rkb) }
c160567
TLFWriterKeyBundleV3) { k.cache.Add(bundleID, wkb) }
c160568
if err != nil { return err } err = c.Decode(buf, dstPtr) if err != nil { return err } return nil }
c160569
c.Encode(obj) if err != nil { return err } return ioutil.WriteSerializedFile(path, buf, 0600) }
c160570
{ return nil } else if ioutil.IsNotExist(err) { // Continue. } else if err != nil { return err } return SerializeToFile(c, obj, path) }
c160571
If we miss the in-memory game storage, attempt to replay the game job := loadGameJob{ uid: uid, hostConvID: hostConvID, hostMsgID: hostMsgID, flipConvID: flipConvID, gameID: gameID, } select { case m.loadGameCh <- job: default: m.Debug(ctx, "LoadFlip: queue full: gameID: %s hostConvID %s f...
c160572
fmt string, args ...interface{}) { m.Debug(ctx, fmt, args...) }
c160573
return m.testingServerClock.Now(), nil } sres, err := m.ri().ServerNow(ctx) if err != nil { return res, err } return sres.Now.Time(), nil }
c160574
return err } outboxID, err := storage.NewOutboxID() if err != nil { return err } m.registerSentOutboxID(ctx, gameID, outboxID) return m.sendNonblock(ctx, convID, msg.String(), conv.Info.TlfName, outboxID, gameID, chat1.TopicType_DEV) }
c160575
if err := did.ToBytes(hdid); err != nil { return flip.UserDevice{} } return flip.UserDevice{ U: gregor1.UID(ad.UID().ToBytes()), D: gregor1.DeviceID(hdid), } }
c160576
it starts up. // We have to get the version from the installed plist. installedVersion, fivErr := fuseInstallVersion(log) if fivErr != nil { st.InstallStatus = keybase1.InstallStatus_ERROR st.InstallAction = keybase1.InstallAction_REINSTALL st.Status = keybase1.Status{Code: libkb.SCGeneric, Name: ...
c160577
} mode |= 0400 switch fi.ei.Type { case data.Dir: mode |= os.ModeDir | 0100 case data.Sym: mode |= os.ModeSymlink case data.Exec: mode |= 0100 } return mode }
c160578
{ return time.Unix(0, fi.ei.Mtime) }
c160579
case data.Dir: mode |= os.ModeDir | 0100 case data.Sym: mode |= os.ModeSymlink case data.Exec: mode |= 0100 } return mode }
c160580
time.Unix(0, fif.ei.Mtime) }
c160581
{ return context.WithValue(ctx, ctxFastModeKey{}, true) }
c160582
pprof.WriteHeapProfile(f) f.Close() } elapsedStr += " [memprof " + profName + "]" } if cpuProfFullPath != "" { pprof.StopCPUProfile() elapsedStr += " [cpuprof " + cpuProfFullPath + "]" } return elapsedStr }
c160583
look like we are // flushing the journal before plumbing.StatusIndexOffset is done. So // instead, print "done." only if it's not printed yet. if r.needPrintDone { elapsedStr := r.getElapsedStr(ctx, r.stageStartTime, r.stageMemProfName, r.stageCPUProfPath) r.errput.Write([]byte("done." + elapsedStr + "\n")) ...
c160584
firstStatus.UnflushedBytes) bytesFmt := "(%.2f%%) %s... " str := fmt.Sprintf( bytesFmt, float64(0), humanizeBytes(0, firstStatus.UnflushedBytes)) lastByteCount := len(str) if r.progress { r.errput.Write([]byte(str)) } ticker := time.NewTicker(1 * time.Second) defer ticker.Stop() for { select { case <...
c160585
if r.progress { // This function only runs if r.verbosity >= 1. eraseStr := strings.Repeat("\b", toErase) newStr := fmt.Sprintf( "%s... ", humanizeBytes(totalSoFar+bytes, 1)) toErase = len(newStr) r.errput.Write([]byte(eraseStr + newStr)) } } } return bytes, toErase, nil }
c160586
if err != nil { return err } chrootFrom, err := from.Chroot(fi.Name()) if err != nil { return err } chrootTo, err := to.Chroot(fi.Name()) if err != nil { return err } err = r.recursiveCopy(ctx, chrootFrom, chrootTo, sw) if err != nil { return err } } else { err := r...
c160587
r.log.CDebugf(ctx, "Error getting commit for hash %s (%s): %+v", string(hash[:]), refName, err) continue } // Iterate through the commits backward, until we experience any of the // following: // 1. Find a commit that the remote knows about, // 2. Reach our maximum number of commits to check, //...
c160588
val, isSet := f.f(); isSet { return (val != f.neg) } } return def }
c160589
string { return os.Getenv("KEYBASE_CHAT_MEMBER_TYPE") }, func() string { return "impteam" }, ) }
c160590
0x0 { buf = append(buf, alphabet[0]) } else { // Stop adding padding after the first nonzero byte. break } } reverseBuf(buf) return string(buf) }
c160591
character '%c' found at pos %d", c, i) return } tmp.Mul(place, big.NewInt(int64(charIndex))) res.Add(res, tmp) if i != len(buf)-1 { place.Mul(place, base) } } buf = res.Bytes() pad := bytes.Repeat([]byte{0}, padlen) outp = append(pad, buf...) return }
c160592
return &SaltpackEncrypt{ arg: arg, newKeyfinderHook: newKeyfinderHook, } }
c160593
limiter: rate.NewLimiter(rekeysPerSecond, numConcurrentRekeys), pendings: make(map[tlf.ID]bool), cancel: cancel, } if config.Mode().RekeyWorkers() > 0 { rkq.start(ctx) } return rkq }
c160594
defer rkq.mu.Unlock() delete(rkq.pendings, id) }(id) case err := <-ctx.Done(): rkq.log.Debug("Rekey queue background routine context done: %v", err) return } } }() }
c160595
the next // request to the server for more rekeys. rkq.log.Debug("Rekey queue is full; dropping %s", id) } }
c160596
defer rkq.mu.RUnlock() return rkq.pendings[id] }
c160597
defer rkq.mu.Unlock() if rkq.cancel != nil { rkq.cancel() rkq.cancel = nil } }
c160598
{ return &PaperKeySubmit{ Contextified: libkb.NewContextified(g), paperPhrase: paperPhrase, } }
c160599
ED25519SignatureInfo, err error) { err = c.Cli.Call(ctx, "keybase.1.crypto.signED25519ForKBFS", []interface{}{__arg}, &res) return }