#dev-contrib

1 messages Β· Page 41 of 1

gusty sonnet
#

I can commit it, does it not show up for you?

tawdry vapor
#

It does

#

but when I clicked it, said I am not allowed (I was trying to batch them together for what it's worth)

gusty sonnet
#

Hmm, let me try I guess

#

Oh

#

It says batching must be done from file tab

tawdry vapor
#

Yeah I was doing that

gusty sonnet
#

Hmm

#

Let me try then

tawdry vapor
#

Just make the commit message nicer than the default :^)

gusty sonnet
#

What do you want to put as commit message?

tawdry vapor
#

The fix KeyError blahblahblah I wrote

gusty sonnet
#

Very interesting haha

#

Did you get the same message?

tawdry vapor
#

Yes

#

I pushed some commits yesterday so either my permissions were revoked or GitHub has an issue (I have not tried pushing via command line git now because I have nothing else to push)

long garnet
#

@tawdry vapor I failed logging 101

#

could you give me a brief explanation to know when to use which? it's not totally obvious to me :c

tawdry vapor
long garnet
#

thanks

tawdry vapor
#

the debug vs info one can be a bit ambiguous but just think about in what situations it'd be helpful for you to see the message

long garnet
#

by the way, I think there's another bug in some of the moderator modules (which is present in the upstream)

#

iirc the functions that send a DM to the user don't check if the user argument is an actual discord.User/Member

#

so if it's a discord.Object it fails to send the message

#

kinda minor bug because the bot can't send messages if they don't share the server I think (might be wrong of this), but regardless, the exception breaks the function and the "<x> applied to whatever" doesn't show up

#

I should prolly check it, I might be wrong

tawdry vapor
#

Yeah I already commented about that in the review

#

It's not really how you describe it though

#

You are right it doesn't check the type. However, the parameters are correctly annotated - they don't specify that a discord.Object is allowed

#

But there's no place where something other than a user or member is given as far as I can see

#

Regarding the can't share server thing, I don't know, but the function should catch those exceptions so it's fine.

long garnet
#

ah, I meant it in a way that the banned user wouldn't know even if it didn't fail

#
async def send_private_embed(user: UserTypes, embed: discord.Embed) -> bool:
# ...
    await user.send(embed=embed)```
#

(no .send method in discord.Object)

tawdry vapor
#

Yeah I understand

#

But it will never fail in practice

#

Yes, there are no actual safeguards against it

#

But nothing is currently broken as far as I can tell regarding that

#

IMO it should just raise the exception because a discord.Object should never be given to that function anyway, and that is made clear by the function annotations

long garnet
#

I'll leave it then

tawdry vapor
#

You could catch the attributeerror and use log.exception

#

Sorry, it doesn't actually need to raise it. I said that cause I was interested in the traceback, and that can just be logged without raising it

#

If you want you can add it. I think it's OK either way

long garnet
#

nvm I just now understand what you said

long garnet
#

I am unclear in which case it would raise an error, since that's making it a proper user... you mean I should catch possible exceptions if that fetch fails?

tawdry vapor
#

Yeah that is what I meant, sorry

#

Just catch the exception is OK

#

When I wrote that I was thinking it would fail again but maybe the fetch will work even though it failed in the converter.

long garnet
#

depends

#

if the fetching in FetchedUser fails but returns a discord.Object, that discord.Object might be incorrect

#

really low chances for that to happen though

#

but if it fails completely apply_infraction won't be even called

tawdry vapor
#

@long garnet If you didn't know, you could have batched my review suggestions and committed them via GitHub

#

It looks like you manually did the changes

long garnet
#

yeah, but I wasn't sure how to change them

#

you missed many fs for f-strings

tawdry vapor
#

Oh sorry

#

Well you could have just not committed the ones I messed up πŸ˜„

long garnet
#

I also do this a bit on purpose because I want to avoid using the GitHub tools as much as possible

#

same with working with forks and not a branch

#

it helps me keep learning

#

@tawdry vapor

            try:
                if not isinstance(user, (discord.Member, discord.User)):
                    user = await self.bot.fetch_user(user.id)
            except discord.HTTPException as e:
                log.error(f"Failed to fetch user `{user.id}`: status {e.status}")
            else:
                # Accordingly display whether the user was successfully notified via DM.
                if await utils.notify_infraction(user, infr_type, expiry, reason, icon):
                    dm_result = "πŸ“¨ "
                    dm_log_text = "\nDM: Sent"
                else:
                    dm_result = f"{constants.Emojis.failmail} "
                    dm_log_text = "\nDM: **Failed**"```about to do the last commit, does this look good?
tawdry vapor
#

cant have a space after it

long garnet
#

right

#

I thought it might be wise to avoid fetching if not necessary

#

idk

tawdry vapor
#

Yes that looks OK

#

Did you test it?

long garnet
#

No, I'm about to

tawdry vapor
#

πŸ‘Œ

long garnet
#

I did test the watching channel ones

#

those are commited already

#

I nominated absent-lemon in my server, amazing

tawdry vapor
#

Yeah it is a bit odd to nominate someone that isn't in the server πŸ€”

long garnet
#

well, it's a side effect

tawdry vapor
#

Right

#

It's fine

long garnet
#

if it gets to the proxy then it's because the bot doesn't know if it's in the server or not

#

and if they use proxy in the watching modules then I assume they wanted to watch/nominate people in that case too

#

