Noticed a couple of oddities on Linux

I’ve been using commandbox for about a month and a half or so but had only been using mostly the coldbox namespace and hadn’t tried out some of the other cool commands.

After watching Brad’s awesome meetup yesterday I was playing around with some of the features he showed off and was getting all kinds of errors.

One of the things I tried first was using the REPL command. It would drop me into the scripting shell, but any command I typed would come back blank. I also tried installing the Chuck Norris package and while it would install ok, any time I tried running the “norris” command it would tell me it didn’t have a command called norris. There were other errors too when trying to run commands like “package show norris”. It would tell me it couldn’t find a function name getcwd() I believe it was.

I decided to try “sudo box” rather than just “box” and then tried installing the chuck norris package and everything worked great. the REPL command works too when I run box with sudo.

I’m just guessing, but it looks like without sudo, commandbox can’t write to certain folders which causes these errors.

I didn’t see it mentioned in the docs that you need to run it with sudo, so I’m not sure if that is a bug or if it was intended behavior. But I definitely could have missed it because I’ve only briefly glanced at the docs.

One other odd thing I noticed. If I run “box” without sudo the version number shows up as v1.0.0.00075 but if run it with sudo the version number is v1.0.0+00163

Just wanted to put this out there in case others have issues and also just to make Brad and Luis aware in the event that this was not the expected behavior.

Thanks again for bringing this tool to us. I’m looking forward to all the other great features it will offer.

Ben

Hi Ben, thanks for the feedback.

> getting all kinds of errors.

Errors are logged to a log file under /.CommandBox/logs which you can attach here for us to look at.

> any [REPL] command I typed would come back blank.

Can you give an example? Also, are you on the latest version of CommandBox? The REPL enhancements were submitted very recently. Run “upgrade --latest” or wipe out your .CommandBox folder and re-download a new executable.

> it didn’t have a command called norris.

Did you reload the shell after installing it? Run the “reload” command. I just fixed it so the reload happens automatically: COMMANDBOX-98

> There were other errors too when trying to run commands like “package show norris”.

I think you’re confused about what “package show” does. It’s used to read properties from your box.json file, not look at installed commands. The only way that would work is if you set a custom box.json value with “package set norris=cool” but I don’t think that’s what you were after.

> It would tell me it couldn’t find a function name getcwd() I believe it was.

Never seen that one. I’d need a stack trace from your logs to know what was going on.

> I decided to try “sudo box” rather than just “box” and then tried installing the chuck norris package and everything worked great.

That’s quite possibly just a coincidence because the shell had reloaded and picked up the new command.

> I’m just guessing, but it looks like without sudo, commandbox can’t write to certain folders which causes these errors.

Well commands do write files occasionally. Can you check the permissions on the files under the .CommandBox folder. If a permissions error was the culprit, I would expect there to be errors saying that though.

I’ve only done a small amount of testing, but in my experience with Ubuntu 12, I haven’t had to run it with sudo.

One other odd thing I noticed. If I run “box” without sudo the version number shows up as v1.0.0.00075 but if run it with sudo the version number is v1.0.0+00163

Now that’s definitely interesting. I think what’s happening is you have more than one box binary floating around your hard drive and you’re hitting different ones. Or at least, there’s probably two .CommandBox folders-- one for your user and one for the root user. The second version number is in the brand new format Luis just committed yesterday, but the first one is in the older format we used to be using. I would wipe out all your .CommandBox folders, pick a user and stick with it, download a fresh binary, and start clean. I think you have too many irons in the fire to keep track of what’s happening.

Thanks!

~Brad

Just re-reading this and noticing how old the build 00075 is. I wanted to add that if you just download the new binary and run it, it will NOT upgrade your installation. The binary has all the CF code packaged inside of it, but if it looks and sees the .CommandBox folder exists, it just uses what’s there. That’s why you have to use the “upgrade --latest” command to download just the new CF bits and install them, or wipe out your .CommandBox folder and re-run the binary which will trigger it to unzip everything fresh again.

We have some tickets in to improve this, but haven’t worked them yet.

https://ortussolutions.atlassian.net/browse/COMMANDBOX-70
https://ortussolutions.atlassian.net/browse/COMMANDBOX-99

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Thanks for the quick response Brad.

So it looks like by me doing some re-installations of commandbox that it did leave me with a version installed as the sudo user and a version as my normal user. I went ahead and uninstalled commandbox, blew away the ~/.CommandBox folder for both users and then did a clean install.

Once I did that and reloaded my shell everything was working as expected. I then did an upgrade --latest which pulled down version 1.0.0+00165 and tested installing a couple of packages and everything worked perfectly.

Thanks for pointing out that I may have had some rogue installations sitting around, I didn’t even think to check that.

Ben

Glad to hear it’s working. I had never even thought about having multiple installations before, but it makes sense when you think that each user has its own home directory.

Now I’m wondering if we should support some “all users” installation type. Not sure how you’d specify it though since the bootstrap would need to know where to look.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

The installation would have to prompt the user to ask I would think. I don’t know much about writing installers, but I know it can definitely be done.

The trick is, we don’t really have an “installer” per se. The binary just runs a quick check every time it’s runs to see if the user/.CommandBox folder exists and if it not it unpacks itself. So, we’d have to ask every time which wouldn’t been cool. Or we’d have to store the answer somewhere global.

I have considered an actual installer that could do things like add the binary to the system path, but the RPMs might actually do that already so it might not make sense.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com