Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipfswatch doesn't fail nicely when a broken link is found #10017

Open
3 tasks done
stkw0 opened this issue Jul 13, 2023 · 0 comments
Open
3 tasks done

ipfswatch doesn't fail nicely when a broken link is found #10017

stkw0 opened this issue Jul 13, 2023 · 0 comments
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization

Comments

@stkw0
Copy link

stkw0 commented Jul 13, 2023

Checklist

Installation method

built from source

Version

Kubo version: 0.21.0
Repo version: 14
System version: amd64/linux
Golang version: go1.20.5

Config

{
  "API": {
    "HTTPHeaders": {}
  },
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Announce": [],
    "AppendAnnounce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/8080",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001",
      "/ip4/0.0.0.0/udp/4001/quic",
      "/ip4/0.0.0.0/udp/4001/quic-v1",
      "/ip4/0.0.0.0/udp/4001/quic-v1/webtransport",
      "/ip6/::/udp/4001/quic",
      "/ip6/::/udp/4001/quic-v1",
      "/ip6/::/udp/4001/quic-v1/webtransport"
    ]
  },
  "AutoNAT": {},
  "Bootstrap": [
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
    "/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
  ],
  "DNS": {
    "Resolvers": {}
  },
  "Datastore": {
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": true
    }
  },
  "Experimental": {
    "AcceleratedDHTClient": false,
    "FilestoreEnabled": false,
    "GraphsyncEnabled": false,
    "Libp2pStreamMounting": false,
    "OptimisticProvide": false,
    "OptimisticProvideJobsPoolSize": 0,
    "P2pHttpProxy": false,
    "StrategicProviding": false,
    "UrlstoreEnabled": false
  },
  "Gateway": {
    "APICommands": [],
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "X-Requested-With",
        "Range",
        "User-Agent"
      ],
      "Access-Control-Allow-Methods": [
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    },
    "NoDNSLink": false,
    "NoFetch": false,
    "PathPrefixes": [],
    "PublicGateways": null,
    "RootRedirect": ""
  },
  "Identity": {
    "PeerID": "12D3KooWGxkgeytLT2tb5A2EmbZuXsmbE2PgnSPYv8R38dicUTV2"
  },
  "Internal": {},
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Migration": {
    "DownloadSources": [],
    "Keep": ""
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },
  "Peering": {
    "Peers": null
  },
  "Pinning": {
    "RemoteServices": {}
  },
  "Plugins": {
    "Plugins": null
  },
  "Provider": {
    "Strategy": ""
  },
  "Pubsub": {
    "DisableSigning": false,
    "Router": ""
  },
  "Reprovider": {},
  "Routing": {
    "Methods": null,
    "Routers": null
  },
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {},
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "RelayClient": {},
    "RelayService": {},
    "ResourceMgr": {
      "Limits": {}
    },
    "Transports": {
      "Multiplexers": {},
      "Network": {},
      "Security": {}
    }
  }
}

Description

Running ipfswatch breaks when a broken link is found instead of failing nicely. The error message is the next:

2023/07/13 15:19:03 running IPFSWatch on '.' using repo at '/home/stkw0/.ipfs'...
2023/07/13 15:19:03 .
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x558041f36fa8]

goroutine 1 [running]:
main.IsDirectory({0xc000638230?, 0xc00061e858?})
/var/tmp/portage/net-p2p/kubo-0.21.0/work/cmd/ipfswatch/main.go:202 +0x28
main.addTree.func1({0xc000638230, 0xb}, {0xc00061e820?, 0x0?}, {0x0?, 0x0?})
/var/tmp/portage/net-p2p/kubo-0.21.0/work/cmd/ipfswatch/main.go:178 +0x7a
path/filepath.walk({0xc000638230, 0xb}, {0x558042954038, 0xc00061e820}, 0xc000929c18)
/usr/lib/go/src/path/filepath/path.go:480 +0x116
path/filepath.walk({0x558042443350, 0x1}, {0x558042954038, 0xc00061e4e0}, 0xc000929c18)
/usr/lib/go/src/path/filepath/path.go:504 +0x26f
path/filepath.Walk({0x558042443350, 0x1}, 0xc000929c18)
/usr/lib/go/src/path/filepath/path.go:571 +0x6c
main.addTree(0xc0001be5d0?, {0x558042443350?, 0xc000929e40?})
/var/tmp/portage/net-p2p/kubo-0.21.0/work/cmd/ipfswatch/main.go:173 +0x45
main.run({0xc0001be5d0, 0x12}, {0x558042443350, 0x1})
/var/tmp/portage/net-p2p/kubo-0.21.0/work/cmd/ipfswatch/main.go:69 +0x1dc
main.main()
/var/tmp/portage/net-p2p/kubo-0.21.0/work/cmd/ipfswatch/main.go:49 +0xd5

To reproduce this create a broken link (ln -s non_existing_path broken_link) and then run ipfswatch.

@stkw0 stkw0 added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Jul 13, 2023
@stkw0 stkw0 changed the title ipfswatch doesn't fails nicely when a broken link is found ipfswatch doesn't fail nicely when a broken link is found Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

1 participant