(though yeah, why nominate? I'd rather have it fail)

tawdry vapor
#

All the members in the guild should already be in the cache unless something is really wrong with Discord at that time

long garnet
#

(watching for supervision makes some sense)

#

ah, that try-except is wrong because those vars in else: are used afterwards anyway lol

tawdry vapor
#

you can just move them outside

#

like right under if not infraction["hidden"]:

long garnet
#
        if not infraction["hidden"]:
            dm_result = f"{constants.Emojis.failmail} "
            dm_log_text = "\nDM: **Failed**"

            # Sometimes user is a discord.Object; make it a proper user.
            try:
                if not isinstance(user, (discord.Member, discord.User)):
                    user = await self.bot.fetch_user(user.id)
            except discord.HTTPException as e:
                log.error(f"Failed to fetch user `{user.id}`: status {e.status}")
            else:
                # Accordingly display whether the user was successfully notified via DM.
                if await utils.notify_infraction(user, infr_type, expiry, reason, icon):
                    dm_result = ":incoming_envelope: "
                    dm_log_text = "\nDM: Sent"```like with a default value?
tawdry vapor
#

Yeah

#

That's basically what it was doing anyway, I think

#

I just used an else originally to make it more readable

patent pivot
#

the two links go to the intros for non-programmers and programmers but there is no description of that at all

green oriole
#

They don't point to the sane link?

crude gyro
#

there is a description on hover, I think

#

but yeah it sucks.

green oriole
#

I think this page in itself is misleading anyway

patent pivot
sharp timber
#

Not sure if this is known already or not, but if there are exactly 11 lines of output the bot will output 10. At 12 lines it will begin to upload the output to a paste

green oriole
#

Yes, looks like a bug

#

I'm searching through the issues but I don't think it has been already reported

#

Doesn't look like there is one, do you mind opening an issue please?

sharp timber
#

I'll do so

hardy gorge
#

!e
print(*range(11), sep="\n")

stable mountainBOT
#

@hardy gorge :white_check_mark: Your eval job has completed with return code 0.

001 | 0
002 | 1
003 | 2
004 | 3
005 | 4
006 | 5
007 | 6
008 | 7
009 | 8
010 | 9
hardy gorge
#

Interesting.

green oriole
#

I'll try to batch some eval related issue later today

#

Now that it support external libraries, I think it is a good time to upgrade it

green oriole
#

Can't create a draft PR without any commit?

#

That sucks

#

Guys.. I have a small issue..

#

I have an AttributeError: SIGKILL on elif returncode == 128 + Signals.SIGKILL:, but when I use jump to definition, it is clearly defined

crude gyro
#

complete traceback?

green oriole
#

Yes sir!

crude gyro
#

what operating system are you on?

green oriole
#

Windows

#

On a docker-less setup if that can help

crude gyro
#

looks like this constant might not exist on windows

#

the signals module does not guarantee the presence of all the signals on every OS

#

it's platform dependant

green oriole
#

There is no SIGKILL on windows?

crude gyro
#

that's what I'm finding

#

in windows, the equivalent would be SIGTERM

green oriole
#

Hmm, seems kind of logic

molten bough
#

windows does have SIGKILL, sort of

#

there isn't actually a signal for it

#

it just fucking murders the process

crude gyro
#

that's not the point, the point is that there's no SIGKILL constant in the Signals IntEnum if you're on windows

green oriole
#

Windows, the process murderer

crude gyro
#

and so, you get the above traceback.

#

which kinda sucks.

tawdry vapor
#

NsJail cannot even run on Windows in the first place

green oriole
#

It does run

#

If I remove this line

#

So I guess a simple getattr would be enough

tawdry vapor
#

NsJail is linux only. It relies on groups among other linux only features. It fundamentally cannot work on Windows

crude gyro
#

yeah I'm not sure why you're trying to spin this up on windows.

tawdry vapor
#

Maybe snekbox will start but should you try to use it, it wont work

#

Oops, meant to write cgroups not groups

green oriole
#

It does run

crude gyro
#

anyway if we were going to fix this, I'd simply add an elif extra before the failing one that looks for a SIGTERM

green oriole
#

I just want to work with the bot-side interface

tawdry vapor
#

Oh this is on the bot?

green oriole
#

Yep

tawdry vapor
#

OK, sorry then

crude gyro
#

snekbox cog

#

not snekbox repo

green oriole
#

I want to work on a few snekbox enhancements, I can fix it

#

Yeah, I should have specified it, my bad

tawdry vapor
#

You did I just suck at reading

crude gyro
#
elif returncode == 128 + Signals.SIGTERM or returncode == 128 + Signals.SIGKILL:
    msg = "Your eval job timed out or ran out of memory"

maybe this is fine?

green oriole
#

Nope

tawdry vapor
#

Since the returncode comes from a linux process, it should just subtitute sigkill with the hardcoded value. I think using sigterm would be incorrect

#

Unless sigterm on Windows has the same value sigkill does on linux

crude gyro
#

hm.

tawdry vapor
#

I probably used the signals enum cause it's clearer than having some hardcoded integer

crude gyro
#

well write some code above then that tries to resolve first SIGKILL and then SIGTERM to an int, and then use that in the check.

#

we can even just define our own SIGKILL that will conditionally be equal to SIGTERM if SIGKILL doesn't exist

#

SIGTERM will always exist on windows.

#

then check against that

green oriole
#

But if I run

!e import time
time.sleep(10)```It does not say that it timed-out
#

But do we really care?

tawdry vapor
#

I think you misunderstood my point. SIGKILL is equal to integer 9 on linux. Therefore, unless SIGTERM on Windows also equals 9, then SIGTERM cannot be used. It's probably better to say SIGKILL = 9 in some constant.

crude gyro
#

why

green oriole
#

Hard coding 9 does work though

crude gyro
#

I don't understand why that would be the case at all.

#

can you walk me through it, @tawdry vapor

green oriole
#

But using Signals.SIGTERM does not work

#

Because NsJail will always return the same code, the platform doesn't matter

tawdry vapor
#

The returncode is returned by the snekbox API. So this return code is the return code of the Python process that NsJail ran. Importantly, this process ran in the context of a linux machine. Therefore, the returncode has to be interpreted as a linux return code regardless of where the code that interprets it is running.

crude gyro
#

wait no, never mind. I get it. because the code is executing inside a linux system.

#

yeah

#

fine then, let's just make a SIGKILL constant which equals 9

green oriole
#

Oki

crude gyro
#

and use that

#

but what about this line

#
name = Signals(returncode - 128).name
#

is this safe?

tawdry vapor
#

Yeah it's in a try except but on Windows may not be accurate if it has different return codes

#

So it could return an incorrect signal name? Not sure

#

It's only for display purposes

crude gyro
#

iunno, probably just more likely to trip the ValueError

green oriole
#

Signals changes depending on the platform, don't think it would work

crude gyro
#

don't think what would work

green oriole
#

name = Signals(returncode - 128).name

crude gyro
#

it'll work for whatever signals are available

#

which seems to be the point of that line

tawdry vapor
#

I don't think it's worth the bother trying to make this platform independent (probably by creating our own enum with the hardcoded linux signals)

crude gyro
#

sounds like this is solved

green oriole
#

I just have a last question, where do I put the constant?

tawdry vapor
#

with the rest of them

green oriole
#

I mean, in which category?

tawdry vapor
#

I don't understand

#

There are like 6 constants at the top of the module

#

just put it there

green oriole
#

Oh, not in the config file, okay (make sense actually)

crude gyro
#

config file constants are for things you need to use in many different modules

green oriole
#

Draft PR opened!

#

Do we still need to ask to be assigned, or we can do that ourselves now?

#

(Or I don't really need to assign myself since it is written linked a pull request that will close this issue on the issue?)

tawdry vapor
#

Yes, you should still ask to be assigned

#

You should have done that before you opened your PR really

#

It's just to make sure we don't run into issues with multiple people working on the same thing

green oriole
#

One of them has been opened by me, should I still ask?

#

Yeah, that was silly, sorry

#

But I haven't started working on it yet

#

Thanks!

hardy gorge
#

The one who opens an issue is not necessarily the same person as who's going to work on it, so you should still be assigned.

tough imp
#

I have a question regarding assignment permissions on github - as contributors we have the ability to assign people to issues, but we're advised not to self-assign but ask a core dev instead. This is entirely reasonable to me, but I'm wondering why we then have the permission - is it so that we can we assign others? For example I've now come across https://github.com/python-discord/bot/issues/602 which alberthdev has been working on since October and they even have a PR in progress at https://github.com/python-discord/bot/pull/633, and they commented under another issue at https://github.com/python-discord/bot/issues/599, but they aren't assigned on either issue. So I suppose the question I have is then is it ok if I come across such an issue that I assign the person myself, I'm just not supposed to assign my own self? Otherwise if only core devs are supposed to assign, then I think it would make sense to strip the permission from roles below.

Additionally if I wish to be assigned on multiple issues such as https://github.com/python-discord/bot/issues/553#issuecomment-568613672, is it necessary that I actually go and leave a comment under each specific one and then wait?

tawdry vapor
#

Regarding why you are permitted to assign, it's because GitHub doesn't allow for configuring permissions to such fine degree.

tough imp
#

Oh ok, I didn't know that

tawdry vapor
#

We'll get back to you on the other questions

tough imp
#

Perfect thanks

green oriole
#

Thanks lemon!

snow zealot
#

Where does !eval really execute the code? An online compiler? Which one is it?

crude gyro
#

we wrote our own, @snow zealot

snow zealot
#

can I access it, outside of the bot?

crude gyro
#

you could self-host it.

#

it's on our github org

#

it's called snekbox

snow zealot
#

Uhm, are there directions somewhere on how I would go about doing that? I'm not sure what self-hosting is

crude gyro
#

I think there are some directions in the repo readme, but it's not uncomplicated.

snow zealot
#

oh no 😭

#

mhm, I'll give it a try nevertheless

crude gyro
#

I've heard repl.it will bring back an API soon

#

so hopefully this sort of thing won't be so hard in the future.

snow zealot
#

which isn't even famous

#

and now they're gonna get shut down due to lack of funds

#

hence the sudden interest

crude gyro
#

hmm. I see.

snow zealot
#

Also

#

why did y'all write your own compilers when free online compilers exist? Security reasons or something else?

crude gyro
#

probably mostly because we could

#

it was a fun challenge to solve

#

and it allows us more granular control

snow zealot
#

oh okay.

glass pecan
#

if you use docker, it's pretty simple to host

#

assuming you just wanted to play with it at least.

#

something like this maybe if defined in a compose

#
version: 3.7

services:
  snekbox:
    image: pythondiscord/snekbox
    ports:
      - 8060:8060
    privileged: true
    init: true
    environment: 
      - DEBUG=True  # for log levels, optional
snow zealot
#

mhm, no I don't use docker but I can sure download it and learn bout it

#

and yes, I'm looking to play around with it in the sense that I'd like it to be my replacement for compilers when rextester goes down, and when I'm not in the mood for spyder(because spyder takes a whole darn minute to load while rextester took 3 seconds to open)

green oriole
glass pecan
#

It appears @patent pivot disabled the widget api making it no longer able to get the member count

patent pivot
#

Ah so we do use it

#

The reason it was disabled was because it was letting listing sites harvest membership and user data for the server

#

so I asked if we were using it and I was told we weren't

#

if we do need that we can bring it back

glass pecan
#

that's unfortunate. would be nice if https://shields.io/ would be able to use in it's place an invite code instead, as that would provide the same data

patent pivot
#

I could try contribute that

glass pecan
#

i had a look at their github and it appears it's entirely js

#

no relevant issues open for it atm

green oriole
#

And what is the problem with the listing sites? Isn't that a good thing?

glass pecan
#

not really

#

if they're getting membership data regarding individual members, we'd rather not have them using us like that

patent pivot
#

It's not listing sites, it's sites that take in a user ID and show anyone every discord server they are in

glass pecan
#

they've got no permission from us and discord don't provide that data by default

#

so for privacy, why leave the hole open

patent pivot
#

especially for something as small as member count

glass pecan
#

i personally hadn't known that this was a thing otherwise i wouldn't have used it

green oriole
#

Oh, they have access to user data too? Yeah, that's a problem haha

glass pecan
#

yeah it makes sense i guess. the widget is for showing a preview into the server

crude gyro
#

yeah it makes it possible to do stuff like search for a member and see all the servers they're on

#

all the ones with widgets enabled, at least

#

which is certainly an invasion of privacy

glass pecan
#

pretty lame, yep

patent pivot
glass pecan
#

doesn't matter who, but this is important enough to probably make an issue for

green oriole
#

Could we not create our own badge? Shouldn't be that hard

glass pecan
#

lol why add another thing to maintain

patent pivot
#

I can see if I can get shields to make an invite based one

glass pecan
#

badges aren't that important. but it's not like they can't add it to shields.io themselves yeah

#

just the invite code as an input would be plenty, as we're already using the invite as the link so having it in the badge img url shouldn't be an issue

patent pivot
#

split it out into id and invite based

#

existing users won't be broken that way

glass pecan
#

yeah

#

they'd need to still cache this though

patent pivot
#

I'll play around with that in a bit

glass pecan
#

pretty sure server data has a heavy ratelimit

#

we use it though in our own code

crude gyro
#

would be fun to have some custom badges, though.

total member count
online member count
bot currently online

bet the site could host such custom badges real easily.

#

but yeah, stupid to add another thing to maintain

#

we're having a hard time keeping up with our current set of features as it is

patent pivot
#

first two we can do through shields

glass pecan
#

if we get stats going, then i see no issue with that. but not as a standalone

crude gyro
#

certainly not something to do right now either way

glass pecan
#

the only custom badge i'd like to see though is one for github actions. their one is lame because of their crappy svg generation and font styling

#

then it would be good πŸ˜„

tough imp
#

i'm getting this warning when running the bot's test suite

/home/kwzrd/Code/pydis-bot/bot/bot.py:21: DeprecationWarning: The object should be created from async function
  resolver=aiohttp.AsyncResolver(),
/home/kwzrd/.local/share/virtualenvs/pydis-bot-ULHzK8dH/lib/python3.7/site-packages/aiohttp/connector.py:730: DeprecationWarning: The object should be created from async function
  loop=loop)

i think this was changed recently to reduce the amount of spawned threads, just asking if we're aware of the deprecation warning

tough imp
#

additionally i'd like to ask, I have the following namedtuple

class Case(NamedTuple):
    recent_messages: List[MockMessage]
    culprit: Tuple[str]
    total_attachments: int

I use it to represent test cases for antispam rules, so I'm redefining it in multiple modules - I'd like to put it somewhere from where I can import it instead, but I'm not sure if it's generic enough to actually go into tests.helpers.py, would it be reasonable to create a tests.bot.rules.helpers.py module and put it there? it's only used by the rules tests, but i'm not sure if it's a good idea to have two separate helpers modules, or if its a good idea to even import it as it's really just 4 lines of code

mellow hare
#

@tough imp I think we are aware of that deprecation warning but that one is coming from aiohttp, so as our dependencies continue to update, it shouldn't be an issue

tough imp
#

oh right ok, makes sense thanks

long garnet
#

@clever wraith ah, I thought you meant "updates on what's going on, what's the status", not "is snekbox going to be updated?"

#

it should be updated at some point, yeah, but I'm not the best person to say it

#

don't consider me a representative of the PyDis projects in any way, I am not

sharp timber
#
f = open('/dev/kmsg', 'rb'); import os; s = os.dup(f.fileno()); f.close(); import fcntl; fcntl.fcntl(s, fcntl.F_SETFL, os.O_NONBLOCK); print(os.read(s, 1000))
#

reads from host kmsg

#

I can also access /dev/mem which appears to read from host memory (!), but not from within nsjpy, just from the dev shell, so I'm not sure how 'dangerous' that is

#

Thankfully neither allow me to open them RW

crude gyro
#

paging @ionic tundra

#

best you guys work together on this if you're both working on a fix

#

the above may be interesting

ionic tundra
#

oh damn

#

yep, good thing you cant write to that... 😬

crude gyro
#

!eval print(2+4+4)

stable mountainBOT
#

@crude gyro :white_check_mark: Your eval job has completed with return code 0.

10
crude gyro
#

meanwhile I restored it

sharp timber
#

!e ```py
f = open('/dev/kmsg', 'rb'); import os; s = os.dup(f.fileno()); f.close(); import fcntl; fcntl.fcntl(s, fcntl.F_SETFL, os.O_NONBLOCK); print(os.read(s, 1000))

stable mountainBOT
#

@sharp timber :white_check_mark: Your eval job has completed with return code 0.

b'4,315748,5791942185539,-;[UFW BLOCK] IN=eth0 OUT= MAC=f2:3c:91:94:ff:2f:50:87:89:40:a1:c1:08:00 SRC=183.81.105.54 DST=172.104.139.207 LEN=40 TOS=0x00 PREC=0x00 TTL=55 ID=63023 PROTO=TCP SPT=18361 DPT=23 WINDOW=29065 RES=0x00 SYN URGP=0 \n'
ionic tundra
#

maybe as a plan b some extra safety measure could be implemented into @stable mountain itself, to check on the snekbox periodically and restore it if it's malfunctioning

#

or a rate-limited user command to run a snekbox welfare check

sharp timber
#

I'm also able to write to /dev/

#

Specifically, /dev/mem{int}

#

So /dev/ isn't inheriting the "read only file system" protection?

#

The changes aren't mirrored outside of the container, but it seems that as long as the docker container is still up, it's maintaining a parallel storage space for written files, and they are not reset by snekbox/nsjail

ionic tundra
#

oh dear

sharp timber
#

The question is, where is it doing that

#

Let's find out.

#

uh oh

#

Well I learned two things

#
  1. nsjail blocks writing to outside of /dev
#
  1. this is because /dev is mounted via tmpfs
ionic tundra
#

i added this to the nsjail args:

'-m', 'none:/dev:tmpfs:size=0',

which seems to be working

#

but im way out of my depth here

#

so not sure if thats even correct syntax or what

sharp timber
#

!e ```py
n = open("/sys/fs/cgroup/memory/NSJAIL/memory.limit_in_bytes", "r")
print(n.read())

stable mountainBOT
#

@sharp timber :white_check_mark: Your eval job has completed with return code 0.

52428800
sharp timber
#

!e ```py
n = open("/sys/fs/cgroup/memory/NSJAIL/memory.limit_in_bytes", "w")
print(n.write("8888888888"))

stable mountainBOT
#

@sharp timber :white_check_mark: Your eval job has completed with return code 0.

10
sharp timber
#

!e ```py
n = open("/sys/fs/cgroup/memory/NSJAIL/memory.limit_in_bytes", "r")
print(n.read())

stable mountainBOT
#

@sharp timber :white_check_mark: Your eval job has completed with return code 0.

8888885248
sharp timber
#

uh oh.

#

!e ```py
n = [0]1024
for i in range(5000):
n.extend(n
50)
print(i)
print(1)

stable mountainBOT
#

@sharp timber :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 3, in <module>
003 | MemoryError
004 | 0
005 | 1
sharp timber
#

!e ```py
import sys
n = [0]1024
print(sys.getsizeof(n))
print(sys.getsizeof(n
50))
print(sys.getsizeof(n*8000))

stable mountainBOT
#

@sharp timber :white_check_mark: Your eval job has completed with return code 0.

001 | 8248
002 | 409656
003 | 65536056
sharp timber
#

!e ```py
import sys
n = [0]1024
print(sys.getsizeof(n))
print(sys.getsizeof(n
50))
print(sys.getsizeof(n*80000))

#

!e ```py
n = open("/sys/fs/cgroup/memory/NSJAIL/memory.limit_in_bytes", "w")
print(n.write("8888888888"))

stable mountainBOT
#

@sharp timber :white_check_mark: Your eval job has completed with return code 0.

10
sharp timber
#

!e ```py
import sys
print(sys.getsizeof([0]102410000))

green oriole
stable mountainBOT
#

@sharp timber :white_check_mark: Your eval job has completed with return code 0.

81920056
sharp timber
#

NSJail is not blocking write access to it's own configuration

green oriole
#

It is supposed to mount / in write only

#

But apparently it doesn't haha

sharp timber
#

Unless I'm reading the above wrong, I just managed to make an array 81mb in size, but the memory limit is supposed to be 54mb

green oriole
#

Hmm, maybe it has something to do with the recent image change

sharp timber
#

!e ```py
n = open("/sys/fs/cgroup/memory/NSJAIL/memory.limit_in_bytes", "w")
print(n.write("888888888899"))

stable mountainBOT
#

@sharp timber :white_check_mark: Your eval job has completed with return code 0.

12
sharp timber
#

!e ```py
n = open("/sys/fs/cgroup/memory/NSJAIL/memory.limit_in_bytes", "r")
print(n.read())

stable mountainBOT
#

@sharp timber :white_check_mark: Your eval job has completed with return code 0.

888888885248
ionic tundra
sharp timber
#

!e ```py
import sys
print(sys.getsizeof([0]102420000))

stable mountainBOT
#

@sharp timber :white_check_mark: Your eval job has completed with return code 0.

163840056
ionic tundra
#

same method could be used to cut off access to other scary directories

sharp timber
#

!e ```py
import sys
print(sys.getsizeof([0]102450000))

stable mountainBOT
#

@sharp timber :warning: Your eval job timed out or ran out of memory.

[No output]
green oriole
#

We have changed a couple of weeks ago the base image from alpine to Debian buster

#

(oh wow thanks wifi)

sharp timber
#

Not sure what limit I'm hitting now, it's around 160/170mb

green oriole
#

And can you try doing the same thing, but for / @ionic tundra?

ionic tundra
#

i did some googling and apparently nsjail doesnt support that

#

it's only for specific directories/subdirectories

#

or maybe i misunderstood

#

i feel like a dummy mount for / will unintentionally break a lot of things

#

"-R/usr", "-R/lib", "-R/lib64",

green oriole
#

Not sure if it would, because the eval process itself will be mounted in read-only, which is what we want

ionic tundra
#

these ones are deliberately mounted

#

it wouldnt be a question of read-only-ness. if there's nothing mounted at / then it might prevent access to files which need to be mounted.

#

at least that's my concern

#

full disclouse though: im way out of my depth here. never really had to tackle this sort of thing.

#

so will defer to others here who are more knowledgeable on these subjects.

green oriole
#

Me neither, but I think putting thoughts into it can help anyway

#

I don't really see why the eval process would need some files in rw

ionic tundra
#

im not saying they would need to be in rw

#

maybe some libraries need access to binaries in those folders

green oriole
#

Because.. Running a python file doesn't need write access right? Plus, / is supposed to be in write-only right now

#

Some libraries? Hmm

#

But the problem might be from NsJail, because --chroot / is supposed to mount the entire filesystem in read-only

sharp timber
#

I don't think you can get away from the process limit, and since you can't get out of that you can't really break out of nsjail in the first place, the only issue is the write access problem

#

Which is entirely because for whatever reason, /sys/fs/cgroup and /dev are being mounted as tmpfs' with read-write privileges

#

./dev might be more difficult to handle, since writing to /dev/stdout is "printing to out". For /sys/fs/cgroup, that's being written to from within snekbox/nsjail.py

#

I'm actually not sure why at all that needs to be writeable--the parameters are also being passed to nsjail via subprocess? Someone with more experience can probably answer that

#

In addition, the docker container is running in priviledged mode? It shouldn't be--that might be the source of some of these things like being able to read from /dev/mem / /dev/kmsg

green oriole
#

I think NsJail needs to be privileged to be able to run

sharp timber
#

!e ```py
import os
print(os.listdir("/snekbox"))

stable mountainBOT
#

@sharp timber :white_check_mark: Your eval job has completed with return code 0.

['Pipfile', 'Pipfile.lock', 'LICENSE', 'tests', 'snekbox', 'docker', '.venv']
ionic tundra
#

in my tests dummy mount /dev doesnt seem to be affecting stdout

#

but it is blocking /dev/shm

green oriole
#

But I don't really think you were able to do that in previous snekbox versions

#

If someone here could try to rollback to a4a8805587dc8e011fc2aa4276cc71631c58702a and try those to see if they work, that would be great (I'm not on my computer sadly)

hardy gorge
#

In addition, the docker container is running in priviledged mode? It shouldn't be--that might be the source of some of these things like being able to read from /dev/mem / /dev/kmsg

I don't know, but someone in the <@&409416496733880320> group probably knows exactly how it's set-up. If that is the case and it is the source of many of the writeability issues, we should probably look into not running it in privileged mode. (I've added a ping just so this gets seen by the right people.)

glass pecan
#

iirc privileged mode was required for something

#

it wasn't thrown in willy nilly

crude gyro
#

I don't remember. @tawdry vapor knows more about snekbox's setup than most of us

sharp timber
#

Someone mentioned that NSJail requires it

glass pecan
#

i think it's because of nsjail and the initialisation of the environment

molten bough
#

yeah, I think nsjail needs it

#

although aren't we running user code under a different uid anyway?

glass pecan
#

might be this
_create_parent_cgroups

#

we can just add that step to the image creation stage though

sharp timber
#

Here's the errors from dropping --privileged:

[E][2019-12-28T11:13:47+0000][15] bool subproc::runChild(nsjconf_t*, int, int, int)():457 nsjail tried to use the CLONE_NEWCGROUP clone flag, which is supported under kernel versions >= 4.6 only. Try disabling this flag: Operation not permitted
[E][2019-12-28T11:13:47+0000][15] bool subproc::runChild(nsjconf_t*, int, int, int)():465 clone(flags=CLONE_NEWNS|CLONE_NEWCGROUP|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWUSER|CLONE_NEWPID|CLONE_NEWNET|SIGCHLD) failed. You probably need root privileges if your system doesn't support CLONE_NEWUSER. Alternatively, you might want to recompile your kernel with support for namespaces or check the current value of the kernel.unprivileged_userns_clone sysctl: Operation not permitted
[E][2019-12-28T11:13:47+0000][15] int nsjail::standaloneMode(nsjconf_t*)():146 Couldn't launch the child process
green oriole
#

Hey, someone is me haha

sharp timber
#

I scrolled up to look and couldn't find it ;-; sorries probably was

green oriole
#

Np haha

last patio
#

maybe --cap-add SYS_ADMIN would be sufficient, but usually apparmor will also complain

thorny mulch
#

Where can i get melons

molten bough
#

what? melons?

green oriole
#

In a.. Melon store?

lapis hull
#

I'm having some trouble getting the site repo set up and running in a local dev environment. Here's the current error I'm trying to solve when attempting to run the server or just tests:
django.db.utils.OperationalError: fe_sendauth: no password supplied

#

Some additional details:

  1. I've gone through the instructions at https://github.com/python-discord/site/blob/master/docs/setup.md, with the exception of the pip install -e .[lint,test] step, which does not run because there's no setup.py file. Looks to me like that section is out of date.
  2. I'm using PyCharm, with a pipenv, and with the packages automatically installed from the Pipfile that came with the repo. I believe that negates the need for #1.
  3. I'm not using Docker at the moment.
  4. I've tried with both Windows 10 and Ubuntu 18.04 and have the same error on each.
tawdry vapor
#

The docs on the site are mostly out of date. Have you read the contributing wiki on our site?

#

Since you don't want to use Docker, the only thing the wiki lacks is a guide on how to setup postgres. However, the docs in the repo should still be relevant for postgres.

lapis hull
#

Oh, wow. I didn't realize there was another source of info.

#

I'll take a look, thanks.

hardy gorge
#

We should remove the other one and just point to a single source

lapis hull
#

Cuz that link came straight from the README.md file on the GitHub repo homepage.

hardy gorge
#

It should at least be updated, yes.

#

It's an oversight.

#

We've since changed the set-up, but forgot to update this part

lapis hull
#

Yeah those don't seem to work with the current state of the code, maybe. I've spent a whole buncha hours under the assumption that the problem was me, and I didn't want to ask for help because I think "so how do I run this thing" is not a very confidence-inspiring introduction, hahaha

tawdry vapor
#

There is a PR that updates the readme to link to the wiki

#

Sorry about that

lapis hull
#

haha it's all good, I'm definitely not upset about it. Keeping documentation up to date is not trivial, I totally get that.

#

The good news is I learned some stuff along the way too πŸ™‚ Anyway - I'm gonna go do something else for a while and come back to this later on, thanks for your help!

runic dome
#

Hey

tawdry vapor
#

Hi

green oriole
#

@lapis hull do you wanna use windows to run the site and the bot?

lapis hull
#

@green oriole most likely, thats my general purpose machine. I do have a Ubuntu VM I use when windows poses problems. Why?

#

I used Windows to run the bot during Hacktoberfest to make some small contributions, FWIW

green oriole
#

Because we have a temporary guide pinned here especially for win 10 setups ^^

lapis hull
#

Oh, nice. I'll check it out when I get back to it, thanks!

green oriole
#

Hey @tawdry vapor, I'm working on some bot-side snekbox improvements, could it be useful to perform a health test every 5 minutes, and restart the snekbox container if it failed?

past falcon
#

How do you pycharmians quickly restart the running bot? Since pipenv run start makes me use the terminal to run it, and forcing a break there seems to take quite a few seconds (windows).

green oriole
#

Use CTRL + PAUSE to force stop it

past falcon
#

Laptop, don't have a pause key. If I run in a normal terminal, I can use ctrl+fn+b to stop instantly, but in pycharm for some reason it's really slow

#

Guess I'll just run in an external terminal then?

crude gyro
#

@past falcon use a run configuration

#

running the bot in pycharm interpreter is not da wey

#

you set up a run config for it and then pycharm just gives you a restart button

past falcon
#

ah, but, can u show me da wey? I tried a run config but was hitting all kinds of import errors x_x

crude gyro
#

that means your pycharm interpreter for this project isn't set to the pipenv environment

#

so basically go into your config and use the search bar to find project interpreter

#

and if pycharm can't autodetect the pipenv environment, you'll need to manually add it by just navigating to the correct python executable.

past falcon
#

I think the interpreter is right, I'm probably doing something other that's silly. I've tried a bunch of combinations for the script path / interpreter options

molten bough
#

Script path looks incorrect

#

If you want to run a module then click the dropdown to the left and select module

#

Otherwise you need to select an actual .py file

#

Also, I don't think running this way will load the .env but iirc there's a plugin for it

past falcon
#

Cool, yeah now it's complaining about improper tokens instead so I guess that moves the error to the .env

#

Hm, but "running this way" makes it sound like there's a way that does not require extra plugins?

tawdry vapor
#

@green oriole perhaps, but how do you plan to do that through the bot?

#

I imagine it could be done with Docker health checks and some devopsy stuff

molten bough
#

I mean I usually run things with docker where possible

#

but yeah, you can add env vars to your run config there

#

but you should be able to use the Env File plugin

#

just remember to select the env file in the tab in your run config

past falcon
#

I'm starting to get the docker appeal

#

This feels like the third time I ask something like "how do I..." and someone answers "idk, I just use docker" πŸ˜„

molten bough
#

haha

#

try that plugin

#

that should do what you need

past falcon
#

Cheers

green oriole
#

@tawdry vapor well, with the latest breach, the container was still running, but the memory was full and no eval could run. I think we can simply send print('healcheck ok') to eval, and test if it return healcheck ok

#

If it doesn't, it send an alert and reboot the container

tawdry vapor
#

How exactly will you reboot it though

green oriole
#

I don't really know how the web server exactly works, I think we could simply launch a command to ask docker-compose to reboot the container

#

Anyway, lemon rebooted it last time, we could just ask him how he did it

molten bough
#

I guess ideally you'd just reapply the state

long garnet
#

titles show twice on my phone (I can't check on my desktop, but the alternative User Agent still shows them)

#

is that on purpose?

crude gyro
#

a) I don't think snekbox needs to be that resilient just because someone broke it one time
b) if we were gonna implement that kind of resilience, it shouldn't be handled by the bot.

#

@green oriole @tawdry vapor

long garnet
#

whoops sorry

crude gyro
#

@long garnet the top title is probably a breadcrumb

long garnet
#

it is

crude gyro
#

I think we hid them but maybe not for mobile?

molten bough
#

I thought we did

long garnet
#
<nav class="breadcrumb is-pulled-left" aria-label="breadcrumbs"> <ul> 
<li class="is-active"> <a href="//pythondiscord.com/pages/">Code Jams</a> </li> </ul> </nav>```
#

I don't know if that pasted well

#

but yes

crude gyro
#

make an issue then, sounds like a bug.

long garnet
#

okies

hardy gorge
#

Didn't we just hide the top level of the breadcrumbs?

molten bough
#

Oh right, yeah

brazen charm
long garnet
#

I know I can request a specific reviewer with that GitHub tool but I don't know if that's polite or not

green oriole
#

Well, you can also left a comment mentioning the person

long garnet
#

I mean, that puts them on the spot

woeful thorn
#

If they want to ignore it then they can

hardy gorge
#

@long garnet It's fine to ask someone to review your PR. They'll tell you if they don't have time at the moment.

long garnet
#

in a new comment?

hardy gorge
#

You can do it here as well, by mentioning them.

#

There's probably a reason why you want to ask a specific individual (my guess is that it relates to something they originally wrote), so contacting them should be fine.

long garnet
#

do you have the time to review it?

#

I think I could ask Scragly, too, but he's been very busy

hardy gorge
#

I think I'm going to put some time aside to review PRs this friday. Tomorrow (new year's eve here) and Wednesday I've got a lot of social obligations and Thursday I'm afk whole day for work.

#

So, if you request a review, I'll try to look at it Friday

long garnet
#

okay!

#

thanks for the help

#

(with the etiquette and whatnot)

hardy gorge
#

No worries! I've been a bit busy lately and I should spend more time reviewing

mellow hare
#

Since I'm house sitting this week I'm going to try to get my review on

lapis hull
#

@green oriole Thanks for that pinned guide, that was helpful! There is a tiny broken link if you care, not super important. Also might be worth pointing out that I did have to manually set DEBUG=1 in the .env file for tests to run successfully (wasn't doing the ALLOWED_PATHS stuff in settings.py without it), but it's also possible I wasn't running tests correctly or something.

green oriole
#

Hi @lapis hull, noice! Is the broken link redirecting to http://wip.com/? This one is kind of intentional, because the guide should be hosted on https://pythondiscord.com/, so in the final version, it will redirect to another page on the pydis site itself. Thanks you for the debug env var, I'm gonna add it ^^

lapis hull
#

@green oriole oh, I gotcha. Yeah that makes sense. The one pointing to http://soon.tm right? I thought it'd be linking to a different section on the same page and could just be a relative link. But if it'll be a separate document I see what you mean.

green oriole
#

Oh yeah soon.tm I remember now :D

lapis hull
#

Made me chuckle, lol

green oriole
#

^^

#

I've added the debug env var

#

The guide should be ready to go!

#

If someone here can upload it to the site before 2020, that would be awesome!

green oriole
#

Well, too late :D

tawdry vapor
#

I'll work on it now

green oriole
#

Nice @tawdry vapor, maybe you can do it before everyone is in 2020, haha. You should be able to copy paste the raw text of both files, but there is a placeholder link (https://soon.tm/) at the beginning of the bot that should be changed to the site non-docker guide ^^

tawdry vapor
#

It's going to be integrated into the existing page instead of being separate

green oriole
#

Oh okay

tawdry vapor
#

I already did the site

#

If you have any suggestions feel free

green oriole
#

Hmm, the static root is a Linux path

#

So it is not going to work on windows, right ?

tawdry vapor
#

The only difference is the path separator

#

Was sort of hoping it wouldn't be an issue but I didn't test

#

the ./ may be redundant anyway

green oriole
#

Okay, it is getting late now, but i can probably test it tomorrow

#

Also, I feel like the section about launching the site is quite misleading, I had to read it twice to actually understand it, and I had background on the launch methods

tawdry vapor
#

Misleading?

green oriole
#

I meant disturbing

#

_(sorry) _

tawdry vapor
#

I don't think that's the right word either

#

Disturbing means you felt unsettled or uncomfortable

green oriole
#

_I should really go to bed :) _

#

I mean

#

I don't really know how it works

#

There is informations everywhere, and no link between them

tawdry vapor
#

I'd appreciate more specific examples but you can get back to me tomorrow

green oriole
#

Okay, gonna write you a quick thingy before I go (using very basic words lol) :
I the Run the project section, there is the two subsection chained one to another, but the user should only follow one of them, right? But there is no note about it, so I think it would be nice to have a little text before the two subsections explaining which one to follow. Also, there is two different instruction in the subsection Run on the host, which aren't clearly delimited and it is not explained which method to use ^^

#

Happy new year Mark, and see you tomorrow ^^

tawdry vapor
#

Thanks, you too

#

I suspected it was related to that

#

I can work on that

tawdry vapor
#

Well in case someone has a look, it's not completely done yet but it's getting close. So that may explain some things you may find missing.

#

I may end up restructuring the bot guide anyway, I don't know yet

#

Was just trying to get it out there for now

molten bough
#

lol, I opened a ticket back in May on the django-sass-processor repo regarding it being incompatible with django-simple-bulma

#

I just got a response to it now

#

"I have no idea why this is happening, and I'm closing this ticket because there isn't enough information"

#

so I guess we're on our own

mellow hare
#

Instead of asking for additional information or the like?

#

Seriously?

molten bough
#

yeah, just closed it

mellow hare
#

That's..... unprofessional

molten bough
#

I mean it also took him 7 months to reply, so yknow

mellow hare
#

I mean is there anything stopping you from reopening it with more information? It's not like it's locked right

molten bough
#

Nah, I am gonna ask him what info he needs

#

but tbh it's very, very simple to reproduce

#

I dunno what else I can give him

timid sentinel
#

I'm having problems while trying to install the dependencies for seasonalbot. I'm getting an error when I run pipenv sync --dev. It seems to create the environment but when installing i get the error the ssl module in Python is not available and then ERROR: ERROR: Package installation failed.... here is the full result https://paste.pythondiscord.com/wuzokecijo.py.

I prefer using VS Code on my computer that PyCharm because i have used it more and it is faster but now I'm not sure if It'll just make things harder and more complicated. I would appreciate some advice

molten bough
#

That's up to your python install

#

What OS?

timid sentinel
#

Win 10

molten bough
#

And how did you install python?

timid sentinel
#

I created the virtualenv using a conda environment

molten bough
#

Ah, you're on conda

#

Try again with cpython

timid sentinel
#

Ok. It won't work with 3.8 will it, only 3.7

green oriole
#

3.7 yeah

molten bough
#

Whatever is in the Pipfile

timid sentinel
#

Thanks. Ill try that

timid sentinel
#

Yay it all works! Now to work out how it works...

green oriole
#

Can someone try to do .bm https://discordapp.com/channels/267624335836053506/291284109232308226/663784996703698960? It doesn’t work for me

clever wraith
#

same

#

doesn't work

#

I think OT is now blocked

#

its a issue with message itself

#

maybe it exceed highest no. of character

#

can we see logs for that ? anyone

#

I think i got it
as the message DMed contain the element of the message combine that with other things such as hint , it exceed the character limit @green oriole

mellow hare
#

I'd say that'd be worth making an issue for and fixing

green oriole
#

Oh mhh

clever wraith
#

I will push a PR for that

green oriole
#

can you check the logs @mellow hare please, to make sure we got the right problem?

mellow hare
#

I don't know what logs you're wanting me to check. We don't have a direct hook to seasonal, I don't think

clever wraith
#

I am pretty sure thats it

green oriole
#

Ohh yeah, only @stable mountain is hooked to the site admin

mellow hare
#

Well make sure you test it before you PR it

clever wraith
#

I did

#

it works for other messages

#

just that message only

mellow hare
#

No, I'm saying your fix

clever wraith
#

ok

mellow hare
#

I mean yes but testing to make sure your change actually worked isn't linting

#

It's just good coding

clever wraith
#

100 comments cough cough cough

#

ok will do

#

with same message i think

green oriole
#

There is actually a log file hosted on the server, but I don’t think it is worth bothering

clever wraith
#

wait i have same code at my side

#

let me do and

green oriole
#

Don’t forget to pull changes πŸ™‚

#

Before starting working on it

clever wraith
#

Ok

woeful thorn
#

I don't know why you keep bringing up the number of comments on the PR as if it's abnormal. It's not.

mellow hare
#

And honestly it should be seen as a boon rather than a burden. The opportunity to learn from mistakes is key to becoming better

clever wraith
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTT                                                                             PException: 400 BAD REQUEST (error code: 50035): Invalid Form Body
In embed.description: Must be 2048 or fewer in length.

#

yeah

#

that's the issue

green oriole
#

Well, you can just add ... and trucate the message if it is too long

#

tbh, you should reduce it to less than 2048 chars, having that much of information isn’t very useful

#

and take some space when you browse through your bm

clever wraith
#

It maximum should be 256 ;-;

green oriole
#

256 doesn’t seems like a lot though πŸ˜„

clever wraith
#

though*

green oriole
#

You should test some value and use the best for you

#

I just thought β€œno t at the end” while writing it lol

clever wraith
#

Should i open a issue ?
It's obliviously need to be fixed tho

green oriole
#

Yes

#

Always open an issue before working on something

clever wraith
#

also i heard there are new template.

green oriole
#

Yep

clever wraith
#

Done add the tags

#

and approve it if you can

green oriole
#

Apply the tag?

clever wraith
#

labels

green oriole
#

I don’t really can, I’m not from the staff

#

but you have hemlock’s approval

clever wraith
#

should i tag him ?

#

I don't think he interfere in bot things

green oriole
#

Just go ahead and fix it πŸ˜„

#

this tag is about new features and things like that

#

He said you can fix it

clever wraith
#

oK

clever wraith
#

@green oriole there ?

green oriole
#

More or less

clever wraith
#

just wanna see if the code edit i did is enough ?
like it does what it supposed to be doing

clever wraith
#

what do you mean by LGTM and stale

gusty sonnet
#

Looks good to me

#

I didn't add the stale tag, prob can remove it but I'm on phone

long garnet
#

damn, I thought it meant Let's Get This Moving

hardy gorge
#

ah

#

jargon

#

I've always meant it as "looks good to me"

deft fog
#

hi

#

ves zappa

hardy gorge
#

Hello @deft fog

deft fog
#

how are u today

#

how is ur family

#

how is ur father and mother

#

and ur childrens

crude gyro
#

...

clever wraith
#

...

#

um

lapis hull
#

Hello folks, back for more help. I've got the site running locally. Currently writing tests for the "reminders" API endpoint. I have a handful of successful tests (just those looking for 401 & 404 responses). That's the background.

#

I'm getting nothing but 400-code responses when trying to create a valid instance of a reminder during the test setUp(). I've tried a range of things trying to see how I'm malforming the reminder POST body, with no luck. And something that seems odd - when I go to admin.pythondiscord.local:8000, I do not see a section for Reminders under the API section.

#

That might be a red herring though, because in pgAdmin I do see an api_reminder table in the pysite DB.

#

I guess here's the simplest version of the code that I've tried that's giving issues. And beyond this simple example, I've tried a bunch of other ways to format self.data, including specifying all the fields of the Reminder model, and providing a datetime.now() object for the expiration.

class ReminderCreationTests(APISubdomainTestCase):
    def setUp(self):
        super().setUp()
        self.author = User.objects.create(
            id=1234,
            name='Mermaid Man',
            discriminator=1234,
            avatar_hash=None,
        )
        self.data = {
            'author': self.author.id,
            'content': 'Remember to...wait what was it again?',
            'expiration': datetime.utcnow().isoformat(),
        }

        url = reverse('bot:reminder-list', host='api')
        response = self.client.post(url, data=self.data)
        self.assertEqual(response.status_code, 201)

    def test_reminder_in_full_list(self):
        self.assertTrue(True)
tawdry vapor
#

Is the date in the correct format?

#

It's a bit picky with the formats it supports

lapis hull
#

I think so. The code I supplied uses the example for expiration given in the ReminderViewSet definition I believe. I also tried just passing regular datetime.datetime objects. I'm not in front of it now, but for tomorrow, do you know if the response object has any other fields that'd help discover why it's being rejected?

tawdry vapor
#

I'm not sure. Try to attach a debugger and step through the code in the code in the viewset

#

If there is an error with a specific field the error message will specify the erroneous field

lapis hull
#

Ooo I've never done that, good idea. Should be able to try it tomorrow, thanks!

clever wraith
#

wonder if someone approves my PR . alredy have 1 approval . seasonalbot
i want it to pass cuz its a bug.

green oriole
#

You have the link?

#

I can check it real quick

#

Okay, just need for a core dev to press the merge button :)

sharp timber
#

The bot's output seems to be ending up with stderr in front of stdout instead of intermixing them now?

#

!e ```py
import time
print(1)
time.sleep(0.5)
raise ValueError("test")

stable mountainBOT
#

@sharp timber :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 4, in <module>
003 | ValueError: test
004 | 1
sharp timber
green oriole
#

Hmm

#

Interesting

#

Lemme see

#

apparently github doesn't want to load the file history

#

Only 3 commits in this range

#

None are really related to the formatting

#

Maybe it is the fault of the snekbox container

#

Which.. Would make sense

hardy gorge
#

Yes, that's the place where this probably happens

#

The bot just displays the info it gets from the API and I don't think it gets the output separated by stdout/stderr

sharp timber
#

I would bet money it has to do with the transition from ash to bash

green oriole
#

Probably, that's the only thing that changed

#

The nsjail.py file wasn't updated in this range

sharp timber
#

Pycharm actually has a similar issue

#

IIRC the reason given was because the stderr/stdout streams are handled differently, and because of how pycharm does it's locking internally it's only line-atomic, not print-atomic like you'd expect a terminal to be

green oriole
#

NsJail apparently doesn't even make a difference between stdout and stderr

sharp timber
#

I've found references to bash doing this in other situations

green oriole
#

Seems logic, the OS buffer stdout to avoid doing too much file write

#

So, just a matter of adding the command to the dockerfile?

sharp timber
#

I'm not sure

#

I do technically have a working dev environment, let me spin it up and try a few things

#

docker was updated, but not on my end, weee

green oriole
#

Not on your end?

sharp timber
#

The docker version IIRC was updated in the repo, but my distro does not have the updated docker-compose support

#

... -.-

#

It wasn't updated, so what exactly is wrong on my system

#

K, I ran the build commands wrong and the error message was extremely misleading

green oriole
#

Because error messages should be meaningful?._.

sharp timber
#

"Error: Version in ./docker-compose.yaml is not supported"

#

Reality: the image was never build with pipenv

green oriole
#

Haha

sharp timber
#

nope, still doing it

green oriole
#

I guess it is about the image version maybe

sharp timber
#

ffffs

green oriole
#

Last time I tried to build it, I had to build three images

sharp timber
#

docker-compose is behaving very badly on my system, but devsh works now so shrug

#

on my machine, via nsjpy, with (supposedly) up to date snekbox it works

#

Which makes sense, since nsjpy doesn't actually run the subprocess code

#

So I can run the dev stuff, but not the box itself, which si strange

#

pipenv run devsh is a-ok, but docker-compose up breaks

#

There we go

#

yeah, my version of docker-compose was way out of date

#

Got postman and /eval triggering each other, so here goes..

#

There, now that code's running here goes..

#

Passing -u to python reverts back to the old behavior

green oriole
#

Well

#

There you have it πŸ˜„

sharp timber
#

might as well write up a bug report

lapis hull
#

@tawdry vapor Putting it through a debugger and checking data at breakpoints was a great suggestion, both because it allowed me to find the problem, and because it gave me a good opportunity to start learning debuggers. Thanks!

tawdry vapor
#

You're welcome glad you solved it

long garnet
#

oh nvm, is it because I added text in the same message?

#

oh ye that's what it is

tawdry vapor
#

Build 20200111.1 succeeded

#

that's a nice number

green oriole
#

@hard solar roothink the staging bot is back?

molten bough
#

Oh cool, prometheus

#

I've heard good things about that

last patio
#

yeah it's brilliant

green oriole
#

Guys roothink

#

!e print('hello')

stable mountainBOT
#

Sorry, but you may only use this command within #bot-commands.

hard solarBOT
#

Sorry, but you may only use this command within #bot-commands.

green oriole
#

^ @hard solar shouldn’t be limited to a specific channel?

last patio
#

oh

#

Yeah I'll switch it to the other server now

#

but I needed a large guild for testing

last patio
#

@molten bough have you used prometheus yourself?

molten bough
#

I haven't, no

#

I just run a gitlab and I noticed it can deploy an entire prometheus cluster to k8s automatically for some reason

#

That's where I first heard of it

last patio
#

ah okay

#

any idea for other useful metrics apart from users online by status & messages by channel?

molten bough
#

I'm a person that enjoys statistics in general

#

when working on a little Discord bot for logging stuff to influxdb I was trying to do stuff like list the most popular spotify songs and things like that

#

but honestly outside of activity metrics, I can't think of much useful stuff

last patio
#

hmm

#

well, guild members and guild messages are also the only two things i track on my own bot

#

maybe we'll think of something else

molten bough
#

Yeah, handy to have the option in future anyway

last patio
#

mhm

molten bough
#

Did you ever use pisg back on IRC?

#

that thing was the shit

last patio
#

i've never used irc :(

molten bough
#

it's mostly just for fun and some of it feels mean now, but it was nice at the time

last patio
#

ooo that's interesting

molten bough
#

Yeah, I see the resemblance

last patio
#

there's similar metrics there - but they also track by-user and i think that's super creepy

#

(they even store typing events)

molten bough
#

I can understand storing some by-user stuff, but yeah, typing is.. a bit much

#

and of course something like pisg actually keeps message content, which is probably no good here too

last patio
#

yeah

#

also kept by the data delver hyperlemon

molten bough
#

haha

green oriole
#

Hi @nocturne hare, do you need any help to setup the pydis site on your machine? I had some problems too (mainly due to windows), if I can be useful in any sort

nocturne hare
#

I had some issues with it complaining about invalid Form data

#

but didn't look into it

green oriole
#

Hmm

#

Do you recall which cog was causing this issue?

nocturne hare
#

I closed it all down :P

#

I'll keep you in mind if I get it again

#

I just had a moment of anger when I couldn't do !rules 6 pls no advertisement

#

so i fixed it

green oriole
#

Haha

sullen phoenix
#

!rule 5

stable mountainBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious/inappropriate or be for graded coursework/exams.

sullen phoenix
#

huh works here

woeful thorn
#

The fix was merged a half hour ago

sullen phoenix
#

ahh thank you

sullen phoenix
#

hmm still getting the same error

#
bot_1       | Jan 12 17:25:03 Bot: |            bot.cogs.error_handler |    ERROR | Error executing command invoked by f1re#3996: !rule 6
web_1       | "POST /logs HTTP/1.1" 201 220
bot_1       | Jan 12 17:26:14 Bot: |                    bot.cogs.alias |    DEBUG | site rules was invoked through an alias
bot_1       | Jan 12 17:26:14 Bot: |                    bot.pagination |    TRACE | Added line to paginator: '**5.** Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious/inappropriate or be for graded coursework/exams.'
bot_1       | Jan 12 17:26:14 Bot: |                    bot.pagination |    DEBUG | Paginator created with 1 pages
bot_1       | Jan 12 17:26:14 Bot: |                    bot.pagination |    DEBUG | There's less than two pages, so we won't paginate - sending single page on its own
web_1       | "GET /rules?link_format=md HTTP/1.1" 200 748
web_1       | "POST /logs HTTP/1.1" 201 189
web_1       | "POST /logs HTTP/1.1" 201 238
web_1       | "POST /logs HTTP/1.1" 201 186
bot_1       | Jan 12 17:26:14 Bot: |            bot.cogs.error_handler |    ERROR | Error executing command invoked by f1re#3996: !rule 5
tawdry vapor
#

Works for me

#

Are you sure you have the latest changed pulled?

sullen phoenix
#

yeah

#

well a new merge just came out 9 minutes ago

#

but other than that yeah

tawdry vapor
#

I don't know. It works for me and it works in production.

sullen phoenix
#

yeah i just did a fresh download

#

same issue

tawdry vapor
#

What's wrong with the docs command?

#

Tried getting django and discord.py docs, neither finds anything

#

But the inventories are there

#

Do they need a forced refresh?

#

Is that even possible?

hardy gorge
#

hmm

#

that's recent

#

hm

#

I've found something

#

!docs refresh

stable mountainBOT
#

Sorry, an unexpected error occurred. Please let us know!

AttributeError: ('intersphinx inventory %r not fetchable due to %s: %s', 'https://docs.python.org/3/objects.inv', <class 'AttributeError'>, "'DummyObject' object has no attribute 'user_agent'")

brazen charm
#

can't say that I know what the above means

hardy gorge
#

I have no idea either

#

I don't think it's part of something you wrote and it's recent

#

I wonder what changed.

#

There were a few changes in the last couple of days, I'll try to pinpoint it to a change

#

Maybe a dependency has changed

#

Ah, we recently merged a doc PR. I'll try to play around with that

gusty sonnet
#

That's an interesting error

hardy gorge
#

I've managed to replicate locally and I've got the full traceback

#

I'm making an issue first and maybe I'll try to do some probing later

brazen charm
#

unexpctedly got a bunch of free time so can look into it more, was working fine on my local branch for the latest doc fix I did but getting that thing above after syncing with upstream

hardy gorge
#

Yes

#

I'm looking at the lockfile now and we've seemed to have moved up a version of sphinx in the latest merge

#

The requests version has stayed the same, so that version upgrade could be the cause of it

#

hm

#

I need to solve another issue first.

#

@last patio Do you know if I have to do some manual clean-up after stopping the bot and before restarting it again? I'm now unable to start the bot because of

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/sebastiaan/pydis/repositories/djangobot/bot/__main__.py", line 61, in <module>
    bot.run(BotConfig.token)
  File "/home/sebastiaan/.local/share/virtualenvs/djangobot-Py5o4YeS/lib/python3.7/site-packages/discord/client.py", line 598, in run
    return future.result()
  File "/home/sebastiaan/.local/share/virtualenvs/djangobot-Py5o4YeS/lib/python3.7/site-packages/discord/client.py", line 579, in runner
    await self.start(*args, **kwargs)
  File "/home/sebastiaan/pydis/repositories/djangobot/bot/bot.py", line 54, in start
    await start_prometheus_http_server(addr="0.0.0.0", port=9330)
  File "/home/sebastiaan/.local/share/virtualenvs/djangobot-Py5o4YeS/lib/python3.7/site-packages/prometheus_async/aio/web.py", line 111, in start_http_server
    await site.start()
  File "/home/sebastiaan/.local/share/virtualenvs/djangobot-Py5o4YeS/lib/python3.7/site-packages/aiohttp/web_runner.py", line 102, in start
    reuse_port=self._reuse_port)
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1374, in create_server
    % (sa, err.strerror.lower())) from None
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 9330): address already in use
brazen charm
#

