Skip to content

Commit 288a83c

Browse files
committed
feat: deprecate ipfs repo fsck command
This command is no longer necessary and is quite dangerous: 1. All lockfiles are now released by the OS when the daemon stops. 2. The API file is ignored when (a) the repo is initialized and (b) daemon is off. fixes #6435
1 parent e96416d commit 288a83c

File tree

2 files changed

+2
-227
lines changed

2 files changed

+2
-227
lines changed

core/commands/repo.go

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"io"
88
"os"
9-
"path/filepath"
109
"runtime"
1110
"strings"
1211
"sync"
@@ -20,7 +19,6 @@ import (
2019
cid "github.com/ipfs/go-cid"
2120
bstore "github.com/ipfs/go-ipfs-blockstore"
2221
cmds "github.com/ipfs/go-ipfs-cmds"
23-
config "github.com/ipfs/go-ipfs-config"
2422
)
2523

2624
type RepoVersion struct {
@@ -216,44 +214,11 @@ var repoFsckCmd = &cmds.Command{
216214
Helptext: cmds.HelpText{
217215
Tagline: "Remove repo lockfiles.",
218216
ShortDescription: `
219-
'ipfs repo fsck' is a plumbing command that will remove repo and level db
220-
lockfiles, as well as the api file. This command can only run when no ipfs
221-
daemons are running.
217+
'ipfs repo fsck' is now a no-op.
222218
`,
223219
},
224220
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
225-
configRoot, err := cmdenv.GetConfigRoot(env)
226-
if err != nil {
227-
return err
228-
}
229-
230-
dsPath, err := config.DataStorePath(configRoot)
231-
if err != nil {
232-
return err
233-
}
234-
235-
dsLockFile := filepath.Join(dsPath, "LOCK") // TODO: get this lockfile programmatically
236-
repoLockFile := filepath.Join(configRoot, fsrepo.LockFile)
237-
apiFile := filepath.Join(configRoot, "api") // TODO: get this programmatically
238-
239-
log.Infof("Removing repo lockfile: %s", repoLockFile)
240-
log.Infof("Removing datastore lockfile: %s", dsLockFile)
241-
log.Infof("Removing api file: %s", apiFile)
242-
243-
err = os.Remove(repoLockFile)
244-
if err != nil && !os.IsNotExist(err) {
245-
return err
246-
}
247-
err = os.Remove(dsLockFile)
248-
if err != nil && !os.IsNotExist(err) {
249-
return err
250-
}
251-
err = os.Remove(apiFile)
252-
if err != nil && !os.IsNotExist(err) {
253-
return err
254-
}
255-
256-
return cmds.EmitOnce(res, &MessageOutput{"Lockfiles have been removed.\n"})
221+
return cmds.EmitOnce(res, &MessageOutput{"`ipfs repo fsck` is deprecated and does nothing.\n"})
257222
},
258223
Type: MessageOutput{},
259224
Encoders: cmds.EncoderMap{

test/sharness/t0083-repo-fsck.sh

Lines changed: 0 additions & 190 deletions
This file was deleted.

0 commit comments

Comments
 (0)