On a fresh install bin/config complains about "non writable" json file that actually doesn't exist

IMPORTANT

  • Bug reports MUST include reproduction instructions which allow someone who does not have access to your environment to reproduce the issue you’re encountering.
  • Bug reports MUST be against a recent version of Phabricator, and include version information. You can find version information in “Config > Version Information” in the web UI, or arc version from the CLI.

Reproduction Instructions

  • I installed Phabricator following the instructions from here: https://secure.phabricator.com/book/phabricator/article/installation_guide/
    Since I already had the required versions of apache, php, mysql etc, I started from where it says “Now that you have all that stuff installed…”, that is, the three “git clone” commands.
    Then I configured the apache virtualhost as required.

  • I went to phabricator.mydomain.com and I got, as expected, the error page saying “unable to connect to MySQL”
    That’s completely expected as I hadn’t configured anything.

That very page instructs me to run these commands:
image

So I started with the first (from the right directory, of course).

And I got this error message:

Usage Exception: Local path “conf/local/local.json” is not writable. This file must be writable so that “bin/config” can store configuration.

Actually, it’s not true that that path was not writable. That file didn’t exist, and the directory conf/local was writable.

So I manually created an empty file conf/local/local.json and I got a different error message, one that actually made sense, complaining about the syntax of the local.json file (not valid json being it was completely empty). I fixed that by manually putting {} into the json file, and that fixed all errors.

Now:

  • the file should have existed in the first place. If it is required, then the installation should be contain an “empty” one (meaning containing an empty json object) out of the box
  • If it doesn’t exist, the script should create it.
  • If it actually attempted to create it and failed (which I can’t see how could possibly happen, given the parent directory had 755 permissions, owned by root, and I was running bin/config as root; also, after changing the directory permissions to 777 I got the same error) - but if that was the case, then the error should be more specific. “The path …/local.json is not writable” is not correct (or you could argue it’s technically correct, a path not being a file, but anyways it’s not specific enough). It should either say the file doesn’t exist (if the script is not willing to create it, which is stupid), or that it couldn’t be created (if that is the case)
  • given that you don’t provide the file out of the box and don’t automatically create it (or even if you did for that matter), if the json parsing fails because the file is completely empty (I mean only in this specific case, not if parsing fails for whatever other reason) you should be a little be more resilient and be capable of interpreting as an empty configuration exactly as if the content had been {}. I don’t honestly think this is expecting too much.

Phabricator/Arcanist Version

git-cloned a few minutes ago.

I can reproduce the issue on my system. Shouldn’t be hard to nail down. Thanks for the report!

1 Like

This was fixed in https://secure.phabricator.com/D20788.

1 Like