works fine for me with a pycharm run configuration that runs the module

hardy gorge
#

I can't start the bot and I'm still trying to figure out how to stop this server

#

Okay, it was some Python process lingering around after the bot process had exited

#

Hmm, it doesn't happen to me now either. It happened the first time, but it does not happen again now

#

I can't reproduce it now

hardy gorge
#

For some reason, I can't find anything in the docs of the standard lib. It may be a local problem, but I don't know what could cause it.

brazen charm
#

I'll put together a fix that will also hopefully make it clearer for the future, what useragent should it use?

hardy gorge
#

I currently have this:

class SphinxConfiguration:
    """Dummy configuration for use with intersphinx."""

    config = DummyObject()
    config.intersphinx_timeout = 3
    config.tls_verify = True
    config.user_agent = "Python Discord/1.0 (https://pythondiscord.com/)"
brazen charm
#

Used the one I found in the reddit cog, might be worth making it a const and pass everywhere

hardy gorge
#

If anyone with write-permissions has some time to review this small PR, it would be greatly appreciated

green oriole
#

With write permissions oops

#

I guess you can merge it now ves

hardy gorge
#

I think you have write permission, right? You're in the Contributors team on GitHub, are you not, @green oriole?

green oriole
#

I am, but I can't merge the PR

#

