/srv/irclogs.ubuntu.com/2021/06/11/#snappy.txt

* mwhudson has lunch instead of worrying about this00:00
mwhudson"Error while reading: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init - trying cache."01:10
jameshamurray: who usually reviews changes to the review-tools package? I filed https://code.launchpad.net/~jamesh/review-tools/+git/review-tools/+merge/403932 a few days ago, and it would be great to get some feedback.01:50
amurrayjamesh: myself and emi would normally review these - it's already on my todo-list, I hope to get to it today01:52
jameshamurray: the tests were a bit of a pain to update: many just assert on the number of warnings/errors, rather than what those warnings or errors are. That makes it difficult to tell exactly what they were trying to test.01:54
amurrayyeah I am still trying to get my head around all of that - but I am super glad jamie did such a great job of setting those all up and adding so many test cases already as it makes me more confident when making changes to review-tools that I won't suddenly change it's behaviour unexpectedly01:57
amurrayalso I think the output from the tests gets diffed against known-good values so that should check that the output itself matches what we expect in terms of warnings/errors01:57
jameshamurray: I suspect a lot of the logic could be simplified by running a schema validator (e.g. using the jsonschema package Snapcraft does) over the yaml before doing most of the checks01:58
jameshamurray: if you already know that certain properties exist or have particular types, the later checks can be a lot more concise01:58
amurrayhmm that is a great idea - thanks :)01:59
jameshamurray: I think the right option would be to do some initial normalisation of the yaml (mainly fixing up plugs/slots), then run the schema validation on the result, then run all the other checks if that passes.02:11
jamesha lot of the checks could probably be removed in favour of declarations in the schema too02:11
jamesh(there's obviously still going to be ones that need to be done in code though)02:12
amurrayjamesh: do we have an existing snap.yaml schema? I guess I could use the snapcraft one as a head start...02:20
jameshamurray: I don't think so.  The snapcraft one could be used as a start, but you'd probably want something looking a bit different02:22
jameshamurray: e.g. Snapcraft doesn't really care about interface properties, but review-tools does02:22
amurrayyeah plus there is all the build recipe etc info in snapcraft.yaml that doesn't end up in snap.yaml that we can ignore02:23
mborzeckimorning05:22
mardymborzecki: hi!05:28
mborzeckimardy: heya06:02
mardymborzecki: I'm trying to implement this suggestion: https://github.com/snapcore/snapd/pull/10266/files#r649324515 Do I understand it correctly, that the best practice is to immediately follow a Lock (or Unlock) invocation with a "defer Unlock (or Lock)"? 06:13
mborzeckilet me see06:13
mborzeckimardy: yes06:14
mardyeven when there are several of them in the same method, right?06:14
mborzeckisame usually goes for files, f, err := os.Open() followed by defer f.Close() in the err == nil path06:14
mardyI think it's a good practice to follow when there's just one operation to ve reverted, but in our case, when we have several Lock() and Unlock() invocations *on the same mutex*, this results in unnecessary locks being performed when we return from the function06:15
mardyI guess it's not a problem, but it appears suboptimal06:16
mborzeckimardy: hm that depends, though i agree it is more clear when there's just one operation, otherwise things get a little messy06:17
mborzeckimardy: there's some test code that locks and unlock the state lock a couple of times, if a panic appears in the unlocked section, and before that code there was lock && defer unlock, the tests will get stuck (or panic in teardown)06:18
mborzeckimardy: same for actual code, take a look at this fix that landed: https://github.com/snapcore/snapd/pull/1035706:19
mborzeckithere's a section where the state lock is selectively unlocked and then locked again, but at the beginning there's still the lock && defer unlock pattern06:20
mborzeckimardy: hm pedronis even mentioned that pattern here: https://github.com/snapcore/snapd/pull/10266/files#r64932594106:21
mardymborzecki: when does a go function return? Is it only when you call "return", or can it also exit its scope because of a runtime error ("exception", in C++ terms)?06:22
mborzeckimardy: in go that's a panic06:22
mborzeckimardy: this has some nice coverage: https://blog.golang.org/defer-panic-and-recover06:24
zyga-mbpo/06:25
mardythanks, this clarifies quite a bit. The last remaining question is whether in the tests we should clear up the lock states when the test fails in an Assert or Check. I guess we shouldn't.06:36
mborzeckimardy: what do you mean by clearing up the lock?06:40
mardyI guess the question is becoming philosophical, but let's consider https://github.com/snapcore/snapd/blob/master/overlord/servicestate/service_control_test.go#L457-L47206:40
mborzeckiglad i got the coffe ;) right in time for philisophical questions 06:41
mardyI see three options: 1) a defer Unlock() just after the first Lock() - 2) a defer Unlock after the *second* Lock() - 3) a direct call to Unlock() at the end06:41
mborzeckimardy: hmm that bit looks weird, i'd spect defet st.Unlock() in line 46006:41
mborzeckis/spect/expect/06:42
mardythat's in line with what Samuele and Ian suggested :-) It's not super clear to me why, though. I would probably add if after the second Lock, if it was just me06:43
mardyor maybe even do the Unlock explicitly, since this is a test and it must succeed. Anyway, I'll follow your advice and add it at the beginning :-)06:45
zyga-mbp mardy without looking at code, in tests I preferred to write code that panics in the error path rather than hang06:45
zyga-mbpmorning mvo06:46
mborzeckimardy: hm this is what i think the test should look like: https://play.golang.org/p/ifD-ulGXVJh06:46
mborzeckimvo: hey06:46
mardyzyga-mbp: yes, that's a given :-)06:47
zyga-mbpmborzecki yeah, looks right06:47
mardymborzecki: ok06:47
mborzeckimardy: you can try and fix it this way and see what happens, it shouldn't hang ;)06:48
mborzeckimardy: and that Assert() between unlock and lock would cause a panic if settle fails, making the test kind of useless06:48
mardymborzecki: they never hang, even now. Maybe because the state is getting destroyed, I dunno06:48
mborzeckimardy: ah right, there's no tear down, so the test just finishes and next one start with a clean slate again06:49
mardymborzecki: adding an EnsureUnlocked() method in the state, which calls Unlock only if the state is locked, could it make sense? Then people would always call it deferred, and could have as many Lock() and Unlock() calls in their method as they like06:52
mardy(for the matter in question your solution works, I'm just thinking in the general case now)06:53
mborzeckimardy: not sure there's a way to interrogate the mutex to check whether it's locked06:56
mvogood morning zyga, mborzecki and mardy 06:56
mborzeckimardy: unless you add auxiliary variable, or maybe it's already in the state.Lock()/Unlock()?06:57
mardymvo: hi!07:08
mardymborzecki: right, it looks like there isn't :-) Or maybe we could add a method like RunInLockedState(func()), that does { Lock(); defer Unlock(); func() } and then we can call this as many times as we want from inside the same method. But maybe I'm overdoing it...07:11
mborzeckimardy: i'd try to keep it simple ;)07:24
mborzeckimvo: can you take a look at https://github.com/snapcore/snapd/pull/10377 ?07:24
mvomborzecki: sure07:26
mborzeckithanks!07:26
zyga-mbphey pedronis 07:28
mardymborzecki: then this should be a quick one: https://github.com/snapcore/snapd/pull/1038307:35
pedronismborzecki: hi, I just noticed we have something called bootStateUpdate20.resealForModel, you might have to check whether it still makes sense as is07:43
pedroniswith the changes you need to make07:43
mborzeckipedronis: yeah, looked at it yesterday and we'll likely be able to simplify/drop it07:46
mborzeckipedronis: also as you mentione secboot takes SnapModel interface, now we have all the fields, so maybe we can provide some internal wrapper that uses modeenv as an input07:46
pedronismborzecki: yes, our secboot will need some tweaks07:48
pedronismborzecki: I re-reviewed https://github.com/snapcore/snapd/pull/10377, one comment there07:49
mborzeckipedronis: thanks07:49
mborzeckihmm i'm sill puzzled why people insist on using foobar2000 via wine on linux08:26
zyga-mbpmborzecki really beats the llamas ass?08:29
mborzeckihahah08:42
mborzeckididn't they resurrect winamp bw?08:42
zyga-mbpyeah I think they did 08:45
pedronismborzecki: I reviewed https://github.com/snapcore/snapd/pull/10361 , mostly comments about the tests09:11
mborzeckipedronis: thank you!09:12
pedronishttps://github.com/snapcore/snapd/pull/10372 needs 2nd review, it's test only but is a bit repetitive10:00
mborzeckimvo: can you land https://github.com/snapcore/snapd/pull/10377 ?10:57
mvomborzecki: sure, done11:03
mborzeckimvo: thanks!11:03
mardypedronis: can you please alaborate a bit more your on comment at https://github.com/snapcore/snapd/pull/10375? What is the "snap-id"?11:03
pedronismardy: each snap as a unique indentifier associated in the store with it, assertion for example whose that as primery key when they need to refer to snap11:05
pedronismardy: you can see it in snap info for example11:05
mortcontinuation of discussion in #ubuntu11:13
ogramort, so snap uploads are binary ... a snap is a gpg signed squashfs file ... (the gpg signing happens on the server, what you upload is just a squashfs, called .snap and using teh correct metadata structure)11:14
mardypedronis: OK. But how can snapd know that the snap is authorized to declare this user? Do we need to hardcode a list of snap ids (well, I guess it will be just one for now) into snapd?11:15
mortif I made a classic snap of rakudobrew, and inserted some code in a binary which checks the date, and if it's two months after the date I uploaded it, it does something nefarious (stealing bitcoin wallets, installing keyloggers, installing botnet client software, whatever)11:16
morthow would that be caught in manual review11:16
ografirst of al you could not just upload it 11:18
ograyou'd have to submit it for review in the forum and proof that it falls into the set of apps that get allowed classic at all 11:18
ograthen yu would need to be vetted as a publisher11:18
ograclassic has quite a lot of hurdles to overcome before you can evn upload11:19
zyga-mbphey ogra :)11:19
ogramort, https://forum.snapcraft.io/t/process-for-reviewing-classic-confinement-snaps/146011:19
mortI see, so I would need to be a relatively trusted snap "crafter" with a history of trustworthy snaps11:19
ograhey zyga-mbp 11:19
zyga-mbpmort or a well know upstream, perhaps11:19
zyga-mbpit's not a perfect system11:20
zyga-mbpit's mostly based on trust 11:20
ogramort, and your app must fall into the specific set of categories ... not every snap can become classic ... 11:20
ograonly if you can prove that strict can not work for your use case you get it granted11:20
mortogra: yeah, the hypothetical target here is rakudobrew which is a command-line app to install the raku language to your system11:20
ograloo at "supported" and "unsupported" on the above forum post11:20
ogra"3rd party installer snaps " 11:21
zyga-mbpseems like rustup11:21
pedronismardy: we have to untilt that list can be managed by the store some other way11:21
ograexplicitly unsupported11:21
zyga-mbpwell, except rustup is a classic snap11:22
mortogra: huh, why is rustup allowed then?11:22
zyga-mbpI recall the snapcraft summit when rustup was created11:22
zyga-mbpperhaps that's why?11:22
zyga-mbpbut it seems to be maintained 11:22
ograbecause it comes from a well known upstream i guess11:22
pedronisit says it is experimental, I don't know what process it went through11:23
zyga-mbppedronis it was made in montreal during the sprint with upstream being on site 11:23
mortit also says it's unofficial, which is the most interesting part because I would understand it if it was an official snap from the rust project11:24
zyga-mbpIIRC jdstrand was there but perhaps my memory is rusty11:24
pedronisbut is not owned by upstream, it seems to be owned by a single person11:24
zyga-mbpowner seems to lead the rustup working group11:25
* ogra notes that this single person wrote half of launchpad 😉11:25
zyga-mbpso semi official perhaps11:25
mortit's probably fine, but it just got me wondering when I tried to `apt install rustup`, apt recommended that I `snap install rustup`, and rustup is a classic confinement unofficial experimental snap11:25
zyga-mbpbut I only mentioned that because it seems relevant to this case11:25
mortfrom a random person I don't know11:25
ograyeah, rustup might be special given it comes from an ex canonical amployee we all trust ...11:25
ogra... it does not really fall under the classic specification though11:25
pedronisI'll have to dig because I think we should push a bit to have it owned by an actual upstream at least11:26
ogra👍11:26
pedronispstolowski: I made a remark in https://github.com/snapcore/snapd/pull/10385 I don't have time myself right now, but maybe you can start thinking about it11:31
pstolowskipedronis: thanks, i'm not sure i understand the concern, maybe we need to chat whenever you have a moment11:35
pedronispstolowski: let's say a snap holds another for 48h, at the end of that 48h hours this code might reset hold before we call the hook, now that snap can simply hold the snap again for 48h, because we lost firstHeld info, no?11:37
pedronisbasically I'm not sure we should do this in this form, but need to think more11:38
pstolowskipedronis: ah, because it also prunes based on time, not just refresh candidates, got it11:38
mardypedronis: do you think that it's something that the store can easily do, or should we hardcode the microk8s snap-id in snapd for the time being, to unblock them?11:50
pedronismardy: it needs a full design to do that in the store and time from them11:51
pedronispstolowski: https://github.com/snapcore/snapd/pull/10369 looks good but I'm confused by the tests11:51
zygao/11:55
zygaI've patched spread to have an export feature11:55
zygaspread -export "format" 11:55
zygaspread -list is equivalent to -export=list11:55
zygaI'll add two export formats as well: shellcheck-friendly bash script tree11:56
zygaand lava :)11:56
zygathis should help making sure shellcheck is clean without having to re-implement any spread logic in python11:56
zygaI'll happily share that when it's ready11:56
zygasuggestions and ideas welcome11:56
zygaCC: mborzecki ^ (since you maintained the checker)11:56
mardypedronis: then would you complain if we temporarily do the check in snapd?11:58
pedronismardy: I don't understand your question, isn't that what I proposed?11:59
pstolowskipedronis: yes it's slightly confusing, i'm making it more explicit. basically i'm not mocking time now so if undo wasn't implemented, last refresh would be set to real current time and fail12:01
pstolowskipedronis: updated12:08
pedronispstolowski: reviewed also https://github.com/snapcore/snapd/pull/1036212:10
mardypedronis: yes, but then here in the chat when I mentioned hardcoding I got the feeling you were insisting for this check to be done in the store only. Looks like I misunderstood, then. I'll implement the check in snapd :-)12:11
pstolowskipedronis: thanks!12:13
pstolowskiis check-rerefresh a good place to do something after refreshing all snaps during auto-refresh? (thinking about pruneGating there)12:17
pedronispstolowski: we need to chat a bit, is not super clear to me why we need pruneGating as is12:18
pedronispstolowski: I re-reviewed https://github.com/snapcore/snapd/pull/10369 , I think I was confused also because I didn't read the test name and expected it to be a different test, which is actually missing12:19
pedronispstolowski: won't https://github.com/snapcore/snapd/pull/10384 + a pruneGating that deals only with affecting and nothing time based, work ?12:21
pstolowskipedronis: you may be right, a snap is either eventually refreshed or disappears from candidates12:25
pstolowskimborzecki: maybe you could take a look at https://github.com/snapcore/snapd/pull/10358 ?12:35
mborzeckilooking12:45
mardyijohnson[m]: I see an Unlock() here, but I cannot find the corresponding Lock(): https://github.com/snapcore/snapd/blob/master/overlord/servicestate/quota_handlers.go#L18313:48
mardyit looks like this method assumes to be invoked with the state locked13:49
ijohnson[m]mardy yes that function assumes it is called with state locked 13:54
ijohnson[m]It should probably mention that in the doc-comment 13:54
ijohnson[m]cachio_: hey it seems we are running out of space on some of the workers, can you take a look? https://github.com/snapcore/snapd/runs/280299145014:28
cachio_ijohnson[m], I'll clean up14:29
cachio_thank14:29
ijohnson[m]thanks14:29
cachio_I'll need to add more disk soon14:29
pedronisjamesh: hi, I opened this https://github.com/snapcore/snapd/pull/10388 (something I mentioned before)14:32
cachio_ijohnson[m], I have a job to cleanup montly but I'll run it every 2 weeks14:32
ijohnson[m]cachio_: nice sounds good14:33
cachio_ijohnson[m], I see the problem, the cleanup is not reducing too much the free space14:35
cachio_I need to dig a bit more14:35
=== pedronis_ is now known as pedronis
pedronishttps://github.com/snapcore/snapd/pull/9292 needs 2nd reviews15:16
mvopedronis: looking15:40
pedronismvo: sorry I had to re-open https://github.com/snapcore/snapd/pull/10390  , it was actually broken because assertstate_test.go was confused the tool15:41
mvopedronis: oh, ok. sorry, I must have missed this15:41
pedronismvo: the test would not have passed, anyway now there are some manual changes in it15:42
pedronisassertstate_test.go was importing go-check in two different ways ??15:42
mvopedronis: woah, amazing that this even works15:43
mvopedronis: your changes still look fine fwiw15:43
pedronisthx15:43
mvothank *you*15:43
* cachio_ lunch15:48
ijohnson[m]mvo: I forgot to do it yesterday, but I just filed the refresh certificate bug that I talked about yesterday in the SU https://bugs.launchpad.net/snapd/+bug/193172415:48
ijohnson[m]mvo: pedronis: can one of you land https://github.com/snapcore/snapd/pull/10347? the only failure is debian interfaces-many15:49
pedronisijohnson[m]: done15:51
ijohnson[m]\o/ yay thank you15:51
pedronishttps://github.com/snapcore/snapd/pull/10390 is simple15:52
ijohnson[m]pedronis: +116:00
ijohnson[m]pedronis: oops forgot to squash merge that, oh well we don't need to cherry-pick it anyways was just hoping to simplify the git history16:02
pedronisour squash-merge label is hit and miss16:03
ijohnson[m]yeah, some teams use bots to do the actual merge to prevent this sort of situation, but then you need to give bots permissions16:03
pedronispartly is also that we need to force merge, that's why I prefer when possible if it's the submitter to merge, they should have the most context in theory16:05
pedronisbut given our flakiness that's also hard16:06
ijohnson[m]yeah submitters being able to merge is most ideal16:06
=== E_Eickmeyer is now known as Eickmeyer
* cachio_ afk18:47

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!