IRC logs for #farmOS, 2021-06-24 (GMT)

2021-06-23
2021-06-25
TimeNickMessage
[08:07:41]* MatrixTravelerbo has quit (Quit: Client limit exceeded: 15000)
[08:07:46]* calbasi[m] has quit (Quit: Client limit exceeded: 15000)
[10:57:47]<mstenta[m]>shane_aldrich: OK - I think maybe the tarball-based approach is not going to be your best bet... since you intend to use Composer for local testing
[10:57:48]<mstenta[m]>The other option (which is actually what the Docker image does internally) is to use `composer create-project farmos/project`
[10:57:48]<mstenta[m]>So... you would start with a completely empty webroot directory and run that command in it (i think ... or maybe it's in the directory above it, i forget)
[10:57:48]<mstenta[m]>What that will do is download the "starter template" `composer.json` file from https://github.com/farmOS/composer-project and then run `composer install` on it
[10:57:49]<mstenta[m]>if you add the `--dev` flag to `composer create-project` then it will install all the dev dependencies too (including `drupal/coder`)
[10:57:55]<mstenta[m]>so: `composer create-project --dev farmos/project`
[10:57:55]<mstenta[m]>try running that in a different directory first... just to see if it works
[10:57:56]<mstenta[m]>the end result should be a completely up-to-date installation of the `2.x` branch of farmOS (not the `2.0.0-alpha2` release)
[10:57:56]<mstenta[m]>of course, the big consideration here is that you are then working with a "bleeding edge" installation... and it will very likely break (in different ways) if/when you run `composer update` in the future
[10:57:56]<mstenta[m]>so i would recommend getting in the habit of "starting fresh" each time you want to update - rebuilding the codebase and reinstalling farmOS from scratch
[10:57:56]<mstenta[m]>that's the easiest way to do it, without following closely all the changes that are happening in development and manually updating as you go along (which is what paul121 and I are doing basically)
[10:57:56]<mstenta[m]>so.... i don't know if that will be any easier for you... but you are playing with alpha software so... 🤷😄
[10:58:06]<mstenta[m]>it *will* probably resolve the issue you're hitting with the outdated `state_machine` module... and will provide you with the dev dependencies like `drupal/coder`... so you shouldn't need to run any `composer install/update/require` commands... but if you do then there is still a chance things will break
[12:18:16]<shane_aldrich[m]>Sounds good! I did extract and rewrite the files again after the error and things are back up and running. I'll copy this information into a text file for future reference. Since I have a separate webroot directory for Drupal already set up for nginx, I'll use that for testing this out moving forward. Once I get the hang of it, I'll use my `shane-farmos.edu` webroot from there.
[14:08:19]<shane_aldrich[m]>I finally have a working version of `phpcs.xml` in PhpStorm. So I ran "Inspect Code" on `Materials.php` with the resulting error: `phpcs: PHP Fatal error: Uncaught Error: Class 'VariableAnalysis\Sniffs\CodeAnalysis\VariableAnalysisSniff' not found in /var/www/shane-farmos.edu/vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/CodeAnalysis/VariableAnalysisSniff.php:24` Since this is my first time running `phpcs`, I need some help
[14:08:19]<shane_aldrich[m]>here to help me make sense of the error.
[14:09:01]<mstenta[m]>Hmm that sounds like the `coder` module has a dependency that's missing
[14:09:09]<mstenta[m]>how did you install coder?
[14:10:06]<shane_aldrich[m]>`composer require drupal/coder` after I extracted the alpha file again yesterday.
[14:10:18]<shane_aldrich[m]>That was run from my webroot directory
[14:11:44]<mstenta[m]>hmm... looks like it's part of https://github.com/sirbrillig/phpcs-variable-analysis
[14:11:55]<mstenta[m]>which must be an upstream dependency of.... something.... i'm not sure why it isn't installed for you
[14:12:04]<mstenta[m]>but it's a clue that other things probably aren't installed too
[14:12:15]<mstenta[m]>can you try something for me?
[14:12:24]<shane_aldrich[m]>Sure
[14:12:39]<mstenta[m]>create a completely separate directory somewhere and run `composer create-project --dev farmos/project`
[14:13:06]<mstenta[m]>then look in `vendor` to see if there's a `sirbrillig/phpcs-variable-analysis` directory
[14:13:20]<shane_aldrich[m]>Anywhere in `/var/www`?
[14:13:35]<mstenta[m]>or outside of that... maybe `/var/test` or something
[14:13:48]<mstenta[m]>doesn't matter... all this will do is build the farmOS codebase with dev dependencies
[14:15:22]<shane_aldrich[m]>will do.
[14:15:31]<shane_aldrich[m]>`Could not find package farmos/project with stability stable.`
[14:16:46]<mstenta[m]>oh hmm try `composer create-project --dev --stability=dev farmos/project`
[14:17:51]<mstenta[m]>or alternatively, just download this `composer.json` file and run `composer install`: https://raw.githubusercontent.com/farmOS/composer-project/2.x/composer.json
[14:17:57]<mstenta[m]>(same result)
[14:18:43]<shane_aldrich[m]>It's running now. It didn't at first because I forgot to `chown` the directory
[14:19:38]<mstenta[m]>fwiw this is basically what the Docker image does when it is being built
[14:19:45]<shane_aldrich[m]>Is this a good way for me to "start over" when I need to?
[14:20:03]<mstenta[m]>yea i think so... depending on what you're doing i guess
[14:20:19]<mstenta[m]>and this will be the most up-to-date codebase always
[14:20:28]<mstenta[m]>(which can be good/bad, depending on what you want)
[14:20:57]<shane_aldrich[m]>`sirbrillig` is there
[14:21:23]<shane_aldrich[m]>Would this delete `/sites/all`?
[14:22:18]<mstenta[m]>so... i don't think you'd be able to run this on an existing directory - i think it needs to be empty
[14:22:41]<mstenta[m]>but you could move your `sites` dir (and note that you want the WHOLE `sites` dir... not just`sites/all`), and then use this, then move it back
[14:22:58]<mstenta[m]>(this is the recommended update procedure in general btw)
[14:23:06]<mstenta[m]>(replace all but `sites`)
[14:23:12]<shane_aldrich[m]>That's easy enough. I can just keep a copy of `sites/all` in my home directory and copy it over afterwards.
[14:23:34]<mstenta[m]>yep! (but again: `sites`... not just `sites/all`)
[14:23:55]<mstenta[m]>oh now... this will also wipe out your phpcs.xml file
[14:24:17]<mstenta[m]>so you would want to save that too
[14:24:42]<shane_aldrich[m]><mstenta[m] "yep! (but again: `sites`... not "> so I would be keeping a copy of `default` and all files as well?
[14:25:25]<mstenta[m]>ah well good question actually... if you want to keep your installed site then YES!
[14:25:32]<mstenta[m]>but if you are reinstalling from scratch, then no
[14:25:47]<mstenta[m]>`sites/default/settings.php` is where your database credentials get saved
[14:26:01]<mstenta[m]>so if you wipe that out, you can't connect to the database anymore
[14:26:12]<mstenta[m]>(which is fine if you're reinstalling from scratch)
[14:27:16]<shane_aldrich[m]>Back to my `phpcs` error. For now can I install the `sirbrillig` dependency via `composer`? If so, what's the proper way?
[14:27:44]<shane_aldrich[m]>NM
[14:27:55]<shane_aldrich[m]>I should just look at the link you sent. DOH!
[14:33:00]<mstenta[m]>ah well... how about you just replace your old code with the one you just built?
[14:33:36]<mstenta[m]>copy your `/var/www/web/sites` directory to `/var/test/web/sites` (or wherever it is)... then wipe out `/var/www` and `mv /var/test /var/www`
[14:33:36]<mstenta[m]>?
[14:33:53]<mstenta[m]>then you'll have `sirbrillig` AND everything else that you might be missing
[14:34:49]<shane_aldrich[m]>Sounds good. Need to take a quick break. I'll report back when I get that accomplished. This is actually really fun!
[14:47:26]<shane_aldrich[m]>About to move the sites directory. Would this be the proper way: `sudo mv -f /var/www/shane-farmos.edu/web/sites /var/test/project/web/sites`?
[14:47:59]<mstenta[m]>I would `rm -r /var/test/project/web/sites first`
[14:48:09]<mstenta[m]> * I would `rm -r /var/test/project/web/sites` first
[14:48:27]<shane_aldrich[m]>OK. That way I don't have to use `-f`
[14:48:31]<mstenta[m]>yup!
[15:09:08]<shane_aldrich[m]>Site still works as expected. But `phpcs` error is still there. It has to be something in PhpStorm. Probably a mapping issue. I'll look into it further after I work on my new sourdough starter (last one bit the dust).
[15:10:37]<mstenta[m]>huh - yea maybe it's PHPStorm?
[15:10:57]<mstenta[m]>try this (when you're back): `vendor/bin/phpcs web/profiles/farm`
[15:11:17]<mstenta[m]>(executed from your `/var/www/shane-farmos.edu` directory)
[15:11:33]<mstenta[m]>that will execute `phpcs` from the command line... taking PHPStorm out of the picture completely
[15:11:45]<mstenta[m]>curious if you get the same error in there... if so, then it's not a PHPStorm issue
[16:14:55]<shane_aldrich[m]>That ended up with a ton of errors. Too many to scroll through. I'm going to try it on my Materials module directory now.
[16:15:20]<mstenta[m]>oh no
[16:15:33]<mstenta[m]>:-(
[16:15:47]<mstenta[m]>oh... but do you have the `phpcs.xml` file in `/var/www/shane-farmos.edu`?
[16:16:08]<mstenta[m]>that's necessary to tell `phpcs` which rulesets to follow
[16:16:17]<mstenta[m]>so maybe it was using defaults if that wasn't present?
[16:16:23]<shane_aldrich[m]>I do have it there.
[16:16:30]<mstenta[m]>oh hm
[16:16:54]<mstenta[m]>OH! there's another step i think...
[16:17:50]<mstenta[m]>try running this: `vendor/bin/phpcs --config-set installed_paths /var/www/shane-farmos.edu/vendor/drupal/coder/coder_sniffer`
[16:18:21]<mstenta[m]>(if you hadn't done that a while ago... i pasted it the other day i think)
[16:18:31]<mstenta[m]>that tells `phpcs` where the `drupal/coder` rulesets can be located
[16:18:40]<mstenta[m]>so maybe the errors were due to that
[16:19:23]<mstenta[m]>(that's my last idea haha)
[16:20:26]<shane_aldrich[m]>I just ran that. Then ran `phpcs` on my `Materials.php` file and got this: ` 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
[16:20:26]<shane_aldrich[m]> | | "\r\n"`
[16:20:41]<mstenta[m]>ah ha! i think that's progress!
[16:20:57]<mstenta[m]>try running it on `web/profiles/farm` again... curious if that works
[16:21:49]<shane_aldrich[m]>I do too!
[16:21:50]<mstenta[m]>that `"\r\n"` thing is because you edited the file with Windows I bet
[16:21:51]<mstenta[m]>https://softwareengineering.stackexchange.com/questions/29075/difference...
[16:22:33]<mstenta[m]>here's how to fix i think: https://stackoverflow.com/questions/40470895/phpstorm-saving-with-linux-...
[16:23:29]<shane_aldrich[m]>So all "errors" on that run are the same. None of those have been edited in Windows. Those all reside on my Ubuntu 20.04 wsl2.
[16:23:41]<mstenta[m]>can you paste one of the errors?
[16:23:59]<mstenta[m]>oh you mean they are all the same `\r\n` error?
[16:24:04]<shane_aldrich[m]>Yup
[16:24:20]<mstenta[m]>ah ok! so somehow those got changed
[16:24:24]<mstenta[m]>here try this...
[16:24:41]<shane_aldrich[m]>There's a ton of files. So scrolling through my terminal window is a long process. ;)
[16:24:44]<mstenta[m]>cd web/profiles/farm
[16:24:45]<mstenta[m]>git status
[16:24:53]<mstenta[m]>does that show that files are overridden?
[16:25:38]<shane_aldrich[m]>`HEAD detached at ddff8205
[16:25:38]<shane_aldrich[m]>nothing to commit, working tree clean`
[16:25:41]<mstenta[m]>hmm strange
[16:25:53]<mstenta[m]>shane_aldrich: do you have interest in a quick Zoom to look at it together?
[16:25:55]<mstenta[m]>i'm around for a few mins
[16:26:41]<mstenta[m]>(no pressure - just if it's easy)
[16:26:41]<shane_aldrich[m]>Here is the last line after doing the composer command to build the project: `Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? y`
[16:27:32]<shane_aldrich[m]>Maybe that did it? I can probably do a quick zoom in about 15 minutes. Girlfriend is doing laundry right next to me and it's noisy. 😜
[16:29:06]<mstenta[m]>hmm not sure
[16:29:43]<mstenta[m]>the fact that you were able to run `git status` in `web/profiles/farm` and see `ddff8205` means you have a `.git` directory there and it's up to date (that's the latest commit)
[16:30:11]<mstenta[m]>it's strange that `phpcs` is telling you that there are `\n\r` occurrences in `web/profiles/farm` though
[16:30:34]<shane_aldrich[m]>Weird that files that haven't been touched in windows would have that. Hmmm
[16:32:16]<mstenta[m]>yea... but also weird that `git status` doesn't show any files as changed... those two things are contradictory
[16:32:33]<mstenta[m]>so i'm not sure i trust the `phpcs` output...
[16:33:06]<mstenta[m]>can you copy and paste the last error from that `phpcs` run?
[16:33:38]<shane_aldrich[m]>`FOUND 1 ERROR AFFECTING 1 LINE
[16:33:39]<shane_aldrich[m]>--------------------------------------------------------------------------------
[16:33:39]<shane_aldrich[m]> 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
[16:33:39]<shane_aldrich[m]> | | "\r\n"`
[16:34:24]<mstenta[m]>that's from `web/profiles/farm` ? or the material module?
[16:34:52]<shane_aldrich[m]>`web/profiles/farm`
[16:35:00]<mstenta[m]>ok does it tell you what file that is for?
[16:35:10]<mstenta[m]>(should)
[16:35:32]<shane_aldrich[m]>`modules/log/lab_test/farm_lab_test.module`
[16:35:55]<mstenta[m]>so strange
[16:36:49]<shane_aldrich[m]>indeed. I could understand if it was only on my module.
[16:37:31]<mstenta[m]>yea... so here's my new theory (bear with me haha):
[16:38:10]<mstenta[m]>maybe git doesn't actually detect changes to line endings. so maybe the line endings were changed (somehow) but those changes are not showing up in `git status`.
[16:38:20]<mstenta[m]>but `phpcs` does
[16:38:38]<shane_aldrich[m]>Maybe it's the `phpcs.xml` file I edited.
[16:38:41]<mstenta[m]>now... those line endings are DEFINITELY not wrong in the upstream farmOS, otherwise we would see those same `phpcs` errors in our automated tests
[16:39:10]<mstenta[m]>> maybe git doesn't actually detect changes to line endings
[16:39:10]<mstenta[m]>this whole theory hinges on this ^ - which we can probably find out if that's true or not...
[16:39:44]<shane_aldrich[m]>Let's do some testing
[16:39:57]<mstenta[m]>well so... let's focus on material module for a moment...
[16:40:12]<mstenta[m]>open PHPStorm, and the first thing to do is make sure it's configured to use Linux line endings
[16:40:21]<mstenta[m]>> here's how to fix i think: https://stackoverflow.com/questions/40470895/phpstorm-saving-with-linux-...
[16:41:03]<mstenta[m]>then open the material module file that had the `phpcs` error and Ctrl+s (save it) ... this *should* change the line ending automatically... then rerun `phpcs` on that directory
[16:41:05]<shane_aldrich[m]>Looking at that now. But it's a bit dated. Give me a couple minutes.
[16:43:09]<shane_aldrich[m]>So I changed `Materials.php` to use `LF` from the bottom bar in PhpStorm, saved the file, ran `phpcs`. No error.
[16:43:20]<shane_aldrich[m]>Which still doesn't explain all of the other files.
[16:44:44]<mstenta[m]>ok!
[16:44:47]<mstenta[m]>that's great!
[16:45:04]<shane_aldrich[m]>Progress!
[16:45:13]<mstenta[m]>yea... so i'm not sure how all the farmOS files changed either... but that's not a big deal until you're working in the farmOS codebase itself...
[16:45:51]<mstenta[m]>oh this might be relevent: https://stackoverflow.com/questions/20496084/git-status-ignore-line-endi...
[16:46:07]<shane_aldrich[m]>I agree. I'll get my modules to switch over to `LF` and run some tests.
[16:46:52]<mstenta[m]>gotta run! ttyl
[16:55:30]<shane_aldrich[m]>FYI
[16:55:40]<shane_aldrich[m]>ACTION uploaded an image: (119KiB) < https://libera.ems.host/_matrix/media/r0/download/matrix.org/FcATZFtoXRn... >
[16:56:16]<shane_aldrich[m]>From PhpStorm using "Inspect Code". More progress!
[18:19:12]* med65[m] has quit (*.net *.split)
[18:19:12]* wgardiner[m] has quit (*.net *.split)
[18:19:12]* skipper_is[m] has quit (*.net *.split)
[18:19:12]* symbioquine[m] has quit (*.net *.split)
[18:19:12]* JSimonGoodall[m] has quit (*.net *.split)
[18:19:12]* HarishankarEthir has quit (*.net *.split)
[18:19:12]* GerardoLisboa[m] has quit (*.net *.split)
[18:19:12]* cw28cycles[m] has quit (*.net *.split)
[18:19:14]* farmtech[m] has quit (*.net *.split)
[18:19:16]* kta[m] has quit (*.net *.split)
[18:19:16]* JulianF[m] has quit (*.net *.split)
[18:19:16]* NausiyanNyancurr has quit (*.net *.split)
[18:19:17]* irissc[m] has quit (*.net *.split)
[18:19:18]* kunigunde[m] has quit (*.net *.split)
[18:19:20]* NicholasPetrakak has quit (*.net *.split)
[18:19:20]* wirelessrpm[m] has quit (*.net *.split)
[18:19:20]* mstenta[m] has quit (*.net *.split)
[18:19:20]* paul121[m] has quit (*.net *.split)
[18:19:20]* ssoyrnoz[m] has quit (*.net *.split)
[18:19:20]* shane_aldrich[m] has quit (*.net *.split)
[18:19:20]* jgaehring[m] has quit (*.net *.split)
[18:19:20]* manikandanmanive has quit (*.net *.split)
[18:19:20]* IrfanAinuddin[m] has quit (*.net *.split)
[18:19:20]* jpeg[m] has quit (*.net *.split)
[18:19:21]* artu[m] has quit (*.net *.split)
[18:21:32]* artu[m] has joined #farmos
[18:21:32]* JSimonGoodall[m] has joined #farmos
[18:21:32]* HarishankarEthir has joined #farmos
[18:21:32]* GerardoLisboa[m] has joined #farmos
[18:21:32]* cw28cycles[m] has joined #farmos
[18:21:32]* med65[m] has joined #farmos
[18:21:32]* wgardiner[m] has joined #farmos
[18:21:32]* skipper_is[m] has joined #farmos
[18:21:32]* symbioquine[m] has joined #farmos
[18:21:32]* farmtech[m] has joined #farmos
[18:22:33]* irissc[m] has joined #farmos
[18:23:26]* cw28cycles[m] has quit (Ping timeout: 240 seconds)
[18:23:30]* NausiyanNyancurr has joined #farmos
[18:23:30]* kta[m] has joined #farmos
[18:23:30]* JulianF[m] has joined #farmos
[18:23:32]* artu[m] has quit (Ping timeout: 252 seconds)
[18:23:36]* shane_aldrich[m] has joined #farmos
[18:23:36]* ssoyrnoz[m] has joined #farmos
[18:23:36]* paul121[m] has joined #farmos
[18:23:36]* mstenta[m] has joined #farmos
[18:23:36]* wirelessrpm[m] has joined #farmos
[18:23:36]* NicholasPetrakak has joined #farmos
[18:23:36]* jpeg[m] has joined #farmos
[18:23:36]* IrfanAinuddin[m] has joined #farmos
[18:23:36]* manikandanmanive has joined #farmos
[18:23:36]* jgaehring[m] has joined #farmos
[18:23:38]* kunigunde[m] has joined #farmos
[18:27:30]* med65[m] has quit (Ping timeout: 240 seconds)
[18:27:30]* wgardiner[m] has quit (Ping timeout: 240 seconds)
[18:27:30]* skipper_is[m] has quit (Ping timeout: 240 seconds)
[18:27:30]* symbioquine[m] has quit (Ping timeout: 240 seconds)
[18:27:30]* JSimonGoodall[m] has quit (Ping timeout: 240 seconds)
[18:27:30]* HarishankarEthir has quit (Ping timeout: 240 seconds)
[18:27:30]* GerardoLisboa[m] has quit (Ping timeout: 240 seconds)
[18:27:34]* farmtech[m] has quit (Ping timeout: 244 seconds)
[18:27:53]* NicholasPetrakak has quit (Ping timeout: 244 seconds)
[18:27:53]* wirelessrpm[m] has quit (Ping timeout: 244 seconds)
[18:27:53]* mstenta[m] has quit (Ping timeout: 244 seconds)
[18:27:53]* ssoyrnoz[m] has quit (Ping timeout: 244 seconds)
[18:27:53]* jgaehring[m] has quit (Ping timeout: 244 seconds)
[18:27:53]* manikandanmanive has quit (Ping timeout: 244 seconds)
[18:27:53]* IrfanAinuddin[m] has quit (Ping timeout: 244 seconds)
[18:27:53]* jpeg[m] has quit (Ping timeout: 244 seconds)
[18:28:03]* kunigunde[m] has quit (Ping timeout: 272 seconds)
[18:28:20]* irissc[m] has quit (Ping timeout: 268 seconds)
[18:28:25]* kta[m] has quit (Ping timeout: 272 seconds)
[18:28:25]* JulianF[m] has quit (Ping timeout: 272 seconds)
[18:28:25]* NausiyanNyancurr has quit (Ping timeout: 272 seconds)