Master is protected

#

Even if there is two approvals

hardy gorge
#

Yes, but your reviews count towards the total number of reviews required (and you can make branches)

green oriole
#

Yep

hardy gorge
#

Right, that means you do have write access (officialy, it's only triage permissions that are needed for that, but our contrib team has write access so they can create branches directly on the repo).

green oriole
#

Okay nice

hardy gorge
#

Thanks, @brazen charm, for that quick fix

#

!docs get str.partition

stable mountainBOT
#
str.partition(sep)```
Split the string at the first occurrence of *sep*, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings.
green oriole
#

I feel like this server icon is missing some interpolation frames, doesn't it?

crude gyro
#

not sure what you mean

#

looks fine here

green oriole
#

It feels like it is running at 5FPS

#

Probably discord being discord then

hardy gorge
#

thanks discord for adjusting the aspect ratio

molten bough
#

Smooth here too

green oriole
#

Well, it is is smooth on my iPad too, probably just the android desktop working as expected

molten bough
#

Maybe your monitor has a weird refresh rate

green oriole
#

Monitor? It is on my phone :P

green oriole
#

Hmm, apparently you did disabled check_suite on the bot gh hook, but not on the site

last patio
#

@hardy gorge hm, I think the reuse flag should be set there - but if you find a way to reproduce it, I know a way to set it ourselves

hardy gorge
#

Strangly enough, it only happened during the very first time I ran the bot with that commit

lapis hull
#

I've got a branch that I believe is ready for PR / review. I've never done that from within the official repo, however, and I'd like to make sure I do it correctly. All my changes are currently local - do I first push my new branch up to the repo and then initiate the PR?

woeful thorn
#

Yes

mellow hare
#

Yep

lapis hull
#

Y'all are quick 😎

woeful thorn
#

I have my moments

last patio
#

doesn't django require migration IDs to be unique

#

like, the numeric part

tawdry vapor
#

Does the CI apply migrations?

#

It doesn't seem to matter as long as the dependencies are correct

last patio
#

I'm pretty sure it does, otherwise we would have some persistence there

#

yeah, seems right

last patio
#

@tawdry vapor Do you still have a repository for your Code Jam 3 submission up somewhere?

tawdry vapor
last patio
#

thank you

#

naw I get a blackscreen

#

does it not work on macOS

tawdry vapor
#

I dunno

#

It doesn't do anything special

#

Just uses pygame

last patio
#

hm

sharp timber
#

It's a pygame-on-osx thing

sharp timber
#

@last patio you can fix it by changing the pygame version to 2.0.0.dev6

last patio
#

thanks, I’ll try that tomorrow!

long garnet
#

!user seems to be broken, although I'm not sure why. I think it has something to do with the address of the Docker container it looks for, which I know little about

#

I don't know if that's really the case

#

what I have is bot_1 | aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.web:8000 ssl:None [Connect call failed ('172.18.0.3', 8000)]

#

there's no .0.3 if I do grep 172 <(ip -c addr)

#

!user

stable mountainBOT
#

Sorry, an unexpected error occurred. Please let us know!

TypeError: expected string or bytes-like object

tawdry vapor
#

Works for me when I run my own instances

#

well, the log on the site is useless

#

Error executing command invoked by manusaurio#5249: !user

#

!user

stable mountainBOT
#
Mark ♦ (Mark#3118)

User Information
Created: 4 years, 1 day and 15 hours ago
Profile: @tawdry vapor
ID: 137073073168973824

Member Information
Joined: 1 year, 6 months and 4 days ago
Roles: <@&352427296948486144>, <@&295488872404484098>, <@&587606783669829632>, <@&430492892331769857>, <@&267630620367257601>, <@&490216785547755530>

Infractions
Total: 0
Active: 0

tawdry vapor
#

πŸ€”

long garnet
#

I'm not worthy?

tawdry vapor
#

@last patio if you're around could you fetch the traceback for the earlier fail?

long garnet
#

!pep 249

stable mountainBOT
#
**PEP 249 - Python Database API Specification v2.0**
Status

Final

Type

Informational

last patio
#

I can't find any traceback

#

only some stuff in the metrics cog

long garnet
#

well, I have no idea why it's not responding to me, it's the same in my own server

#

if someone wants to invite me to their test server to use the command I'll do it

hardy gorge
#

!user 427194066216681474

stable mountainBOT
#

Sorry, an unexpected error occurred. Please let us know!

TypeError: expected string or bytes-like object

hardy gorge
#

Right

long garnet
#

I'm not the only one then

last patio
#

you mean the logs from docker logs, right?

hardy gorge
#

That was on your profile. There's something in there that it doesn't like.

#

It's an issue we've seen before, I think. Is there not an issue for it?

long garnet
#

should this be in bot or site?

hardy gorge
#

This is a bot issue

long garnet
#

I don't think I've seen it then

hardy gorge
#

You have a custom status, right?

long garnet
#

I have the hearts and the playing Emacs

hardy gorge
#

!user

woeful thorn
#

!user

stable mountainBOT
#

Sorry, an unexpected error occurred. Please let us know!

TypeError: expected string or bytes-like object

#
ELA#1711

User Information
Created: 4 years, 22 days and 5 hours ago
Profile: @woeful thorn
ID: 129606635545952258
Status: Locking...

Member Information
Joined: 1 year, 5 months and 14 days ago
Roles: <@&463658397560995840>, <@&352427296948486144>, <@&295488872404484098>, <@&587606783669829632>, <@&505040943800516611>, <@&585529568383860737>, <@&267630620367257601>, <@&542313670223331329>, <@&490216785547755530>, <@&267629731250176001>, <@&267628507062992896>

Infractions
Total: 4
Active: 0

hardy gorge
#

Right

#

I just set a custom emoji status on myself; it doesn't seem to like that

long garnet
#

!user

stable mountainBOT
#
manusaurio#5249

User Information
Created: 1 year, 9 months and 22 days ago
Profile: @long garnet
ID: 427194066216681474

Member Information
Joined: 6 months and 12 days ago
Roles: <@&463658397560995840>, <@&352427296948486144>, <@&267630620367257601>

Infractions
Total: 0
Active: 0

woeful thorn
#

I also have a custom emoji

long garnet
#

oh I see

#

mmm

hardy gorge
#

Yes, but you have additional text

#

I think that changes it somehow

long garnet
#

!user

stable mountainBOT
#

Sorry, an unexpected error occurred. Please let us know!

TypeError: expected string or bytes-like object

long garnet
#

!user

stable mountainBOT
#
manusaurio#5249

User Information
Created: 1 year, 9 months and 22 days ago
Profile: @long garnet
ID: 427194066216681474
Status: baba

Member Information
Joined: 6 months and 12 days ago
Roles: <@&463658397560995840>, <@&352427296948486144>, <@&267630620367257601>

Infractions
Total: 0
Active: 0

woeful thorn
#

!user

stable mountainBOT
#

Sorry, an unexpected error occurred. Please let us know!

TypeError: expected string or bytes-like object

hardy gorge
#

!user

long garnet
#

it's when I have emoji and no text it seems

stable mountainBOT
#
Ves Zappa#3787

User Information
Created: 2 years, 5 months and 28 days ago
Profile: @hardy gorge
ID: 336843820513755157
Status: text

Member Information
Joined: 1 year, 11 months and 3 days ago
Roles: <@&463658397560995840>, <@&352427296948486144>, <@&295488872404484098>, <@&587606783669829632>, <@&267630620367257601>, <@&490216785547755530>, <@&277914926603829249>, <@&270988689419665409>, <@&267629731250176001>, <@&267628507062992896>, <@&267627879762755584>

Infractions
Total: 7
Active: 0

woeful thorn
#

tada

hardy gorge
#

Cool, so it doesn't account for an emoji-only custom status

lofty goblet
#

!user

stable mountainBOT
#

Sorry, but you may only use this command within #bot-commands.

long garnet
#

CustomActivity (and its .emoji attribute) are new in d.py 1.3.0

#

it wouldn't be hard to simply check if the status text is empty for now, though

gusty sonnet
long garnet
#

alright

long garnet
#

it's done @gusty sonnet

#

do you want to add a note to my dummie 655232310878142466?

gusty sonnet
#

Sure, let me try

long garnet
#

great

gusty sonnet
#

Working as advertised!

#

Great work!

long garnet
#

thanks

green oriole
#

@mellow hare don’t know if you noticed it inside the conversation, but here it is https://github.com/python-discord/bot/issues/676 I got a little carried away by the holidays and the jam, but I’ll finish it soon(ish) for sure ^^

mellow hare
#

Ooooooo preeeeeetty

#

That's a brilliant idea

sullen phoenix
#

that'd be really useful

mellow hare
#

Especially for magnificent mess ups like I had earlier

eternal owl
#

Hey guys
Recently in a issue on github, scragly made a comment
For posts that are videos, we could use the page og:image meta tag, as it contains an image preview.
can explain me what is that og:image

molten bough
#

That's an OpenGraph <meta> tag

#

You'll find it in the <head>

eternal owl
#

how can i use it

#

I need to set it as a embed image

molten bough
#

Well you'll have to scrape it

#

Check out the HTML of a reddit post

#

you'll see it

eternal owl
#

okay

#

what if I download it and use it

molten bough
#

All you need is the URL

#

no need to download it

eternal owl
#

okay

#

will the tag be only for posts in which a video has been posted?

#

i see og:url but no og:image

molten bough
#

I dunno, it might be

#

you'll have to check

eternal owl
#

okay

green oriole
#

Poetry? roothink

molten bough
#

They already tried to do that

#

I think it didn't work out

clever wraith
#

am i supposed to have access to this channel?

hardy gorge
#

Yes

#

It's a public channel

clever wraith
#

oh. for some reason, I thought it was contributors-only