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

config.replace is acting weird #2927

Closed
daviddias opened this issue Jul 1, 2016 · 6 comments
Closed

config.replace is acting weird #2927

daviddias opened this issue Jul 1, 2016 · 6 comments
Labels
kind/bug A bug in existing code (including security flaws) topic/api Topic api

Comments

@daviddias
Copy link
Member

daviddias commented Jul 1, 2016

Version/Platform/Processor information (from ipfs version --all):

go-ipfs version: 0.4.2-255c6f3
Repo version: 3
System version: amd64/darwin
Golang version: go1.6

Type: bug
Area: api, commands
Priority (from P0: functioning, to P4: operations on fire): P2

Description:

After executing a ipfs config replace, ipfs replaces the config but not to one that was defined and if a ipfs config show is executed after, the Content-Type of the response is text/plain instead of the expected application/json. This breaks js-ipfs-api config.replace feature.

This was detected on: https://github.com/ipfs/js-ipfs-api/pull/307/files#r69281789

How to reproduce using just the ipfs CLI

> ipfs config replace <some random json file, I used a package.json>
> cat ~/.ipfs/config
{
  "API": {
    "HTTPHeaders": null
  },
  "Addresses": {
    "API": "",
    "Gateway": "",
    "Swarm": null
  },
  "Bootstrap": null,
  "Datastore": {
    "GCPeriod": "",
    "NoSync": false,
    "Params": null,
    "Path": "",
    "StorageGCWatermark": 0,
    "StorageMax": "",
    "Type": ""
  },
  "Discovery": {
    "MDNS": {
      "Enabled": false,
      "Interval": 0
    }
  },
  "Gateway": {
    "HTTPHeaders": null,
    "PathPrefixes": null,
    "RootRedirect": "",
    "Writable": false
  },
  "Identity": {
    "PeerID": "",
    "PrivKey": ""
  },
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 0
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "",
    "IPNS": ""
  },
  "SupernodeRouting": {
    "Servers": null
  },
  "Swarm": {
    "AddrFilters": null
  },
  "Tour": {
    "Last": ""
  }
}
# Now you can open a tool like Wireshark to check the headers of the following response
> ipfs config show
# ... prints the config again, but the Content-Type was text/plain
@daviddias
Copy link
Member Author

Gonna bump the priority in this one to P4, because it is blocking me (Just spent almost an hour chasing a bug to learn that it was already a known issue :( )

@daviddias
Copy link
Member Author

@Kubuxu can you give an update here? I know you wrote a test, is this behaving properly now?

I also know that @whyrusleeping has mixed feelings about a 'replace' option, can I get a statement on https://github.com/ipfs/interface-ipfs-core/tree/master/API/config#configreplace and what your thoughts of what that call should do.

@Kubuxu
Copy link
Member

Kubuxu commented Aug 14, 2016

I also have mixed feelings about config replace, I don't know what is the proper way for it to behave. It behaves correctly according to current spec/description as far as I know.

@daviddias
Copy link
Member Author

Thank you, I did some more experiments and not seeing my issue on the latest master. Do note that replacing by a random .json file still makes the config get 'washed'.

@whyrusleeping
Copy link
Member

@diasdavid would you consider this issue resolved?

@daviddias
Copy link
Member Author

yes :)

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) topic/api Topic api
Projects
None yet
Development

No branches or pull requests

3 participants